Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/x68k X68k's physical RAM is not at lowram-0xff...



details:   https://anonhg.NetBSD.org/src/rev/382aafbd1a78
branches:  trunk
changeset: 502084:382aafbd1a78
user:      minoura <minoura%NetBSD.org@localhost>
date:      Thu Jan 11 14:00:11 2001 +0000

description:
X68k's physical RAM is not at lowram-0xffffffff, but has multiple segments.

diffstat:

 sys/arch/x68k/x68k/mem.c |  23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diffs (58 lines):

diff -r 2aea49616b2d -r 382aafbd1a78 sys/arch/x68k/x68k/mem.c
--- a/sys/arch/x68k/x68k/mem.c  Thu Jan 11 13:18:36 2001 +0000
+++ b/sys/arch/x68k/x68k/mem.c  Thu Jan 11 14:00:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.20 2000/06/29 07:07:56 mrg Exp $     */
+/*     $NetBSD: mem.c,v 1.21 2001/01/11 14:00:11 minoura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -56,7 +56,6 @@
 
 #include <uvm/uvm_extern.h>
 
-extern u_int lowram;
 static caddr_t devzeropage;
 
 #define mmread  mmrw
@@ -85,6 +84,8 @@
        return (0);
 }
 
+static int isinram(vaddr_t);
+
 /*ARGSUSED*/
 int
 mmrw(dev, uio, flags)
@@ -126,7 +127,7 @@
                        v = uio->uio_offset;
 #ifndef DEBUG
                        /* allow reads only in RAM (except for DEBUG) */
-                       if (v >= 0xFFFFFFFC || v < lowram) {
+                       if (!isinram(v)) {
                                error = EFAULT;
                                goto unlock;
                        }
@@ -222,7 +223,21 @@
         * XXX could be extended to allow access to IO space but must
         * be very careful.
         */
-       if ((u_int)off < lowram || (u_int)off >= 0xFFFFFFFC)
+       if (!isinram ((vaddr_t) off))
                return (-1);
        return (m68k_btop((u_int)off));
 }
+
+static int
+isinram(addr)
+       vaddr_t addr;
+{
+       int i;
+
+       for (i = 0; i < vm_nphysseg; i++) {
+               if (ctob(vm_physmem[i].start) <= addr &&
+                   addr < ctob(vm_physmem[i].end))
+                       return 1;
+       }
+       return 0;
+}



Home | Main Index | Thread Index | Old Index