linux-mips
[Top] [All Lists]

Re: Should /dev/kmem support above 0x80000000 area?

To: Ralf Baechle <ralf@oss.sgi.com>
Subject: Re: Should /dev/kmem support above 0x80000000 area?
From: Jun Sun <jsun@mvista.com>
Date: Mon, 11 Dec 2000 23:38:36 -0800
Cc: linux-mips@oss.sgi.com
References: <3A3051C1.DCFC749B@mvista.com> <20001209003222.A10669@bacchus.dhis.org>
Sender: owner-linux-mips@oss.sgi.com
Ralf Baechle wrote:
> 
> Send me the patch and I'll comment.
> 
>   Ralf

Here is my patch.  I think it should be safe for mips64.  Please double check
it.

Jun
diff -Nru linux/drivers/char/mem.c.orig linux/drivers/char/mem.c
--- linux/drivers/char/mem.c.orig       Mon Dec 11 22:07:19 2000
+++ linux/drivers/char/mem.c    Mon Dec 11 22:38:11 2000
@@ -258,6 +258,14 @@
                count -= read;
        }
 
+#if defined(__mips__)
+        if (KSEGX(p)) {
+               if (copy_to_user(buf, (char*)p, count))
+                       return -EFAULT;
+               return count+read;
+       }
+#endif
+
        kbuf = (char *)__get_free_page(GFP_KERNEL);
        if (!kbuf)
                return -ENOMEM;
@@ -288,6 +296,12 @@
                          size_t count, loff_t *ppos)
 {
        unsigned long p = *ppos;
+
+#if defined(__mips__)
+        if (KSEGX(p)) {
+               return do_write_mem(file, (void*)p, p, buf, count, ppos);
+       }
+#endif
 
        if (p >= (unsigned long) high_memory)
                return 0;
<Prev in Thread] Current Thread [Next in Thread>