diff options
-rw-r--r-- | sys/arch/hp300/hp300/mem.c | 21 | ||||
-rw-r--r-- | sys/arch/hp300/include/vmparam.h | 7 |
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. |