summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2002-03-08 02:52:37 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2002-03-08 02:52:37 +0000
commitbfd6cab07ebbe219670eb8f3c2903f2290a508c2 (patch)
tree12f572b85ea7bba9219244b7aa745fb699665db5
parent60e1b4b28b90133dc3101a210246060100ce71c2 (diff)
Move the message buffer out of low memory, Openfirmware clears the area
on reboot. perhaps OF uses it at other times? Since OF always use the same memory addresses, this should always allocate the same ram to the msgbuf, and allow it to be preserved across reboot.
-rw-r--r--sys/arch/macppc/macppc/machdep.c14
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c20
2 files changed, 26 insertions, 8 deletions
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index fa2713fc10a..dda742c86d3 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.26 2002/02/23 16:59:36 matthieu Exp $ */
+/* $OpenBSD: machdep.c,v 1.27 2002/03/08 02:52:36 drahn Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -210,17 +210,12 @@ initppc(startkernel, endkernel, args)
#endif
extern void consinit __P((void));
extern void callback __P((void *));
+ extern void *msgbuf_addr;
int exc, scratch;
proc0.p_addr = proc0paddr;
bzero(proc0.p_addr, sizeof *proc0.p_addr);
- /*
- * XXX We use the page just above the interrupt vector as
- * message buffer
- */
- initmsgbuf((void *)0x3000, MSGBUFSIZE);
-
where = 3;
curpcb = &proc0paddr->u_pcb;
@@ -384,6 +379,11 @@ where = 3;
: "=r"(scratch) : "K"(PSL_IR|PSL_DR|PSL_ME|PSL_RI));
/*
+ * use the memory provided by pmap_bootstrap for message buffer
+ */
+ initmsgbuf(msgbuf_addr, MSGBUFSIZE);
+
+ /*
* Look at arguments passed to us and compute boothowto.
* Default to SINGLE and ASKNAME if no args or
* SINGLE and DFLTROOT if this is a ramdisk kernel.
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index a530c155d43..926d3a831c4 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.58 2002/01/25 04:04:55 drahn Exp $ */
+/* $OpenBSD: pmap.c,v 1.59 2002/03/08 02:52:36 drahn Exp $ */
/* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */
/*
@@ -458,6 +458,8 @@ pte_spill(addr)
return 0;
}
+void *msgbuf_addr; /* memory for msgbuf, physical, mapped with BATs */
+
int avail_start;
int avail_end;
/*
@@ -566,6 +568,22 @@ pmap_bootstrap(kernelstart, kernelend)
mp1->size = sz;
}
}
+ /*
+ * grab first available memory for msgbuf
+ */
+ for (mp = avail; mp->size; mp++) {
+ if (mp->size >= MSGBUFSIZE) {
+ mp->size -= MSGBUFSIZE;
+ msgbuf_addr = (void *)mp->start;
+ mp->start += MSGBUFSIZE;
+ if (mp->size == 0) {
+ bcopy(mp + 1, mp,
+ (cnt - (mp - avail)) * sizeof *mp);
+ cnt--;
+ }
+ break;
+ }
+ }
#if 0
avail_start = 0;
avail_end = npgs * NBPG;