Make proc0 use the statically-allocate vmspace0 again, and make it use

the kernel's pmap, since proc0 (and other that share its address space)
are kernel-only processes, and should never contain userspace mappings.

This makes it easier to detect errors, like entering user mappings
for kernel processes, in pmap modules, and makes some sense, considering
that kernel processes are really just "thread contexts" for the kernel.
This commit is contained in:
thorpej 1998-03-27 01:52:01 +00:00
parent b65c510879
commit b436157e65
1 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.119 1998/03/22 18:22:07 thorpej Exp $ */
/* $NetBSD: init_main.c,v 1.120 1998/03/27 01:52:01 thorpej Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou. All rights reserved.
@ -261,14 +261,19 @@ main(framep)
limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = i / 3;
limit0.p_refcnt = 1;
/* Allocate a prototype map so we have something to fork. */
/*
* Initialize proc0's vmspace, which uses the kernel pmap.
* All kernel processes (which never have user space mappings)
* share proc0's vmspace, and thus, the kernel pmap.
*/
#if defined(UVM)
p->p_vmspace = uvmspace_alloc(round_page(VM_MIN_ADDRESS),
trunc_page(VM_MAX_ADDRESS), TRUE);
uvmspace_init(&vmspace0, pmap_kernel(), round_page(VM_MIN_ADDRESS),
trunc_page(VM_MAX_ADDRESS), TRUE);
#else
p->p_vmspace = vmspace_alloc(round_page(VM_MIN_ADDRESS),
trunc_page(VM_MAX_ADDRESS), TRUE);
vmspace_init(&vmspace0, pmap_kernel(), round_page(VM_MIN_ADDRESS),
trunc_page(VM_MAX_ADDRESS), TRUE);
#endif
p->p_vmspace = &vmspace0;
p->p_addr = proc0paddr; /* XXX */