summaryrefslogtreecommitdiff
path: root/sys/arch/hp300
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-06-10 15:58:52 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-06-10 15:58:52 +0000
commitaa2962d62eef23ab73573fd0d52530d711528569 (patch)
tree54f540845992851a3b1c56e6d077c2b2652dc7db /sys/arch/hp300
parent11a2a08a5f77ee13343fb019b9d8f48d7454d101 (diff)
Allow /dev/kmem reads in the direct mapping region where there is
corresponding physical memory; makes procmap(8) happy on hp300.
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r--sys/arch/hp300/hp300/mem.c21
-rw-r--r--sys/arch/hp300/include/vmparam.h7
2 files changed, 22 insertions, 6 deletions
diff --git a/sys/arch/hp300/hp300/mem.c b/sys/arch/hp300/hp300/mem.c
index 2b0751deae8..999d3334469 100644
--- a/sys/arch/hp300/hp300/mem.c
+++ b/sys/arch/hp300/hp300/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.24 2007/09/08 09:28:49 martin Exp $ */
+/* $OpenBSD: mem.c,v 1.25 2009/06/10 15:58:49 miod Exp $ */
/* $NetBSD: mem.c,v 1.25 1999/03/27 00:30:06 mycroft Exp $ */
/*
@@ -157,9 +157,22 @@ mmrw(dev, uio, flags)
case 1:
v = uio->uio_offset;
c = min(iov->iov_len, MAXPHYS);
- if (!uvm_kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
+
+ if (v > HP300_DIRECT_BASE) {
+ /*
+ * Direct mapping: only allow access to
+ * physical memory.
+ */
+ if (v >= 0xfffffffc || v < lowram)
+ return (EFAULT);
+ } else {
+ /*
+ * Translated mapping: check for permission.
+ */
+ if (!uvm_kernacc((caddr_t)v, c,
+ uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
+ return (EFAULT);
+ }
/*
* Don't allow reading intio or dio
diff --git a/sys/arch/hp300/include/vmparam.h b/sys/arch/hp300/include/vmparam.h
index c583866ff7c..9b47a01fbe6 100644
--- a/sys/arch/hp300/include/vmparam.h
+++ b/sys/arch/hp300/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.17 2006/07/09 19:41:23 miod Exp $ */
+/* $OpenBSD: vmparam.h,v 1.18 2009/06/10 15:58:51 miod Exp $ */
/* $NetBSD: vmparam.h,v 1.16 1998/08/20 08:33:48 kleink Exp $ */
/*
@@ -46,10 +46,13 @@
* Machine dependent constants for HP300
*/
+/* address where direct translation starts */
+#define HP300_DIRECT_BASE 0xc0000000
+
#include <m68k/vmparam.h>
#undef VM_MAX_KERNEL_ADDRESS
-#define VM_MAX_KERNEL_ADDRESS (0xc0000000 - PAGE_SIZE)
+#define VM_MAX_KERNEL_ADDRESS (HP300_DIRECT_BASE - PAGE_SIZE)
/*
* Constants which control the way the VM system deals with memory segments.