Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 Update mem device to bring it into line w...



details:   https://anonhg.NetBSD.org/src/rev/3fdd35984acf
branches:  trunk
changeset: 520215:3fdd35984acf
user:      chris <chris%NetBSD.org@localhost>
date:      Sat Jan 05 00:46:33 2002 +0000

description:
Update mem device to bring it into line with a change in version 1.32 of i386/mem.c.  Appears that we may move uio twice.
Original i386 log message:
Optimize the case of writing to /dev/zero, and clean up the
surrounding code a bit.  Partly suggested by gwr.

I think this needs to be applied to arm26 as well.

diffstat:

 sys/arch/arm/arm32/mem.c |  24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diffs (72 lines):

diff -r 5d048294d60f -r 3fdd35984acf sys/arch/arm/arm32/mem.c
--- a/sys/arch/arm/arm32/mem.c  Sat Jan 05 00:40:38 2002 +0000
+++ b/sys/arch/arm/arm32/mem.c  Sat Jan 05 00:46:33 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.2 2001/09/10 21:19:35 chris Exp $    */
+/*     $NetBSD: mem.c,v 1.3 2002/01/05 00:46:33 chris Exp $    */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -117,7 +117,7 @@
                }
                switch (minor(dev)) {
 
-               /* minor device 0 is physical memory */
+/* minor device 0 is physical memory */
                case 0:
                        v = uio->uio_offset;
                        prot = uio->uio_rw == UIO_READ ? VM_PROT_READ :
@@ -131,9 +131,9 @@
                        pmap_remove(pmap_kernel(), (vaddr_t)memhook,
                            (vaddr_t)memhook + NBPG);
                        pmap_update(pmap_kernel());
-                       continue;
+                       break;
 
-               /* minor device 1 is kernel memory */
+/* minor device 1 is kernel memory */
                case 1:
                        v = uio->uio_offset;
                        c = min(iov->iov_len, MAXPHYS);
@@ -141,9 +141,9 @@
                            uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
                                return (EFAULT);
                        error = uiomove((caddr_t)v, c, uio);
-                       continue;
+                       break;
 
-               /* minor device 2 is EOF/RATHOLE */
+/* minor device 2 is EOF/rathole */
                case 2:
                        if (uio->uio_rw == UIO_WRITE)
                                uio->uio_resid = 0;
@@ -152,8 +152,8 @@
                /* minor device 3 (/dev/zero) is source of nulls on read, rathole on write */
                case 3:
                        if (uio->uio_rw == UIO_WRITE) {
-                               c = iov->iov_len;
-                               break;
+                               uio->uio_resid = 0;
+                               return (0);
                        }
                        if (zeropage == NULL) {
                                zeropage = (caddr_t)
@@ -162,17 +162,11 @@
                        }
                        c = min(iov->iov_len, NBPG);
                        error = uiomove(zeropage, c, uio);
-                       continue;
+                       break;
 
                default:
                        return (ENXIO);
                }
-               if (error)
-                       break;
-               iov->iov_base = (caddr_t)iov->iov_base + c;
-               iov->iov_len -= c;
-               uio->uio_offset += c;
-               uio->uio_resid -= c;
        }
        if (minor(dev) == 0) {
 /*unlock:*/



Home | Main Index | Thread Index | Old Index