Module Name: src Committed By: tsutsui Date: Fri Dec 4 18:06:28 UTC 2009
Modified Files: src/sys/arch/cesfic/cesfic: locore.s pmap_bootstrap.c src/sys/arch/luna68k/luna68k: locore.s pmap_bootstrap.c src/sys/arch/mvme68k/mvme68k: locore.s pmap_bootstrap.c src/sys/arch/next68k/next68k: locore.s pmap_bootstrap.c src/sys/arch/x68k/x68k: locore.s pmap_bootstrap.c Log Message: Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc. Also update some comment. Compile test only. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/cesfic/cesfic/locore.s \ src/sys/arch/cesfic/cesfic/pmap_bootstrap.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/luna68k/luna68k/locore.s cvs rdiff -u -r1.19 -r1.20 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c cvs rdiff -u -r1.101 -r1.102 src/sys/arch/mvme68k/mvme68k/locore.s cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c cvs rdiff -u -r1.51 -r1.52 src/sys/arch/next68k/next68k/locore.s cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/next68k/pmap_bootstrap.c cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x68k/x68k/locore.s cvs rdiff -u -r1.42 -r1.43 src/sys/arch/x68k/x68k/pmap_bootstrap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/cesfic/cesfic/locore.s diff -u src/sys/arch/cesfic/cesfic/locore.s:1.18 src/sys/arch/cesfic/cesfic/locore.s:1.19 --- src/sys/arch/cesfic/cesfic/locore.s:1.18 Thu Nov 26 00:19:13 2009 +++ src/sys/arch/cesfic/cesfic/locore.s Fri Dec 4 18:06:28 2009 @@ -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. Index: src/sys/arch/cesfic/cesfic/pmap_bootstrap.c diff -u src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.18 src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.19 --- src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.18 Thu Nov 26 00:19:13 2009 +++ src/sys/arch/cesfic/cesfic/pmap_bootstrap.c Fri Dec 4 18:06:28 2009 @@ -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 Index: src/sys/arch/luna68k/luna68k/locore.s diff -u src/sys/arch/luna68k/luna68k/locore.s:1.30 src/sys/arch/luna68k/luna68k/locore.s:1.31 --- src/sys/arch/luna68k/luna68k/locore.s:1.30 Thu Nov 26 00:19:18 2009 +++ src/sys/arch/luna68k/luna68k/locore.s Fri Dec 4 18:06:28 2009 @@ -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. Index: src/sys/arch/luna68k/luna68k/pmap_bootstrap.c diff -u src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.19 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.20 --- src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.19 Thu Nov 26 00:19:18 2009 +++ src/sys/arch/luna68k/luna68k/pmap_bootstrap.c Fri Dec 4 18:06:28 2009 @@ -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)) - Index: src/sys/arch/mvme68k/mvme68k/locore.s diff -u src/sys/arch/mvme68k/mvme68k/locore.s:1.101 src/sys/arch/mvme68k/mvme68k/locore.s:1.102 --- src/sys/arch/mvme68k/mvme68k/locore.s:1.101 Thu Nov 26 00:19:19 2009 +++ src/sys/arch/mvme68k/mvme68k/locore.s Fri Dec 4 18:06:28 2009 @@ -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 Index: src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.32 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.33 --- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.32 Thu Nov 26 00:19:19 2009 +++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Fri Dec 4 18:06:28 2009 @@ -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) { - paddr_t kstpa, kptpa, kptmpa, lkptpa, l0upa; + paddr_t kstpa, kptpa, kptmpa, lkptpa, lwp0upa; u_int nptpages, kstsize; st_entry_t protoste, *ste; pt_entry_t protopte, *pte, *epte; @@ -113,7 +113,7 @@ * * lkptpa last kernel PT page 1 page * - * l0upa lwp0 0 u-area UPAGES pages + * lwp0upa lwp0 0 u-area UPAGES pages * * The KVA corresponding to any of these PAs is: * (PA - firstpa + KERNBASE). @@ -133,7 +133,7 @@ nextpa += PAGE_SIZE; lkptpa = nextpa; nextpa += PAGE_SIZE; - l0upa = nextpa; + lwp0upa = nextpa; nextpa += USPACE; kptpa = nextpa; nptpages = RELOC(Sysptsize, int) + (iiomappages + NPTEPG - 1) / NPTEPG; @@ -159,10 +159,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 @@ -324,7 +328,7 @@ } /* * Validate PTEs for kernel data/bss, dynamic data allocated - * by us so far (kstpa - firstpa bytes), and pages for proc0 + * by us so far (kstpa - firstpa bytes), and pages for lwp0 * u-area and page table allocated below (RW). */ epte = &((u_int *)kptpa)[m68k_btop(kstpa - firstpa)]; @@ -391,20 +395,20 @@ (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 *)l0upa; - epte = (u_int *)(l0upa + USPACE); + pte = (u_int *)lwp0upa; + epte = (u_int *)(lwp0upa + USPACE); while (pte < epte) *pte++ = 0; /* * Store the u-area into lwp0. */ - RELOC(lwp0.l_addr, struct user *) = (struct user *)(l0upa - firstpa); + RELOC(lwp0uarea, vaddr_t) = lwp0upa - firstpa; /* * Initialize the mem_clusters[] array for the crash dump Index: src/sys/arch/next68k/next68k/locore.s diff -u src/sys/arch/next68k/next68k/locore.s:1.51 src/sys/arch/next68k/next68k/locore.s:1.52 --- src/sys/arch/next68k/next68k/locore.s:1.51 Thu Nov 26 00:19:20 2009 +++ src/sys/arch/next68k/next68k/locore.s Fri Dec 4 18:06:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.51 2009/11/26 00:19:20 matt Exp $ */ +/* $NetBSD: locore.s,v 1.52 2009/12/04 18:06:28 tsutsui Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell @@ -458,15 +458,13 @@ bsr Lpushpc | Push the PC on the stack. Lpushpc: - -/* 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. Index: src/sys/arch/next68k/next68k/pmap_bootstrap.c diff -u src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.28 src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.29 --- src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.28 Thu Nov 26 00:19:20 2009 +++ src/sys/arch/next68k/next68k/pmap_bootstrap.c Fri Dec 4 18:06:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.28 2009/11/26 00:19:20 matt Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.29 2009/12/04 18:06:28 tsutsui Exp $ */ /* * This file was taken from mvme68k/mvme68k/pmap_bootstrap.c @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.28 2009/11/26 00:19:20 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.29 2009/12/04 18:06:28 tsutsui Exp $"); #include <sys/param.h> #include <sys/kcore.h> @@ -101,7 +101,7 @@ void pmap_bootstrap(paddr_t nextpa, paddr_t firstpa) { - paddr_t kstpa, kptpa, kptmpa, lkptpa, l0upa; + paddr_t kstpa, kptpa, kptmpa, lkptpa, lwp0upa; u_int nptpages, kstsize; st_entry_t protoste, *ste; pt_entry_t protopte, *pte, *epte; @@ -125,7 +125,7 @@ * * lkptpa last kernel PT page 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). @@ -142,7 +142,7 @@ nextpa += PAGE_SIZE; lkptpa = nextpa; nextpa += PAGE_SIZE; - l0upa = nextpa; + lwp0upa = nextpa; nextpa += USPACE; kptpa = nextpa; nptpages = RELOC(Sysptsize, int) + @@ -169,10 +169,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 @@ -342,7 +346,7 @@ } /* * Validate PTEs for kernel data/bss, dynamic data allocated - * by us so far (kstpa - firstpa bytes), and pages for proc0 + * by us so far (kstpa - firstpa bytes), and pages for lwp0 * u-area and page table allocated below (RW). */ epte = &((u_int *)kptpa)[m68k_btop(kstpa - firstpa)]; @@ -360,7 +364,7 @@ * map the kernel segment table cache invalidated for * these machines (for the 68040 not strictly necessary, but * recommended by Motorola; for the 68060 mandatory) - * XXX this includes l0upa. why? + * XXX this includes lwp0upa. why? */ epte = &((u_int *)kptpa)[m68k_btop(nextpa - firstpa)]; protopte = (protopte & ~PG_PROT) | PG_RW; @@ -435,21 +439,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 *)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; /* * Initialize the mem_clusters[] array for the crash dump Index: src/sys/arch/x68k/x68k/locore.s diff -u src/sys/arch/x68k/x68k/locore.s:1.93 src/sys/arch/x68k/x68k/locore.s:1.94 --- src/sys/arch/x68k/x68k/locore.s:1.93 Thu Nov 26 00:19:23 2009 +++ src/sys/arch/x68k/x68k/locore.s Fri Dec 4 18:06:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.93 2009/11/26 00:19:23 matt Exp $ */ +/* $NetBSD: locore.s,v 1.94 2009/12/04 18:06:28 tsutsui Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -941,14 +941,13 @@ /* detect FPU type */ jbsr _C_LABEL(fpu_probe) movl %d0,_C_LABEL(fputype) -/* set kernel stack, user SP, and initial pcb */ - lea _C_LABEL(lwp0),%a2 | grab lwp0.l_addr, and - 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 | grab 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. Index: src/sys/arch/x68k/x68k/pmap_bootstrap.c diff -u src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.42 src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.43 --- src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.42 Thu Nov 26 00:19:23 2009 +++ src/sys/arch/x68k/x68k/pmap_bootstrap.c Fri Dec 4 18:06:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.42 2009/11/26 00:19:23 matt Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.43 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.42 2009/11/26 00:19:23 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.43 2009/12/04 18:06:28 tsutsui Exp $"); #include "opt_m680x0.h" @@ -84,7 +84,7 @@ void pmap_bootstrap(paddr_t nextpa, paddr_t firstpa) { - paddr_t kstpa, kptpa, kptmpa, p0upa; + paddr_t kstpa, kptpa, kptmpa, lwp0upa; u_int nptpages, kstsize; st_entry_t protoste, *ste; pt_entry_t protopte, *pte, *epte; @@ -104,7 +104,7 @@ * * kptmpa kernel PT map 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). @@ -117,7 +117,7 @@ nextpa += kstsize * PAGE_SIZE; kptmpa = nextpa; nextpa += PAGE_SIZE; - p0upa = nextpa; + lwp0upa = nextpa; nextpa += USPACE; kptpa = nextpa; nptpages = RELOC(Sysptsize, int) + @@ -282,7 +282,7 @@ } /* * Validate PTEs for kernel data/bss, dynamic data allocated - * by us so far (kstpa - firstpa bytes), and pages for proc0 + * by us so far (kstpa - firstpa bytes), and pages for lwp0 * u-area and page table allocated below (RW). */ epte = &((u_int *)kptpa)[m68k_btop(kstpa - firstpa)]; @@ -300,7 +300,7 @@ * map the kernel segment table cache invalidated for * these machines (for the 68040 not strictly necessary, but * recommended by Motorola; for the 68060 mandatory) - * XXX this includes p0upa. why? + * XXX this includes lwp0upa. why? */ epte = &((u_int *)kptpa)[m68k_btop(nextpa - firstpa)]; protopte = (protopte & ~PG_PROT) | PG_RW; @@ -351,21 +351,21 @@ (pt_entry_t *)m68k_ptob((NPTEPG - 1) * 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 *) = (struct user *)(p0upa - firstpa); + RELOC(lwp0uarea, vaddr_t) = lwp0upa - firstpa; /* * VM data structures are now initialized, set up data for