summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-04-16 20:53:48 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-04-16 20:53:48 +0000
commit89f72a32b35cb411a824a4138962a5acc3f41635 (patch)
tree381ce5caf80bd0c43027ddd29b4598d53ea5821a /sys/arch
parent82f77f75e5d33240673e827fa62fbef154e988c1 (diff)
- allow users of pmap_bootstrap to not have virtual address 0 read only,
mac68k needs this for now - update comments to reflect that code, if invoked carefully, can work with the MMU enabled.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/m68k/m68k/pmap_bootstrap.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/arch/m68k/m68k/pmap_bootstrap.c b/sys/arch/m68k/m68k/pmap_bootstrap.c
index cb75047dc71..7df0c438940 100644
--- a/sys/arch/m68k/m68k/pmap_bootstrap.c
+++ b/sys/arch/m68k/m68k/pmap_bootstrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.3 2002/03/14 01:26:35 millert Exp $ */
+/* $OpenBSD: pmap_bootstrap.c,v 1.4 2002/04/16 20:53:47 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -84,6 +84,7 @@
* PMAP_MD_RELOC3() general purpose kernel virtual addresses relocation
* PMAP_MD_MAPIOSPACE() setup machine-specific internal iospace components
* PMAP_MD_MEMSIZE() compute avail_end
+ * PMAP_MD_RWZERO define to NOT make virtual address 0 read only
*/
extern char *etext;
@@ -102,7 +103,6 @@ extern int pmap_aliasmask;
void pmap_bootstrap(paddr_t, paddr_t);
-
/*
* Special purpose kernel virtual addresses, used for mapping
* physical pages for a variety of temporary or permanent purposes:
@@ -115,10 +115,12 @@ caddr_t CADDR1, CADDR2, vmmap;
/*
* Bootstrap the VM system.
*
- * Called with MMU off so we must relocate all global references by `firstpa'
- * (don't call any functions here!) `nextpa' is the first available physical
- * memory address. Returns an updated first PA reflecting the memory we
- * have allocated. MMU is still off when we return.
+ * Ideally called with MMU off, but not necessarily. All global references
+ * are relocated by `firstpa' to ensure this works. Of course, it is not
+ * possible to call any other functions from there. `nextpa' is the first
+ * available physical memory address. Returns an updated first PA reflecting
+ * the memory we have allocated. MMU is still in the same state when we
+ * return.
*
* XXX assumes sizeof(u_int) == sizeof(pt_entry_t)
* XXX a PIC compiler would make this much easier.
@@ -338,6 +340,8 @@ pmap_bootstrap(nextpa, firstpa)
* memory
*/
*pte = MAXADDR | PG_RW | PG_CI | PG_V | PG_U;
+#else
+ *pte = PG_NV;
#endif
/*
* Initialize kernel page table.
@@ -355,12 +359,20 @@ pmap_bootstrap(nextpa, firstpa)
*/
pte = &(PA2VA(kptpa, u_int *))[m68k_btop(KERNBASE)];
epte = &pte[m68k_btop(trunc_page((vaddr_t)&etext))];
+#ifndef PMAP_MD_RWZERO
*pte++ = firstpa | PG_NV; /* make *NULL fail in the kernel */
#if defined(KGDB) || defined(DDB)
protopte = (firstpa + NBPG) | PG_RW | PG_V | PG_U; /* XXX RW for now */
#else
protopte = (firstpa + NBPG) | PG_RO | PG_V | PG_U;
#endif
+#else
+#if defined(KGDB) || defined(DDB)
+ protopte = firstpa | PG_RW | PG_V | PG_U; /* XXX RW for now */
+#else
+ protopte = firstpa | PG_RO | PG_V | PG_U;
+#endif
+#endif
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;