Fix msgbuf so that it actually works properly.

This commit is contained in:
Doug Rabson 1998-07-29 18:36:29 +00:00
parent ba23f3976a
commit ab1fdd6291
2 changed files with 3 additions and 22 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: machdep.c,v 1.7 1998/07/15 20:16:26 dfr Exp $ * $Id: machdep.c,v 1.8 1998/07/22 08:20:57 dfr Exp $
*/ */
/*- /*-
* Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -185,7 +185,6 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL)
static MALLOC_DEFINE(M_MBUF, "mbuf", "mbuf"); static MALLOC_DEFINE(M_MBUF, "mbuf", "mbuf");
struct msgbuf *msgbufp=0; struct msgbuf *msgbufp=0;
int msgbufmapped = 0; /* set when safe to use msgbuf */
int bootverbose = 0, Maxmem = 0; int bootverbose = 0, Maxmem = 0;
long dumplo; long dumplo;
@ -864,17 +863,7 @@ alpha_init(pfn, ptb, bim, bip, biv)
phys_avail[i+1] -= sz; phys_avail[i+1] -= sz;
msgbufp = (struct msgbuf*) ALPHA_PHYS_TO_K0SEG(phys_avail[i+1]); msgbufp = (struct msgbuf*) ALPHA_PHYS_TO_K0SEG(phys_avail[i+1]);
cp = (char *)msgbufp; msgbufinit(msgbufp, MSGBUF_SIZE);
msgbufp = (struct msgbuf *) (cp + sz - sizeof(*msgbufp));
if (msgbufp->msg_magic != MSG_MAGIC || msgbufp->msg_ptr != cp) {
bzero(cp, sz);
msgbufp->msg_magic = MSG_MAGIC;
msgbufp->msg_size = (char *)msgbufp - cp;
msgbufp->msg_ptr = cp;
}
msgbufmapped = 1;
/* initmsgbuf(msgbufaddr, sz); */
/* Remove the last segment if it now has no pages. */ /* Remove the last segment if it now has no pages. */
if (phys_avail[i] == phys_avail[i+1]) if (phys_avail[i] == phys_avail[i+1])

View File

@ -38,7 +38,7 @@
* *
* from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91 * from: @(#)mem.c 7.2 (Berkeley) 5/9/91
* $Id: mem.c,v 1.50 1998/03/12 09:14:18 bde Exp $ * $Id: mem.c,v 1.1 1998/06/10 10:52:54 dfr Exp $
*/ */
/* /*
@ -199,14 +199,6 @@ mmrw(dev, uio, flags)
case 0: case 0:
v = uio->uio_offset; v = uio->uio_offset;
kmemphys: kmemphys:
if (v >= ALPHA_K0SEG_TO_PHYS((vm_offset_t)msgbufp)) {
if (msgbufmapped == 0) {
printf("Message Buf not Mapped\n");
error = EFAULT;
break;
}
}
/* Allow reads only in RAM. */ /* Allow reads only in RAM. */
rw = (uio->uio_rw == UIO_READ) ? VM_PROT_READ : VM_PROT_WRITE; rw = (uio->uio_rw == UIO_READ) ? VM_PROT_READ : VM_PROT_WRITE;
if ((alpha_pa_access(v) & rw) != rw) { if ((alpha_pa_access(v) & rw) != rw) {