Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Use common pmap_bootstrap_finalize() to initialize ...



details:   https://anonhg.NetBSD.org/src/rev/150f03802513
branches:  trunk
changeset: 749625:150f03802513
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Dec 04 18:06:28 2009 +0000

description:
Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc.
Also update some comment.
Compile test only.

diffstat:

 sys/arch/cesfic/cesfic/locore.s           |  11 ++++----
 sys/arch/cesfic/cesfic/pmap_bootstrap.c   |  37 ++++++++++++++++-------------
 sys/arch/luna68k/luna68k/locore.s         |  14 ++++------
 sys/arch/luna68k/luna68k/pmap_bootstrap.c |  25 +++++++++----------
 sys/arch/mvme68k/mvme68k/locore.s         |  13 ++++-----
 sys/arch/mvme68k/mvme68k/pmap_bootstrap.c |  32 ++++++++++++++-----------
 sys/arch/next68k/next68k/locore.s         |  14 ++++------
 sys/arch/next68k/next68k/pmap_bootstrap.c |  38 +++++++++++++++++-------------
 sys/arch/x68k/x68k/locore.s               |  13 ++++-----
 sys/arch/x68k/x68k/pmap_bootstrap.c       |  26 ++++++++++----------
 10 files changed, 113 insertions(+), 110 deletions(-)

diffs (truncated from 636 to 300 lines):

diff -r 0112da15c6a7 -r 150f03802513 sys/arch/cesfic/cesfic/locore.s
--- a/sys/arch/cesfic/cesfic/locore.s   Fri Dec 04 17:57:16 2009 +0000
+++ b/sys/arch/cesfic/cesfic/locore.s   Fri Dec 04 18:06:28 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.18 2009/11/26 00:19:13 matt Exp $ */
+/*     $NetBSD: locore.s,v 1.19 2009/12/04 18:06:28 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -334,14 +334,13 @@
 /* select the software page size now */
        lea     _ASM_LABEL(tmpstk),%sp  | temporary stack
        jbsr    _C_LABEL(uvm_setpagesize)  | select software page size
-/* set kernel stack, user SP, and initial pcb */
-       lea     _C_LABEL(lwp0),%a2      | get lwp0 pcb addr and initialize
-       movl    %a2,_C_LABEL(curlwp)    |   curlwp so that
-       movl    %a2@(L_ADDR),%a1        |   we don't deref NULL in trap()
+/* call final pmap setup which initialize lwp0, curlwp, and curpcb */
+       jbsr    _C_LABEL(pmap_bootstrap_finalize)
+/* set kernel stack, user SP */
+       movl    _C_LABEL(lwp0uarea),%a1 | get lwp0 uarea
        lea     %a1@(USPACE-4),%sp      | set kernel stack to end of area
        movl    #USRSTACK-4,%a2
        movl    %a2,%usp                | init user SP
-       movl    %a1,_C_LABEL(curpcb)    | lwp0 is running
 
        tstl    _C_LABEL(fputype)       | Have an FPU?
        jeq     Lenab2                  | No, skip.
diff -r 0112da15c6a7 -r 150f03802513 sys/arch/cesfic/cesfic/pmap_bootstrap.c
--- a/sys/arch/cesfic/cesfic/pmap_bootstrap.c   Fri Dec 04 17:57:16 2009 +0000
+++ b/sys/arch/cesfic/cesfic/pmap_bootstrap.c   Fri Dec 04 18:06:28 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.18 2009/11/26 00:19:13 matt Exp $ */
+/*     $NetBSD: pmap_bootstrap.c,v 1.19 2009/12/04 18:06:28 tsutsui Exp $      */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,12 +36,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.18 2009/11/26 00:19:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.19 2009/12/04 18:06:28 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/msgbuf.h>
-#include <sys/proc.h>
 
 #include <machine/frame.h>
 #include <machine/cpu.h>
@@ -84,7 +83,7 @@
 void
 pmap_bootstrap(vm_offset_t nextpa, vm_offset_t firstpa)
 {
-       vm_offset_t kstpa, kptpa, kptmpa, lkptpa, p0upa;
+       vm_offset_t kstpa, kptpa, kptmpa, lkptpa, lwp0upa;
        u_int nptpages, kstsize;
        st_entry_t protoste, *ste;
        pt_entry_t protopte, *pte, *epte;
@@ -106,7 +105,7 @@
         *
         *      lkptpa          last kernel PT page     1 page
         *
-        *      p0upa           proc 0 u-area           UPAGES pages
+        *      lwp0upa         lwp 0 u-area            UPAGES pages
         *
         * The KVA corresponding to any of these PAs is:
         *      (PA - firstpa + KERNBASE).
@@ -121,7 +120,7 @@
        nextpa += PAGE_SIZE;
        lkptpa = nextpa;
        nextpa += PAGE_SIZE;
-       p0upa = nextpa;
+       lwp0upa = nextpa;
        nextpa += USPACE;
        kptpa = nextpa;
        nptpages = RELOC(Sysptsize, int);
@@ -141,10 +140,14 @@
         * each mapping 256kb.  Note that there may be additional "segment
         * table" pages depending on how large MAXKL2SIZE is.
         *
-        * Portions of the last segment of KVA space (0xFFF00000 -
-        * 0xFFFFFFFF) are mapped for a couple of purposes.  0xFFF00000
-        * for UPAGES is used for mapping the current process u-area
-        * (u + kernel stack).  The very last page (0xFFFFF000) is mapped
+        * Portions of the last two segment of KVA space (0xFF800000 -
+        * 0xFFFFFFFF) are mapped for a couple of purposes.
+        * The first segment (0xFF800000 - 0xFFBFFFFF) is mapped
+        * for the kernel page tables.
+        *
+        * XXX: It looks this was copied from hp300 and not sure if
+        * XXX: last physical page mapping is really needed on this port.
+        * The very last page (0xFFFFF000) in the second segment is mapped
         * to the last physical page of RAM to give us a region in which
         * PA == VA.  We use the first part of this page for enabling
         * and disabling mapping.  The last part of this page also contains
@@ -313,7 +316,7 @@
        }
        /*
         * Validate PTEs for kernel data/bss, dynamic data allocated
-        * by us so far (nextpa - firstpa bytes), and pages for proc0
+        * by us so far (nextpa - firstpa bytes), and pages for lwp0
         * u-area and page table allocated below (RW).
         */
        epte = &((u_int *)kptpa)[m68k_btop(KERNBASE + nextpa - firstpa)];
@@ -350,21 +353,21 @@
            (pt_entry_t *)m68k_ptob((NPTEPG - 2) * NPTEPG);
 
        /*
-        * Setup u-area for process 0.
+        * Setup u-area for lwp 0.
         */
        /*
         * Zero the u-area.
         * NOTE: `pte' and `epte' aren't PTEs here.
         */
-       pte = (u_int *)p0upa;
-       epte = (u_int *)(p0upa + USPACE);
+       pte = (u_int *)lwp0upa;
+       epte = (u_int *)(lwp0upa + USPACE);
        while (pte < epte)
                *pte++ = 0;
        /*
-        * Remember the u-area address so it can be loaded in the
-        * proc struct p_addr field later.
+        * Remember the u-area address so it can be loaded in the lwp0
+        * via uvm_lwp_setuarea() later in pmap_bootstrap_finalize().
         */
-       RELOC(lwp0.l_addr, struct user *) = (char *)(p0upa - firstpa + KERNBASE);
+       RELOC(lwp0uarea, vaddr_t) = lwp0upa - firstpa + KERNBASE;
 
        /*
         * VM data structures are now initialized, set up data for
diff -r 0112da15c6a7 -r 150f03802513 sys/arch/luna68k/luna68k/locore.s
--- a/sys/arch/luna68k/luna68k/locore.s Fri Dec 04 17:57:16 2009 +0000
+++ b/sys/arch/luna68k/luna68k/locore.s Fri Dec 04 18:06:28 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.30 2009/11/26 00:19:18 matt Exp $ */
+/* $NetBSD: locore.s,v 1.31 2009/12/04 18:06:28 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -312,15 +312,13 @@
 /* select the software page size now */
        lea     _ASM_LABEL(tmpstk),%sp  | temporary stack
        jbsr    _C_LABEL(uvm_setpagesize) | select software page size
-
-/* set kernel stack, user SP, lwp0, and initial pcb */
-       lea     _C_LABEL(lwp0),%a2      | get lwp0.l_addr
-       movl    %a2@(L_ADDR),%a1        |   set kernel stack to end of area 
-       lea     %a1@(USPACE-4),%sp      |   and curlwp so that we don't
-       movl    %a2,_C_LABEL(curlwp)    |   deref NULL in trap()
+/* call final pmap setup which initialize lwp0, curlwp, and curpcb */
+       jbsr    _C_LABEL(pmap_bootstrap_finalize)
+/* set kernel stack, user SP */
+       movl    _C_LABEL(lwp0uarea),%a1 | get lwp0 uarea
+       lea     %a1@(USPACE-4),%sp      | set kernel stack to end of area
        movl    #USRSTACK-4,%a2
        movl    %a2,%usp                | init user SP
-       movl    %a1,_C_LABEL(curpcb)    | lwp0 is running
 
        tstl    _C_LABEL(fputype)       | Have an FPU?
        jeq     Lenab2                  | No, skip.
diff -r 0112da15c6a7 -r 150f03802513 sys/arch/luna68k/luna68k/pmap_bootstrap.c
--- a/sys/arch/luna68k/luna68k/pmap_bootstrap.c Fri Dec 04 17:57:16 2009 +0000
+++ b/sys/arch/luna68k/luna68k/pmap_bootstrap.c Fri Dec 04 18:06:28 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.19 2009/11/26 00:19:18 matt Exp $ */
+/*     $NetBSD: pmap_bootstrap.c,v 1.20 2009/12/04 18:06:28 tsutsui Exp $      */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,10 +36,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.19 2009/11/26 00:19:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.20 2009/12/04 18:06:28 tsutsui Exp $");
 
 #include <sys/param.h>
-#include <sys/proc.h>
 
 #include <machine/frame.h>
 #include <machine/cpu.h>
@@ -84,7 +83,7 @@
 void
 pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
 {
-       paddr_t kstpa, kptpa, kptmpa, l0upa;
+       paddr_t kstpa, kptpa, kptmpa, lwp0upa;
        u_int nptpages, kstsize;
        st_entry_t protoste, *ste;
        pt_entry_t protopte, *pte, *epte;
@@ -105,7 +104,7 @@
         *
         *      kptmpa          kernel PT map           1 page
         *
-        *      l0upa           lwp 0 u-area            UPAGES pages
+        *      lwp0upa         lwp 0 u-area            UPAGES pages
         *
         * The KVA corresponding to any of these PAs is:
         *      (PA - firstpa + KERNBASE).
@@ -121,7 +120,7 @@
        nextpa += kstsize * PAGE_SIZE;
        kptmpa = nextpa;
        nextpa += PAGE_SIZE;
-       l0upa = nextpa;
+       lwp0upa = nextpa;
        nextpa += USPACE;
        kptpa = nextpa;
        nptpages = RELOC(Sysptsize, int) +
@@ -287,7 +286,7 @@
        }
        /*
         * Validate PTEs for kernel data/bss, dynamic data allocated
-        * by us so far (nextpa - firstpa bytes), and pages for proc0
+        * by us so far (nextpa - firstpa bytes), and pages for lwp0
         * u-area and page table allocated below (RW).
         */
        epte = &((u_int *)kptpa)[m68k_btop(nextpa - firstpa)];
@@ -338,21 +337,21 @@
        RELOC(Sysmap, pt_entry_t *) = (pt_entry_t *)SYSMAP_VA;
 
        /*
-        * Setup u-area for process 0.
+        * Setup u-area for lwp 0.
         */
        /*
         * Zero the u-area.
         * NOTE: `pte' and `epte' aren't PTEs here.
         */
-       pte = (u_int *)l0upa;
-       epte = (u_int *)(l0upa + USPACE);
+       pte = (u_int *)lwp0upa;
+       epte = (u_int *)(lwp0upa + USPACE);
        while (pte < epte)
                *pte++ = 0;
        /*
-        * Remember the u-area address so it can be loaded in the
-        * proc struct p_addr field later.
+        * Remember the u-area address so it can be loaded in the lwp0
+        * via uvm_lwp_setuarea() later in pmap_bootstrap_finalize().
         */
-       RELOC(lwp0.l_addr, struct user *) = (struct user *)(l0upa - firstpa);
+       RELOC(lwp0uarea, vaddr_t) = lwp0upa - firstpa;
 
        RELOC(avail_start, paddr_t) = nextpa;
        RELOC(avail_end, paddr_t) = m68k_ptob(RELOC(maxmem, int)) -
diff -r 0112da15c6a7 -r 150f03802513 sys/arch/mvme68k/mvme68k/locore.s
--- a/sys/arch/mvme68k/mvme68k/locore.s Fri Dec 04 17:57:16 2009 +0000
+++ b/sys/arch/mvme68k/mvme68k/locore.s Fri Dec 04 18:06:28 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.101 2009/11/26 00:19:19 matt Exp $        */
+/*     $NetBSD: locore.s,v 1.102 2009/12/04 18:06:28 tsutsui Exp $     */
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -667,14 +667,13 @@
 /* select the software page size now */
        lea     _ASM_LABEL(tmpstk),%sp  | temporary stack
        jbsr    _C_LABEL(uvm_setpagesize)  | select software page size
-/* set kernel stack, user SP, and initial pcb */
-       lea     _C_LABEL(lwp0),%a2      | get lwp0.l_addr
-       movl    %a2@(L_ADDR),%a1        |   set kernel stack to end of area 
-       lea     %a1@(USPACE-4),%sp      |   and curlwp so that we don't
-       movl    %a2,_C_LABEL(curlwp)    |   deref NULL in trap()
+/* call final pmap setup which initialize lwp0, curlwp, and curpcb */
+       jbsr    _C_LABEL(pmap_bootstrap_finalize)
+/* set kernel stack, user SP */
+       movl    _C_LABEL(lwp0uarea),%a1 | get lwp0 uarea
+       lea     %a1@(USPACE-4),%sp      | set kernel stack to end of area
        movl    #USRSTACK-4,%a2
        movl    %a2,%usp                | init user SP
-       movl    %a1,_C_LABEL(curpcb)    | lwp0 is running
        tstl    _C_LABEL(fputype)       | Have an FPU?
        jeq     Lenab2                  | No, skip.
        clrl    %a1@(PCB_FPCTX)         | ensure null FP context
diff -r 0112da15c6a7 -r 150f03802513 sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
--- a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Fri Dec 04 17:57:16 2009 +0000
+++ b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Fri Dec 04 18:06:28 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.32 2009/11/26 00:19:19 matt Exp $ */
+/*     $NetBSD: pmap_bootstrap.c,v 1.33 2009/12/04 18:06:28 tsutsui Exp $      */
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.32 2009/11/26 00:19:19 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.33 2009/12/04 18:06:28 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kcore.h>
@@ -88,7 +88,7 @@
 void
 pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
 {



Home | Main Index | Thread Index | Old Index