summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-05-13 07:43:00 +0000
committerpeter <peter@FreeBSD.org>2000-05-13 07:43:00 +0000
commit9b48bc5807e2bce1f477e15f695d011b8638ca98 (patch)
treef864e7b7ecbb287882c32ede94b358a6451ed31d /sys/alpha
parent9dc57b5678767f6d541532cfd977bb7bf5ffb67d (diff)
downloadFreeBSD-src-9b48bc5807e2bce1f477e15f695d011b8638ca98.zip
FreeBSD-src-9b48bc5807e2bce1f477e15f695d011b8638ca98.tar.gz
Make /dev/[k]mem work after last commit. Transfers were being double
counted due to break/continue changes that were missed. There are still too many diffs relative to the i386 version.
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/mem.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c
index e52aa6d..4f98c8e 100644
--- a/sys/alpha/alpha/mem.c
+++ b/sys/alpha/alpha/mem.c
@@ -67,7 +67,7 @@
#include <vm/pmap.h>
#include <vm/vm_extern.h>
-static caddr_t zeropage;
+static caddr_t zbuf;
static d_open_t mmopen;
static d_close_t mmclose;
@@ -187,6 +187,7 @@ kmemphys:
rw = (uio->uio_rw == UIO_READ) ? VM_PROT_READ : VM_PROT_WRITE;
if ((alpha_pa_access(v) & rw) != rw) {
error = EFAULT;
+ c = 0;
break;
}
@@ -194,7 +195,7 @@ kmemphys:
c = min(uio->uio_resid, (int)(PAGE_SIZE - o));
error =
uiomove((caddr_t)ALPHA_PHYS_TO_K0SEG(v), c, uio);
- break;
+ continue;
/* minor device 1 is kernel memory */
case 1: {
@@ -221,20 +222,21 @@ kmemphys:
VM_PROT_READ : VM_PROT_WRITE))
return (EFAULT);
error = uiomove((caddr_t)v, c, uio);
- break;
+ continue;
}
/* minor device 2 is EOF/rathole */
case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
+ if (uio->uio_rw == UIO_READ)
+ return (0);
+ c = iov->iov_len;
+ break;
/* minor device 3 (/dev/random) is source of filth on read, rathole on write */
case 3:
if (uio->uio_rw == UIO_WRITE) {
- uio->uio_resid = 0;
- return (0);
+ c = iov->iov_len;
+ break;
}
if (buf == NULL)
buf = (caddr_t)
@@ -278,21 +280,21 @@ kmemphys:
/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
case 12:
if (uio->uio_rw == UIO_WRITE) {
- uio->uio_resid = 0;
- return (0);
+ c = iov->iov_len;
+ break;
}
/*
* On the first call, allocate and zero a page
* of memory for use with /dev/zero.
*/
- if (zeropage == NULL) {
- zeropage = (caddr_t)
+ if (zbuf == NULL) {
+ zbuf = (caddr_t)
malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
- bzero(zeropage, PAGE_SIZE);
+ bzero(zbuf, PAGE_SIZE);
}
c = min(iov->iov_len, PAGE_SIZE);
- error = uiomove(zeropage, c, uio);
- break;
+ error = uiomove(zbuf, c, uio);
+ continue;
default:
return (ENXIO);
OpenPOWER on IntegriCloud