summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Miller <kurt@cvs.openbsd.org>2008-12-18 14:17:29 +0000
committerKurt Miller <kurt@cvs.openbsd.org>2008-12-18 14:17:29 +0000
commitfde7dee97f3bbfea0d41129c4f5af8aa860bd32d (patch)
treeb89947014723ff16433422da5980ded522a983d4
parent650e0cdf12d66b23bc40a46efe127068129ab84a (diff)
Don't set the global bit PG_G for kernel pmap low memory mappings. Use a
new function pmap_prealloc_lowmem_ptp() to setup kernel pmap ptp 0 without the PG_G bit set. This fixes the remaining reaper -> pmap_page_remove panics. With much diagnostic help from Art and Theo. ok deraadt@
-rw-r--r--sys/arch/i386/i386/machdep.c10
-rw-r--r--sys/arch/i386/i386/pmap.c29
-rw-r--r--sys/arch/i386/include/pmap.h4
3 files changed, 33 insertions, 10 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 2fdda0bb18e..0f32126e5f8 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.441 2008/12/04 15:24:18 oga Exp $ */
+/* $OpenBSD: machdep.c,v 1.442 2008/12/18 14:17:28 kurt Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -2961,12 +2961,8 @@ init386(paddr_t first_avail)
#endif
#if defined(MULTIPROCESSOR)
- /* install the page after boot args as PT page for first 4M */
- pmap_enter(pmap_kernel(), (u_long)vtopte(0),
- round_page((vaddr_t)(bootargv + bootargc)),
- VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
- memset(vtopte(0), 0, NBPG); /* make sure it is clean before using */
+ /* install the lowmem ptp after boot args for 1:1 mappings */
+ pmap_prealloc_lowmem_ptp(round_page((paddr_t)(bootargv + bootargc)));
#endif
/*
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index bedde99979a..4b7337cdded 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.133 2008/12/18 13:43:24 kurt Exp $ */
+/* $OpenBSD: pmap.c,v 1.134 2008/12/18 14:17:28 kurt Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
@@ -700,7 +700,12 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot)
pte = vtopte(va);
npte = pa | ((prot & VM_PROT_WRITE)? PG_RW : PG_RO) | PG_V |
- pmap_pg_g | PG_U | PG_M;
+ PG_U | PG_M;
+
+ /* special 1:1 mappings in the first 4MB must not be global */
+ if (va >= (vaddr_t)NBPD)
+ npte |= pmap_pg_g;
+
opte = i386_atomic_testset_ul(pte, npte); /* zap! */
if (pmap_valid_entry(opte)) {
/* NB. - this should not happen. */
@@ -926,6 +931,26 @@ pmap_bootstrap(vaddr_t kva_start)
}
/*
+ * Pre-allocate PTP 0 for low memory, so that 1:1 mappings for various
+ * trampoline code can be entered.
+ */
+void
+pmap_prealloc_lowmem_ptp(paddr_t ptppa)
+{
+ pt_entry_t *pte, npte;
+ vaddr_t ptpva = (vaddr_t)vtopte(0);
+
+ /* enter pa for pte 0 into recursive map */
+ pte = vtopte(ptpva);
+ npte = ptppa | PG_RW | PG_V | PG_U | PG_M;
+
+ i386_atomic_testset_ul(pte, npte); /* zap! */
+
+ /* make sure it is clean before using */
+ memset((void *)ptpva, 0, NBPG);
+}
+
+/*
* pmap_init: called from uvm_init, our job is to get the pmap
* system ready to manage mappings... this mainly means initing
* the pv_entry stuff.
diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h
index 2f55cf75e27..fa446e6c2a0 100644
--- a/sys/arch/i386/include/pmap.h
+++ b/sys/arch/i386/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.49 2008/11/22 18:13:03 mikeb Exp $ */
+/* $OpenBSD: pmap.h,v 1.50 2008/12/18 14:17:28 kurt Exp $ */
/* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */
/*
@@ -392,6 +392,8 @@ void pmap_tlb_shootwait(void);
#define pmap_tlb_shootwait()
#endif
+void pmap_prealloc_lowmem_ptp(paddr_t);
+
#define PMAP_GROWKERNEL /* turn on pmap_growkernel interface */
/*