summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2001-04-10 06:59:14 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2001-04-10 06:59:14 +0000
commit0e620e3db39f58118e3e8148f2fc82ffb451e67c (patch)
tree408eb472eb9c9ade14a66ec7e7f46376383b4db7
parent517e9482c619086e7cea98ef5591f85bfe04b51d (diff)
Fix for machines which need to enlarge the kernel address space, at least
1GB i386 machines needs this. The fix is heavily based on Jason Thorpe's found in NetBSD. Here is his original commit message: Instead of checking vm_physmem[<physseg>].pgs to determine if uvm_page_init() has completed, add a boolean uvm.page_init_done, and test against that. Use this same boolean (rather than pmap_initialized) in pmap_growkernel() to determine if we are being called via uvm_page_init() to grow the kernel address space. This fixes a problem on some i386 configurations where pmap_init() itself was needing to have the kernel page table grown, and since pmap_initialized was not yet set to TRUE, pmap_growkernel() was choosing the wrong code path.
-rw-r--r--sys/arch/alpha/alpha/pmap.c16
-rw-r--r--sys/arch/i386/i386/pmap.c10
-rw-r--r--sys/arch/vax/vax/pmap.c11
-rw-r--r--sys/uvm/uvm.h3
-rw-r--r--sys/uvm/uvm_page.c5
5 files changed, 20 insertions, 25 deletions
diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c
index b981c71d423..258247c401d 100644
--- a/sys/arch/alpha/alpha/pmap.c
+++ b/sys/arch/alpha/alpha/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.11 2001/03/16 14:10:23 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.12 2001/04/10 06:59:13 niklas Exp $ */
/* $NetBSD: pmap.c,v 1.148 2000/09/22 05:23:37 thorpej Exp $ */
/*-
@@ -1065,14 +1065,8 @@ pmap_steal_memory(vsize_t size, vaddr_t *vstartp, vaddr_t *vendp)
#endif
for (bank = 0; bank < vm_nphysseg; bank++) {
-#if 0
if (uvm.page_init_done == TRUE)
panic("pmap_steal_memory: called _after_ bootstrap");
-#else
- /* XXXX */
- if (vm_physmem[0].pgs)
- panic("vm_page_physget: called _after_ bootstrap");
-#endif
#if 0
@@ -3448,11 +3442,7 @@ pmap_growkernel(vaddr_t maxkvaddr)
/*
* XXX PGU_NORMAL? It's not a "traditional" PT page.
*/
-#ifdef notyet
if (uvm.page_init_done == FALSE) {
-#else
- if (vm_physmem[0].pgs == NULL) {
-#endif
/*
* We're growing the kernel pmap early (from
* uvm_pageboot_alloc()). This case must
@@ -3493,11 +3483,7 @@ pmap_growkernel(vaddr_t maxkvaddr)
*/
l2pte = pmap_l2pte(kpm, va, l1pte);
KASSERT(pmap_pte_v(l2pte) == 0);
-#ifdef notyet
if (uvm.page_init_done == FALSE) {
-#else
- if (vm_physmem[0].pgs == NULL) {
-#endif
/*
* See above.
*/
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index 28ec9a8ab5e..31f86a086c6 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.38 2001/03/22 23:36:51 niklas Exp $ */
+/* $OpenBSD: pmap.c,v 1.39 2001/04/10 06:59:13 niklas Exp $ */
/* $NetBSD: pmap.c,v 1.84 2000/02/21 02:01:24 chs Exp $ */
/*
@@ -3658,7 +3658,7 @@ pmap_growkernel(maxkvaddr)
for (/*null*/ ; nkpde < needed_kpde ; nkpde++) {
- if (pmap_initialized == FALSE) {
+ if (uvm.page_init_done == FALSE) {
/*
* we're growing the kernel pmap early (from
@@ -3677,6 +3677,12 @@ pmap_growkernel(maxkvaddr)
continue;
}
+ /*
+ * THIS *MUST* BE CODED SO AS TO WORK IN THE
+ * pmap_initialized == FALSE CASE! WE MAY BE
+ * INVOKED WHILE pmap_init() IS RUNNING!
+ */
+
if (pmap_alloc_ptp(kpm, PDSLOT_KERN + nkpde, FALSE) == NULL) {
panic("pmap_growkernel: alloc ptp failed");
}
diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c
index 0390dc4d539..43f4f758abd 100644
--- a/sys/arch/vax/vax/pmap.c
+++ b/sys/arch/vax/vax/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.12 2000/10/11 11:40:17 bjc Exp $ */
+/* $OpenBSD: pmap.c,v 1.13 2001/04/10 06:59:13 niklas Exp $ */
/* $NetBSD: pmap.c,v 1.74 1999/11/13 21:32:25 matt Exp $ */
/*
* Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden.
@@ -297,14 +297,15 @@ pmap_steal_memory(size, vstartp, vendp)
size = round_page(size);
npgs = btoc(size);
- /*
- * A vax only have one segment of memory.
- */
#ifdef DIAGNOSTIC
- if (vm_physmem[0].pgs)
+ if (uvm.page_init_done == TRUE)
panic("pmap_steal_memory: called _after_ bootstrap");
#endif
+ /*
+ * A vax only have one segment of memory.
+ */
+
v = (vm_physmem[0].avail_start << PGSHIFT) | KERNBASE;
vm_physmem[0].avail_start += npgs;
vm_physmem[0].start += npgs;
diff --git a/sys/uvm/uvm.h b/sys/uvm/uvm.h
index 9668bf485dd..40b9f292229 100644
--- a/sys/uvm/uvm.h
+++ b/sys/uvm/uvm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm.h,v 1.8 2001/03/22 03:05:54 smart Exp $ */
+/* $OpenBSD: uvm.h,v 1.9 2001/04/10 06:59:12 niklas Exp $ */
/* $NetBSD: uvm.h,v 1.16 1999/06/21 17:25:11 thorpej Exp $ */
/*
@@ -81,6 +81,7 @@ struct uvm {
struct pglist page_inactive_obj;/* pages inactive (reclaim or free) */
simple_lock_data_t pageqlock; /* lock for active/inactive page q */
simple_lock_data_t fpageqlock; /* lock for free page q */
+ boolean_t page_init_done; /* TRUE if uvm_page_init() finished */
/* page daemon trigger */
int pagedaemon; /* daemon sleeps on this */
struct proc *pagedaemon_proc; /* daemon's pid */
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c
index 30f09d49071..14fadaac3b9 100644
--- a/sys/uvm/uvm_page.c
+++ b/sys/uvm/uvm_page.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_page.c,v 1.15 2001/03/22 18:05:33 niklas Exp $ */
+/* $OpenBSD: uvm_page.c,v 1.16 2001/04/10 06:59:12 niklas Exp $ */
/* $NetBSD: uvm_page.c,v 1.24 1999/07/22 22:58:38 thorpej Exp $ */
/*
@@ -338,6 +338,7 @@ uvm_page_init(kvm_startp, kvm_endp)
* done!
*/
+ uvm.page_init_done = TRUE;
}
/*
@@ -481,7 +482,7 @@ uvm_page_physget(paddrp)
#endif
{
- if (vm_physmem[lcv].pgs)
+ if (uvm.page_init_done == TRUE)
panic("vm_page_physget: called _after_ bootstrap");
/* try from front */