Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sh3/sh3 Fix reading values mapped in P1 via /dev/km...



details:   https://anonhg.NetBSD.org/src/rev/3d09d78d5606
branches:  trunk
changeset: 526620:3d09d78d5606
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 07 03:28:25 2002 +0000

description:
Fix reading values mapped in P1 via /dev/kmem (problem uncovered by
uch's new pmap).

diffstat:

 sys/arch/sh3/sh3/mem.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r d21dc7b5045a -r 3d09d78d5606 sys/arch/sh3/sh3/mem.c
--- a/sys/arch/sh3/sh3/mem.c    Tue May 07 02:59:38 2002 +0000
+++ b/sys/arch/sh3/sh3/mem.c    Tue May 07 03:28:25 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.9 2002/02/27 01:20:55 christos Exp $ */
+/*     $NetBSD: mem.c,v 1.10 2002/05/07 03:28:25 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -59,7 +59,7 @@
 
 #include <uvm/uvm_extern.h>
 
-extern char *vmmap;            /* poor name! */
+char *kvm_start = (char *)VM_MIN_KERNEL_ADDRESS;
 extern paddr_t avail_end;
 caddr_t zeropage;
 
@@ -96,7 +96,7 @@
        vm_prot_t prot;
 
        if (minor(dev) == DEV_MEM) {
-               /* lock against other uses of shared vmmap */
+               /* lock against other uses of shared kvm_start */
                while (physlock > 0) {
                        physlock++;
                        error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
@@ -121,14 +121,14 @@
                        v = uio->uio_offset;
                        prot = uio->uio_rw == UIO_READ ? VM_PROT_READ :
                            VM_PROT_WRITE;
-                       pmap_enter(pmap_kernel(), (vaddr_t)vmmap,
+                       pmap_enter(pmap_kernel(), (vaddr_t)kvm_start,
                            trunc_page(v), prot, prot|PMAP_WIRED);
                        pmap_update(pmap_kernel());
                        o = uio->uio_offset & PGOFSET;
                        c = min(uio->uio_resid, (int)(NBPG - o));
-                       error = uiomove((caddr_t)vmmap + o, c, uio);
-                       pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
-                           (vaddr_t)vmmap + NBPG);
+                       error = uiomove((caddr_t)kvm_start + o, c, uio);
+                       pmap_remove(pmap_kernel(), (vaddr_t)kvm_start,
+                           (vaddr_t)kvm_start + NBPG);
                        pmap_update(pmap_kernel());
                        break;
 
@@ -137,7 +137,8 @@
                        c = min(iov->iov_len, MAXPHYS);
                        if (v < SH3_P1SEG_BASE)
                                return (EFAULT);
-                       if (v + c > avail_end + sh3_round_page(MSGBUFSIZE) &&
+                       if (v + c > SH3_PHYS_TO_P1SEG(avail_end +
+                                       sh3_round_page(MSGBUFSIZE)) &&
                            (v < SH3_P3SEG_BASE || !uvm_kernacc((void *)v, c,
                            uio->uio_rw == UIO_READ ? B_READ : B_WRITE)))
                                return (EFAULT);



Home | Main Index | Thread Index | Old Index