Module Name: src
Committed By: skrll
Date: Thu Jun 3 22:34:26 UTC 2010
Modified Files:
src/sys/arch/hp700/dev: mem.c
Log Message:
Add a comment and check off in mmmmap.
To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/hp700/dev/mem.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/hp700/dev/mem.c
diff -u src/sys/arch/hp700/dev/mem.c:1.24 src/sys/arch/hp700/dev/mem.c:1.25
--- src/sys/arch/hp700/dev/mem.c:1.24 Wed Apr 28 06:06:11 2010
+++ src/sys/arch/hp700/dev/mem.c Thu Jun 3 22:34:26 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mem.c,v 1.24 2010/04/28 06:06:11 skrll Exp $ */
+/* $NetBSD: mem.c,v 1.25 2010/06/03 22:34:26 skrll Exp $ */
/* $OpenBSD: mem.c,v 1.30 2007/09/22 16:21:32 krw Exp $ */
/*
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.24 2010/04/28 06:06:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.25 2010/06/03 22:34:26 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -400,16 +400,23 @@
mmmmap(dev_t dev, off_t off, int prot)
{
+ /*
+ * /dev/mem is the only one that makes sense through this
+ * interface. For /dev/kmem any physaddr we return here
+ * could be transient and hence incorrect or invalid at
+ * a later time. /dev/null just doesn't make any sense
+ * and /dev/zero is a hack that is handled via the default
+ * pager in mmap().
+ */
+
if (minor(dev) != DEV_MEM)
return -1;
/*
* Allow access only in RAM.
*/
-#if 0
- if (off < ptoa(firstusablepage) ||
- off >= ptoa(lastusablepage + 1))
+ if (off > ptoa(physmem))
return -1;
-#endif
+
return btop(off);
}