diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/alpha/alpha/mem.c | 34 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/arm/arm/mem.c | 5 | ||||
-rw-r--r-- | sys/arch/i386/i386/mem.c | 16 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mem.c | 14 | ||||
-rw-r--r-- | sys/arch/sh/sh/mem.c | 7 | ||||
-rw-r--r-- | sys/arch/socppc/socppc/mem.c | 12 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/mem.c | 8 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/mem.c | 9 |
9 files changed, 43 insertions, 66 deletions
diff --git a/sys/arch/alpha/alpha/mem.c b/sys/arch/alpha/alpha/mem.c index 1b24e14e9f3..ad3812ae22c 100644 --- a/sys/arch/alpha/alpha/mem.c +++ b/sys/arch/alpha/alpha/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.29 2016/08/01 15:58:22 tedu Exp $ */ +/* $OpenBSD: mem.c,v 1.30 2016/08/15 22:01:59 tedu Exp $ */ /* $NetBSD: mem.c,v 1.26 2000/03/29 03:48:20 simonb Exp $ */ /* @@ -84,7 +84,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) /* authorize only one simultaneous open() unless * allowaperture=3 */ if (ap_open_count > 0 && allowaperture < 3) - return(EPERM); + return (EPERM); ap_open_count++; return (0); #endif @@ -126,7 +126,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) } switch (minor(dev)) { -/* minor device 0 is physical memory */ + /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; kmemphys: @@ -167,13 +167,13 @@ kmemphys: error = uiomove((caddr_t)v, c, uio); break; -/* minor device 2 is EOF/rathole */ + /* minor device 2 is /dev/null */ case 2: if (uio->uio_rw == UIO_WRITE) uio->uio_resid = 0; return (0); -/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */ + /* minor device 12 is /dev/zero */ case 12: if (uio->uio_rw == UIO_WRITE) { uio->uio_resid = 0; @@ -202,18 +202,18 @@ mmmmap(dev_t dev, off_t off, int prot) { switch (minor(dev)) { case 0: - /* - * /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(). - */ - - /* - * Allow access only in RAM. - */ + /* + * /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(). + */ + + /* + * Allow access only in RAM. + */ if ((prot & alpha_pa_access(atop(off))) != prot) return (-1); return off; diff --git a/sys/arch/amd64/amd64/mem.c b/sys/arch/amd64/amd64/mem.c index b412c1e862e..739dd29a4be 100644 --- a/sys/arch/amd64/amd64/mem.c +++ b/sys/arch/amd64/amd64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.29 2016/07/27 21:13:39 tedu Exp $ */ +/* $OpenBSD: mem.c,v 1.30 2016/08/15 22:01:59 tedu Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -95,7 +95,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) /* authorize only one simultaneous open() unless * allowaperture=3 */ if (ap_open_count > 0 && allowaperture < 3) - return(EPERM); + return (EPERM); ap_open_count++; break; #endif diff --git a/sys/arch/arm/arm/mem.c b/sys/arch/arm/arm/mem.c index 1834380b385..9d09331fbbd 100644 --- a/sys/arch/arm/arm/mem.c +++ b/sys/arch/arm/arm/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.15 2016/08/01 15:58:22 tedu Exp $ */ +/* $OpenBSD: mem.c,v 1.16 2016/08/15 22:01:59 tedu Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* @@ -115,7 +115,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) /* authorize only one simultaneous open() unless * allowaperture=3 */ if (ap_open_count > 0 && allowaperture < 3) - return(EPERM); + return (EPERM); ap_open_count++; break; #endif @@ -216,7 +216,6 @@ mmrw(dev_t dev, struct uio *uio, int flags) } } if (minor(dev) == DEV_MEM) { -/*unlock:*/ if (physlock > 1) wakeup((caddr_t)&physlock); physlock = 0; diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index 513bc97b48a..d8c4a565361 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.48 2016/07/28 16:08:56 tedu Exp $ */ +/* $OpenBSD: mem.c,v 1.49 2016/08/15 22:01:59 tedu Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -112,7 +112,6 @@ mmclose(dev_t dev, int flag, int mode, struct proc *p) return (0); } -/*ARGSUSED*/ int mmrw(dev_t dev, struct uio *uio, int flags) { @@ -139,7 +138,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) } switch (minor(dev)) { -/* minor device 0 is physical memory */ + /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; pmap_enter(pmap_kernel(), (vaddr_t)vmmap, @@ -154,7 +153,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) pmap_update(pmap_kernel()); continue; -/* minor device 1 is kernel memory */ + /* minor device 1 is kernel memory */ case 1: v = uio->uio_offset; c = ulmin(iov->iov_len, MAXPHYS); @@ -164,13 +163,13 @@ mmrw(dev_t dev, struct uio *uio, int flags) error = uiomove((caddr_t)v, c, uio); continue; -/* minor device 2 is EOF/RATHOLE */ + /* minor device 2 is /dev/null */ case 2: if (uio->uio_rw == UIO_WRITE) uio->uio_resid = 0; return (0); -/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */ + /* minor device 12 is /dev/zero */ case 12: if (uio->uio_rw == UIO_WRITE) { c = iov->iov_len; @@ -204,14 +203,14 @@ mmmmap(dev_t dev, off_t off, int prot) struct proc *p = curproc; /* XXX */ switch (minor(dev)) { -/* minor device 0 is physical memory */ + /* minor device 0 is physical memory */ case 0: if ((u_int)off > ptoa(physmem) && suser(p, 0) != 0) return -1; return off; #ifdef APERTURE -/* minor device 4 is aperture driver */ + /* minor device 4 is aperture driver */ case 4: /* Check if a write combining mapping is requested. */ if (off >= MEMRANGE_WC_RANGE) @@ -344,4 +343,3 @@ mem_range_attr_set(struct mem_range_desc *mrd, int *arg) } #endif /* MTRR */ - diff --git a/sys/arch/macppc/macppc/mem.c b/sys/arch/macppc/macppc/mem.c index 472f604dc91..81360d042a7 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.22 2015/09/06 16:24:19 deraadt Exp $ */ +/* $OpenBSD: mem.c,v 1.23 2016/08/15 22:01:59 tedu Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -188,7 +188,6 @@ mem_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr, #endif /* SMALL_KERNEL */ -/*ARGSUSED*/ int mmopen(dev_t dev, int flag, int mode, struct proc *p) { @@ -207,7 +206,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) /* authorize only one simultaneous open() unless * allowaperture=3 */ if (ap_open_count > 0 && allowaperture < 3) - return(EPERM); + return (EPERM); ap_open_count++; break; #endif @@ -217,7 +216,6 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) return (0); } -/*ARGSUSED*/ int mmclose(dev_t dev, int flag, int mode, struct proc *p) { @@ -228,7 +226,6 @@ mmclose(dev_t dev, int flag, int mode, struct proc *p) return 0; } -/*ARGSUSED*/ int mmrw(dev_t dev, struct uio *uio, int flags) { @@ -265,15 +262,13 @@ mmrw(dev_t dev, struct uio *uio, int flags) error = uiomove((caddr_t)v, c, uio); continue; - /* minor device 2 is EOF/RATHOLE */ + /* minor device 2 is /dev/null */ case 2: if (uio->uio_rw == UIO_WRITE) uio->uio_resid = 0; return 0; - /* minor device 12 (/dev/zero) is source of nulls on read, - * rathole on write - */ + /* minor device 12 is /dev/zero */ case 12: if (uio->uio_rw == UIO_WRITE) { c = iov->iov_len; @@ -305,7 +300,6 @@ mmmmap(dev_t dev, off_t off, int prot) return (-1); } -/*ARGSUSED*/ int mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) { diff --git a/sys/arch/sh/sh/mem.c b/sys/arch/sh/sh/mem.c index f0241e83d9a..0eac7ab15fd 100644 --- a/sys/arch/sh/sh/mem.c +++ b/sys/arch/sh/sh/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.6 2015/02/10 22:44:35 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.7 2016/08/15 22:01:59 tedu Exp $ */ /* $NetBSD: mem.c,v 1.21 2006/07/23 22:06:07 ad Exp $ */ /* @@ -102,7 +102,6 @@ cdev_decl(mm); #define DEV_NULL 2 #define DEV_ZERO 12 -/* ARGSUSED */ int mmopen(dev_t dev, int flag, int mode, struct proc *p) { @@ -119,14 +118,12 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) return (0); } -/*ARGSUSED*/ int mmclose(dev_t dev, int flag, int mode, struct proc *p) { return (0); } -/*ARGSUSED*/ int mmrw(dev_t dev, struct uio *uio, int flags) { @@ -208,7 +205,6 @@ mmrw(dev_t dev, struct uio *uio, int flags) return (error); } -/*ARGSUSED*/ paddr_t mmmmap(dev_t dev, off_t off, int prot) { @@ -222,7 +218,6 @@ mmmmap(dev_t dev, off_t off, int prot) return ((paddr_t)off); } -/*ARGSUSED*/ int mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) { diff --git a/sys/arch/socppc/socppc/mem.c b/sys/arch/socppc/socppc/mem.c index f2d56687873..e17f055de68 100644 --- a/sys/arch/socppc/socppc/mem.c +++ b/sys/arch/socppc/socppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.4 2015/02/10 22:44:35 miod Exp $ */ +/* $OpenBSD: mem.c,v 1.5 2016/08/15 22:01:59 tedu Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -55,7 +55,6 @@ #include <machine/conf.h> -/*ARGSUSED*/ int mmopen(dev_t dev, int flag, int mode, struct proc *p) { @@ -83,7 +82,6 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) return (0); } -/*ARGSUSED*/ int mmclose(dev_t dev, int flag, int mode, struct proc *p) { @@ -94,7 +92,6 @@ mmclose(dev_t dev, int flag, int mode, struct proc *p) return 0; } -/*ARGSUSED*/ int mmrw(dev_t dev, struct uio *uio, int flags) { @@ -131,15 +128,13 @@ mmrw(dev_t dev, struct uio *uio, int flags) error = uiomove((caddr_t)v, c, uio); continue; - /* minor device 2 is EOF/RATHOLE */ + /* minor device 2 is /dev/null */ case 2: if (uio->uio_rw == UIO_WRITE) uio->uio_resid = 0; return 0; - /* minor device 12 (/dev/zero) is source of nulls on read, - * rathole on write - */ + /* minor device 12 is /dev/zero */ case 12: if (uio->uio_rw == UIO_WRITE) { c = iov->iov_len; @@ -171,7 +166,6 @@ mmmmap(dev_t dev, off_t off, int prot) return (-1); } -/*ARGSUSED*/ int mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) { diff --git a/sys/arch/sparc/sparc/mem.c b/sys/arch/sparc/sparc/mem.c index fef381de6fc..8cbbacd421b 100644 --- a/sys/arch/sparc/sparc/mem.c +++ b/sys/arch/sparc/sparc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.26 2016/07/27 15:12:36 tedu Exp $ */ +/* $OpenBSD: mem.c,v 1.27 2016/08/15 22:01:59 tedu Exp $ */ /* $NetBSD: mem.c,v 1.13 1996/03/30 21:12:16 christos Exp $ */ /* @@ -157,14 +157,14 @@ mmrw(dev_t dev, struct uio *uio, int flags) error = uiomove((caddr_t)va, c, uio); continue; - /* minor device 2 is EOF/RATHOLE */ + /* minor device 2 is /dev/null */ case 2: if (uio->uio_rw == UIO_WRITE) uio->uio_resid = 0; return (0); #if defined(SUN4) -/* minor device 11 (/dev/eeprom) is the old-style (a'la Sun 3) EEPROM */ + /* minor device 11 is /dev/eeprom */ case 11: if (cputyp == CPU_SUN4) error = eeprom_uio(uio); @@ -174,7 +174,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) continue; #endif /* SUN4 */ -/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */ + /* minor device 12 is /dev/zero */ case 12: if (uio->uio_rw == UIO_WRITE) { uio->uio_resid = 0; diff --git a/sys/arch/sparc64/sparc64/mem.c b/sys/arch/sparc64/sparc64/mem.c index e5af1339214..32615817070 100644 --- a/sys/arch/sparc64/sparc64/mem.c +++ b/sys/arch/sparc64/sparc64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.15 2016/07/27 15:12:36 tedu Exp $ */ +/* $OpenBSD: mem.c,v 1.16 2016/08/15 22:01:59 tedu Exp $ */ /* $NetBSD: mem.c,v 1.18 2001/04/24 04:31:12 thorpej Exp $ */ /* @@ -140,16 +140,13 @@ mmrw(dev_t dev, struct uio *uio, int flags) error = uiomove((caddr_t)v, c, uio); break; - /* minor device 2 is EOF/RATHOLE */ + /* minor device 2 is /dev/null */ case 2: if (uio->uio_rw == UIO_WRITE) uio->uio_resid = 0; return (0); - /* - * minor device 12 (/dev/zero) is source of nulls on read, - * rathole on write. - */ + /* minor device 12 is /dev/zero */ case 12: if (uio->uio_rw == UIO_WRITE) { uio->uio_resid = 0; |