summaryrefslogtreecommitdiff
path: root/sys/arch/pmax
diff options
context:
space:
mode:
authorMats O Jansson <maja@cvs.openbsd.org>2000-07-04 05:46:24 +0000
committerMats O Jansson <maja@cvs.openbsd.org>2000-07-04 05:46:24 +0000
commit5a4e671ef90a80c5b5eec49bcc591d50ab35aae0 (patch)
tree45ecf56d99cb146d159da392959520e1c6ede607 /sys/arch/pmax
parent0575a7a791b47fb147e326dcd7d1c1e02f367b6c (diff)
Make dmesg and /kern/msgbuf work on pmax. Thanks art@ for help with mem.c. ok miod@. -moj
Diffstat (limited to 'sys/arch/pmax')
-rw-r--r--sys/arch/pmax/include/param.h3
-rw-r--r--sys/arch/pmax/pmax/machdep.c14
-rw-r--r--sys/arch/pmax/pmax/mem.c6
3 files changed, 17 insertions, 6 deletions
diff --git a/sys/arch/pmax/include/param.h b/sys/arch/pmax/include/param.h
index db56a782c17..45ffdda7c3c 100644
--- a/sys/arch/pmax/include/param.h
+++ b/sys/arch/pmax/include/param.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: param.h,v 1.9 2000/07/04 05:46:23 maja Exp $ */
/* $NetBSD: param.h,v 1.18 1997/02/26 01:45:41 jonathan Exp $ */
/*
@@ -105,6 +106,8 @@
#endif
#endif
+#define MSGBUFSIZE NBPG
+
#ifdef _KERNEL
#ifndef _LOCORE
extern int cpuspeed;
diff --git a/sys/arch/pmax/pmax/machdep.c b/sys/arch/pmax/pmax/machdep.c
index 2ae10f121da..a91be2883d4 100644
--- a/sys/arch/pmax/pmax/machdep.c
+++ b/sys/arch/pmax/pmax/machdep.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: machdep.c,v 1.24 2000/07/04 05:46:23 maja Exp $ */
/* $NetBSD: machdep.c,v 1.67 1996/10/23 20:04:40 mhitch Exp $ */
/*
@@ -147,7 +148,6 @@ int bufpages = BUFPAGES;
#else
int bufpages = 0;
#endif
-int msgbufmapped = 0; /* set when safe to use msgbuf */
int maxmem; /* max memory per process */
int physmem; /* max supported memory, changes to actual */
int physmem_boardmax; /* {model,simm}-specific bound on physmem */
@@ -678,10 +678,10 @@ mach_init(argc, argv, code, cv)
/*
* Initialize error message buffer (at end of core).
*/
- maxmem -= btoc(sizeof (struct msgbuf));
+ maxmem -= btoc(MSGBUFSIZE);
msgbufp = (struct msgbuf *)(MIPS_PHYS_TO_KSEG0(maxmem << PGSHIFT));
- msgbufmapped = 1;
-
+ initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE));
+
/*
* Allocate space for system data structures.
* The first available kernel virtual address is in "v".
@@ -792,6 +792,11 @@ cpu_startup()
pmapdebug = 0;
#endif
+ for (i = 0; i < btoc(MSGBUFSIZE); i++)
+ pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp,
+ maxmem + i * NBPG, VM_PROT_READ|VM_PROT_WRITE, TRUE,
+ VM_PROT_READ|VM_PROT_WRITE);
+
/*
* Good {morning,afternoon,evening,night}.
*/
@@ -1195,6 +1200,7 @@ void
dumpsys()
{
int error;
+ extern int msgbufmapped;
/* Save registers. */
savectx((struct user *)&dumppcb, 0);
diff --git a/sys/arch/pmax/pmax/mem.c b/sys/arch/pmax/pmax/mem.c
index 187fa97bf22..d74e153a40d 100644
--- a/sys/arch/pmax/pmax/mem.c
+++ b/sys/arch/pmax/pmax/mem.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: mem.c,v 1.9 2000/07/04 05:46:23 maja Exp $ */
/* $NetBSD: mem.c,v 1.7 1995/09/29 21:53:29 jonathan Exp $ */
/*
@@ -129,8 +130,9 @@ mmrw(dev, uio, flags)
c = min(iov->iov_len, MAXPHYS);
if (v < MIPS_KSEG0_START)
return (EFAULT);
- if (v + c > MIPS_PHYS_TO_KSEG0(avail_end +
- sizeof (struct msgbuf)) &&
+ if (v + c > MIPS_PHYS_TO_KSEG0(avail_end) &&
+ !((caddr_t)v >= (caddr_t)msgbufp &&
+ (caddr_t)v < (caddr_t)msgbufp+MSGBUFSIZE) &&
(v < MIPS_KSEG2_START ||
!kernacc((caddr_t)v, c,
uio->uio_rw == UIO_READ ? B_READ : B_WRITE)))