Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/shark/ofw Add a second page table for the kernel im...



details:   https://anonhg.NetBSD.org/src/rev/f3d25a34c537
branches:  trunk
changeset: 524800:f3d25a34c537
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Mar 31 00:42:50 2002 +0000

description:
Add a second page table for the kernel image.  INSTALL kernels cross
a 4MB boundary.

XXX The 32-bit ARM VM layout needs a complete overhaul.  After 1.6.

diffstat:

 sys/arch/shark/ofw/ofw.c |  59 ++++++++++++++++++++++++++++-------------------
 1 files changed, 35 insertions(+), 24 deletions(-)

diffs (137 lines):

diff -r 5eeaf0d126e1 -r f3d25a34c537 sys/arch/shark/ofw/ofw.c
--- a/sys/arch/shark/ofw/ofw.c  Sun Mar 31 00:42:03 2002 +0000
+++ b/sys/arch/shark/ofw/ofw.c  Sun Mar 31 00:42:50 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofw.c,v 1.10 2002/03/25 04:51:21 thorpej Exp $ */
+/*     $NetBSD: ofw.c,v 1.11 2002/03/31 00:42:50 thorpej Exp $ */
 
 /*
  * Copyright 1997
@@ -76,6 +76,11 @@
 #define IO_VIRT_BASE (OFW_VIRT_BASE + OFW_VIRT_SIZE)
 #define IO_VIRT_SIZE 0x01000000
 
+#define        KERNEL_IMG_PTS          2
+#define        KERNEL_VMDATA_PTS       (KERNEL_VM_SIZE >> (PDSHIFT + 2))
+#define        KERNEL_OFW_PTS          4
+#define        KERNEL_IO_PTS           4
+
 /*
  *  Imported variables
  */
@@ -295,11 +300,12 @@
         *  the legal range.  OFW will have loaded the kernel text+data+bss
         *  starting at the bottom of the range, and we will allocate
         *  objects from the top, moving downwards.  The two sub-regions
-        *  will collide if their total sizes hit 4MB.  The current total
-        *  is <1.5MB, so we aren't in any real danger yet.  The variable
-        *  virt-freeptr represents the next free va (moving downwards).
+        *  will collide if their total sizes hit 8MB.  The current total
+        *  is <1.5MB, but INSTALL kernels are > 4MB, so hence the 8MB
+        *  limit.  The variable virt-freeptr represents the next free va
+        *  (moving downwards).
         */
-       virt_freeptr = KERNEL_BASE + 0x00400000;
+       virt_freeptr = KERNEL_BASE + (0x00400000 * KERNEL_IMG_PTS);
 }
 
 
@@ -1179,10 +1185,6 @@
        }
 }
 
-#define        KERNEL_VMDATA_PTS       (KERNEL_VM_SIZE >> (PDSHIFT + 2))
-#define        KERNEL_OFW_PTS          4
-#define        KERNEL_IO_PTS           4
-
 static void
 ofw_construct_proc0_addrspace(proc0_ttbbase, proc0_ptpt)
        pv_addr_t *proc0_ttbbase;
@@ -1192,7 +1194,7 @@
        pv_addr_t proc0_pagedir;
        pv_addr_t proc0_pt_pte;
        pv_addr_t proc0_pt_sys;
-       pv_addr_t proc0_pt_kernel;
+       pv_addr_t proc0_pt_kernel[KERNEL_IMG_PTS];
        pv_addr_t proc0_pt_vmdata[KERNEL_VMDATA_PTS];
        pv_addr_t proc0_pt_ofw[KERNEL_OFW_PTS];
        pv_addr_t proc0_pt_io[KERNEL_IO_PTS];
@@ -1229,7 +1231,8 @@
        ofw_claimpages(&virt_freeptr, &proc0_pagedir, PD_SIZE);
        ofw_claimpages(&virt_freeptr, &proc0_pt_pte, PT_SIZE);
        ofw_claimpages(&virt_freeptr, &proc0_pt_sys, PT_SIZE);
-       ofw_claimpages(&virt_freeptr, &proc0_pt_kernel, PT_SIZE);
+       for (i = 0; i < KERNEL_IMG_PTS; i++)
+               ofw_claimpages(&virt_freeptr, &proc0_pt_kernel[i], PT_SIZE);
        for (i = 0; i < KERNEL_VMDATA_PTS; i++)
                ofw_claimpages(&virt_freeptr, &proc0_pt_vmdata[i], PT_SIZE);
        for (i = 0; i < KERNEL_OFW_PTS; i++)
@@ -1253,7 +1256,9 @@
        L1pagetable = proc0_pagedir.pv_va;
 
        pmap_link_l2pt(L1pagetable, 0x0, &proc0_pt_sys);
-       pmap_link_l2pt(L1pagetable, KERNEL_BASE, &proc0_pt_kernel);
+       for (i = 0; i < KERNEL_IMG_PTS; i++)
+               pmap_link_l2pt(L1pagetable, KERNEL_BASE + i * 0x00400000,
+                   &proc0_pt_kernel[i]);
        pmap_link_l2pt(L1pagetable, PTE_BASE,
            &proc0_pt_pte);
        for (i = 0; i < KERNEL_VMDATA_PTS; i++)
@@ -1297,7 +1302,11 @@
                                /* page0 */
                                break;
 
-                       case (KERNEL_BASE >> (PDSHIFT + 2)):
+#if KERNEL_IMG_PTS != 2
+#error "Update ofw translation range list"
+#endif
+                       case ( KERNEL_BASE                 >> (PDSHIFT + 2)):
+                       case ((KERNEL_BASE   + 0x00400000) >> (PDSHIFT + 2)):
                                /* kernel static area */
                                break;
 
@@ -1335,20 +1344,21 @@
         * we don't want aliases to physical addresses that the kernel
         * has-mapped/will-map elsewhere.
         */
-       ofw_discardmappings(proc0_pt_kernel.pv_va,
+       ofw_discardmappings(proc0_pt_kernel[KERNEL_IMG_PTS - 1].pv_va,
            proc0_pt_sys.pv_va, PT_SIZE);
-       ofw_discardmappings(proc0_pt_kernel.pv_va,
-           proc0_pt_kernel.pv_va, PT_SIZE);
+       for (i = 0; i < KERNEL_IMG_PTS; i++)
+               ofw_discardmappings(proc0_pt_kernel[KERNEL_IMG_PTS - 1].pv_va,
+                   proc0_pt_kernel[i].pv_va, PT_SIZE);
        for (i = 0; i < KERNEL_VMDATA_PTS; i++)
-               ofw_discardmappings(proc0_pt_kernel.pv_va,
+               ofw_discardmappings(proc0_pt_kernel[KERNEL_IMG_PTS - 1].pv_va,
                    proc0_pt_vmdata[i].pv_va, PT_SIZE);
        for (i = 0; i < KERNEL_OFW_PTS; i++)
-               ofw_discardmappings(proc0_pt_kernel.pv_va,
+               ofw_discardmappings(proc0_pt_kernel[KERNEL_IMG_PTS - 1].pv_va,
                    proc0_pt_ofw[i].pv_va, PT_SIZE);
        for (i = 0; i < KERNEL_IO_PTS; i++)
-               ofw_discardmappings(proc0_pt_kernel.pv_va,
+               ofw_discardmappings(proc0_pt_kernel[KERNEL_IMG_PTS - 1].pv_va,
                    proc0_pt_io[i].pv_va, PT_SIZE);
-       ofw_discardmappings(proc0_pt_kernel.pv_va,
+       ofw_discardmappings(proc0_pt_kernel[KERNEL_IMG_PTS - 1].pv_va,
            msgbuf.pv_va, MSGBUFSIZE);
 
        /*
@@ -1374,10 +1384,11 @@
            PTE_BASE + (0x00000000 >> (PGSHIFT-2)),
            proc0_pt_sys.pv_pa,
            VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
-       pmap_map_entry(L1pagetable,
-           PTE_BASE + (KERNEL_BASE >> (PGSHIFT-2)),
-           proc0_pt_kernel.pv_pa,
-           VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
+       for (i = 0; i < KERNEL_IMG_PTS; i++)
+               pmap_map_entry(L1pagetable,
+                   PTE_BASE + ((KERNEL_BASE + i * 0x00400000) >> (PGSHIFT-2)),
+                   proc0_pt_kernel[i].pv_pa,
+                   VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE);
        pmap_map_entry(L1pagetable,
            PTE_BASE + (PTE_BASE >> (PGSHIFT-2)),
            proc0_pt_pte.pv_pa,



Home | Main Index | Thread Index | Old Index