summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-07-14 06:05:53 +0000
committerdyson <dyson@FreeBSD.org>1996-07-14 06:05:53 +0000
commitf8e0a40f1c864d1f5f3680164336b038f79272c8 (patch)
tree89c83bf18ca0b97d26cb680c6a448f748e2a57b9 /sys/amd64
parent0a66b4f53af262b5e10fac0f9ba77c6f7bb1ff12 (diff)
downloadFreeBSD-src-f8e0a40f1c864d1f5f3680164336b038f79272c8.zip
FreeBSD-src-f8e0a40f1c864d1f5f3680164336b038f79272c8.tar.gz
Almost gratuitious improvement of the performance of reading
/dev/zero.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/mem.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index 09ab5bf..147a13d 100644
--- a/sys/amd64/amd64/mem.c
+++ b/sys/amd64/amd64/mem.c
@@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
- * $Id: mem.c,v 1.33 1996/04/07 14:59:26 bde Exp $
+ * $Id: mem.c,v 1.34 1996/05/02 10:43:05 phk Exp $
*/
/*
@@ -99,6 +99,7 @@ static void *io_devfs_token;
static void *perfmon_devfs_token;
#endif
+
static void memdevfs_init __P((void));
static void
@@ -134,6 +135,7 @@ memdevfs_init()
#endif /* DEVFS */
extern char *ptvmmap; /* poor name! */
+caddr_t zbuf;
static int
mmclose(dev, flags, fmt, p)
@@ -153,6 +155,12 @@ mmclose(dev, flags, fmt, p)
fp = (struct trapframe *)curproc->p_md.md_regs;
fp->tf_eflags &= ~PSL_IOPL;
break;
+
+ case 12:
+ if (zbuf) {
+ free(zbuf, M_TEMP);
+ zbuf = NULL;
+ }
default:
break;
}
@@ -179,6 +187,7 @@ mmopen(dev, flags, fmt, p)
fp = (struct trapframe *)curproc->p_md.md_regs;
fp->tf_eflags |= PSL_IOPL;
break;
+
default:
break;
}
@@ -294,13 +303,13 @@ mmrw(dev, uio, flags)
c = iov->iov_len;
break;
}
- if (buf == NULL) {
- buf = (caddr_t)
+ if (zbuf == NULL) {
+ zbuf = (caddr_t)
malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
- bzero(buf, PAGE_SIZE);
+ bzero(zbuf, PAGE_SIZE);
}
c = min(iov->iov_len, PAGE_SIZE);
- error = uiomove(buf, (int)c, uio);
+ error = uiomove(zbuf, (int)c, uio);
continue;
#ifdef notyet
OpenPOWER on IntegriCloud