Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc.

Also update some comment.
Compile test only.
This commit is contained in:
tsutsui 2009-12-04 18:06:28 +00:00
parent 56d171a5c4
commit 97c41e17f2
10 changed files with 113 additions and 110 deletions

View File

@ -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 @@ Lenab1:
/* 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.

View File

@ -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 *msgbufaddr;
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 @@ pmap_bootstrap(vm_offset_t nextpa, vm_offset_t firstpa)
*
* 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 @@ pmap_bootstrap(vm_offset_t nextpa, vm_offset_t firstpa)
nextpa += PAGE_SIZE;
lkptpa = nextpa;
nextpa += PAGE_SIZE;
p0upa = nextpa;
lwp0upa = nextpa;
nextpa += USPACE;
kptpa = nextpa;
nptpages = RELOC(Sysptsize, int);
@ -141,10 +140,14 @@ pmap_bootstrap(vm_offset_t nextpa, vm_offset_t firstpa)
* 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 @@ pmap_bootstrap(vm_offset_t nextpa, vm_offset_t firstpa)
}
/*
* 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 @@ pmap_bootstrap(vm_offset_t nextpa, vm_offset_t firstpa)
(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

View File

@ -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 @@ Lenab1:
/* 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.

View File

@ -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 *msgbufaddr;
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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
*
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
}
/*
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
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)) -

View File

@ -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 @@ Lenab1:
/* 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

View File

@ -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, paddr_t);
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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
*
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
}
/*
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
(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

View File

@ -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 @@ Lenab1:
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.

View File

@ -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 *msgbufaddr;
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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
*
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
nextpa += PAGE_SIZE;
lkptpa = nextpa;
nextpa += PAGE_SIZE;
l0upa = nextpa;
lwp0upa = nextpa;
nextpa += USPACE;
kptpa = nextpa;
nptpages = RELOC(Sysptsize, int) +
@ -169,10 +169,14 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
}
/*
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
(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

View File

@ -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 @@ Lenab1:
/* 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.

View File

@ -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 *msgbufaddr;
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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
*
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
}
/*
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
* 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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
(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