summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-12-30 21:22:21 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-12-30 21:22:21 +0000
commit829235c5016fbb5316a407f461e24f03a6fde9b1 (patch)
tree4e2d170d574ada7ca026af498b860689f0c9b379 /sys/arch
parent323ac538cdf84f87731b7749d1931685b68168a0 (diff)
Rework pmap_bootstrap() computations of I/O maps. Makes the MD part of
this much simpler. Also, make sure an userland process can fill its UPT as expected. No functional change.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/hp300/hp300/pmap_bootstrap.c18
-rw-r--r--sys/arch/m68k/m68k/pmap_bootstrap.c23
-rw-r--r--sys/arch/mac68k/mac68k/pmap_bootstrap.c10
-rw-r--r--sys/arch/mvme68k/mvme68k/pmap_bootstrap.c12
4 files changed, 34 insertions, 29 deletions
diff --git a/sys/arch/hp300/hp300/pmap_bootstrap.c b/sys/arch/hp300/hp300/pmap_bootstrap.c
index ab83685c7f2..87d35864eb4 100644
--- a/sys/arch/hp300/hp300/pmap_bootstrap.c
+++ b/sys/arch/hp300/hp300/pmap_bootstrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.18 2003/06/02 23:27:45 millert Exp $ */
+/* $OpenBSD: pmap_bootstrap.c,v 1.19 2004/12/30 21:22:19 miod Exp $ */
/* $NetBSD: pmap_bootstrap.c,v 1.13 1997/06/10 18:56:50 veego Exp $ */
/*
@@ -79,17 +79,11 @@ extern int maxmem;
*/
#define PMAP_MD_RELOC2() \
do { \
- RELOC(intiobase, char *) = \
- (char *)m68k_ptob(nptpages * NPTEPG - \
- (MACHINE_IIOMAPSIZE + MACHINE_EIOMAPSIZE)); \
- RELOC(intiolimit, char *) = \
- (char *)m68k_ptob(nptpages * NPTEPG - MACHINE_EIOMAPSIZE); \
- RELOC(extiobase, char *) = \
- (char *)m68k_ptob(nptpages * NPTEPG - MACHINE_EIOMAPSIZE); \
- RELOC(CLKbase, vaddr_t) = \
- (vaddr_t)RELOC(intiobase, char *) + CLKBASE; \
- RELOC(MMUbase, vaddr_t) = \
- (vaddr_t)RELOC(intiobase, char *) + MMUBASE; \
+ RELOC(intiobase, char *) = (char *)iiobase; \
+ RELOC(intiolimit, char *) = (char *)eiobase; \
+ RELOC(extiobase, char *) = (char *)eiobase; \
+ RELOC(CLKbase, vaddr_t) = iiobase + CLKBASE; \
+ RELOC(MMUbase, vaddr_t) = iiobase + MMUBASE; \
} while (0)
#define PMAP_MD_MEMSIZE() \
diff --git a/sys/arch/m68k/m68k/pmap_bootstrap.c b/sys/arch/m68k/m68k/pmap_bootstrap.c
index 5b5ce76369e..4cbdb383777 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.8 2004/11/27 14:26:30 miod Exp $ */
+/* $OpenBSD: pmap_bootstrap.c,v 1.9 2004/12/30 21:22:20 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -121,6 +121,7 @@ pmap_bootstrap(nextpa, firstpa)
paddr_t firstpa;
{
paddr_t kstpa, kptpa, iiopa, eiopa, kptmpa, lkptpa, p0upa;
+ vaddr_t iiobase, eiobase;
u_int nptpages, kstsize;
st_entry_t protoste, *ste;
pt_entry_t protopte, *pte, *epte;
@@ -162,11 +163,27 @@ pmap_bootstrap(nextpa, firstpa)
kstpa = nextpa;
nextpa += kstsize * NBPG;
kptpa = nextpa;
+
nptpages = RELOC(Sysptsize, int) +
(MACHINE_IIOMAPSIZE + MACHINE_EIOMAPSIZE + NPTEPG - 1) / NPTEPG;
+
+ iiopa = nextpa + RELOC(Sysptsize, int) * NBPG;
+ iiobase = m68k_ptob(RELOC(Sysptsize, int) * NPTEPG);
+ eiopa = iiopa + MACHINE_IIOMAPSIZE * sizeof(pt_entry_t);
+ eiobase = iiobase + m68k_ptob(MACHINE_IIOMAPSIZE);
+
+ /*
+ * We need to be able to map a whole UPT here as well. Adjust
+ * nptpages if necessary.
+ */
+ num = RELOC(Sysptsize, int) +
+ (m68k_btop(MACHINE_MAX_PTSIZE) * sizeof(pt_entry_t) + NPTEPG - 1) /
+ NPTEPG;
+ if (nptpages < num)
+ nptpages = num;
+
nextpa += nptpages * NBPG;
- eiopa = nextpa - MACHINE_EIOMAPSIZE * sizeof(pt_entry_t);
- iiopa = eiopa - MACHINE_IIOMAPSIZE * sizeof(pt_entry_t);
+
kptmpa = nextpa;
nextpa += NBPG;
lkptpa = nextpa;
diff --git a/sys/arch/mac68k/mac68k/pmap_bootstrap.c b/sys/arch/mac68k/mac68k/pmap_bootstrap.c
index a5956f25e1b..d61fddf418d 100644
--- a/sys/arch/mac68k/mac68k/pmap_bootstrap.c
+++ b/sys/arch/mac68k/mac68k/pmap_bootstrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.27 2004/11/27 14:26:32 miod Exp $ */
+/* $OpenBSD: pmap_bootstrap.c,v 1.28 2004/12/30 21:22:20 miod Exp $ */
/* $NetBSD: pmap_bootstrap.c,v 1.50 1999/04/07 06:14:33 scottr Exp $ */
/*
@@ -163,12 +163,10 @@ do { \
#define PMAP_MD_RELOC2() \
do { \
- IOBase = (u_long)m68k_ptob(nptpages * NPTEPG - MACHINE_IIOMAPSIZE); \
- ROMBase = (char *)m68k_ptob(nptpages * NPTEPG - \
- (ROMMAPSIZE + VIDMAPSIZE)); \
+ IOBase = iiobase; \
+ ROMBase = (char *)(iiobase + m68k_ptob(IIOMAPSIZE)); \
if (vidlen != 0) { \
- newvideoaddr = (u_int32_t) \
- m68k_ptob(nptpages * NPTEPG - VIDMAPSIZE) \
+ newvideoaddr = iiobase + m68k_ptob(IIOMAPSIZE + ROMMAPSIZE) \
+ (mac68k_vidphys & PGOFSET); \
if (mac68k_vidlog) \
mac68k_vidlog = newvideoaddr; \
diff --git a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
index ccbe1e122b8..346e3d33e88 100644
--- a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
+++ b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.18 2003/06/02 23:27:51 millert Exp $ */
+/* $OpenBSD: pmap_bootstrap.c,v 1.19 2004/12/30 21:22:20 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -113,13 +113,9 @@ do { \
*/
#define PMAP_MD_RELOC2() \
do { \
- RELOC(intiobase, char *) = \
- (char *)m68k_ptob(nptpages * NPTEPG - \
- (MACHINE_IIOMAPSIZE + MACHINE_EIOMAPSIZE)); \
- RELOC(intiolimit, char *) = \
- (char *)m68k_ptob(nptpages * NPTEPG - MACHINE_EIOMAPSIZE); \
- RELOC(extiobase, char *) = \
- (char *)m68k_ptob(nptpages * NPTEPG - MACHINE_EIOMAPSIZE); \
+ RELOC(intiobase, char *) = (char *)iiobase; \
+ RELOC(intiolimit, char *) = (char *)eiobase; \
+ RELOC(extiobase, char *) = (char *)eiobase; \
} while (0)
#define PMAP_MD_MEMSIZE() \