At the end of pmap_bootstrap, if PMAP_NEED_MAPKERNEL, map the kernel into

the kernel's pmap (text will be rx, data will be rw).
This commit is contained in:
matt 2006-09-19 20:19:53 +00:00
parent 0ffafee1bf
commit cbdd4e594a
1 changed files with 22 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.40 2006/09/07 16:00:29 sanjayl Exp $ */
/* $NetBSD: pmap.c,v 1.41 2006/09/19 20:19:53 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.40 2006/09/07 16:00:29 sanjayl Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41 2006/09/19 20:19:53 matt Exp $");
#include "opt_ppcarch.h"
#include "opt_altivec.h"
@ -3466,4 +3466,24 @@ pmap_bootstrap(paddr_t kernelstart, paddr_t kernelend)
pool_init(&pmap_pool, sizeof(struct pmap),
sizeof(void *), 0, 0, "pmap_pl", &pmap_pool_uallocator);
#if defined(PMAP_NEED_MAPKERNEL)
{
extern int etext[], kernel_text[];
vaddr_t va, va_etext = (paddr_t) etext;
paddr_t pa;
va = (vaddr_t) kernel_text;
for (pa = kernelstart; va < va_etext;
pa += PAGE_SIZE, va += PAGE_SIZE)
pmap_enter(pmap_kernel(), va, pa,
VM_PROT_READ|VM_PROT_EXECUTE, 0);
for (; pa < kernelend;
pa += PAGE_SIZE, va += PAGE_SIZE)
pmap_enter(pmap_kernel(), va, pa,
VM_PROT_READ|VM_PROT_WRITE, 0);
}
#endif
}