diff options
author | kib <kib@FreeBSD.org> | 2015-02-14 08:44:12 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-02-14 08:44:12 +0000 |
commit | c85a72688762659213e049dceb4c5cef5384b06a (patch) | |
tree | 7f9d713849cb3f9f502aa4c4376c4b3d7f7fe25d /sys/arm | |
parent | 84832977496c0eb6f7a5bbf0ceb7105ae56f1835 (diff) | |
download | FreeBSD-src-c85a72688762659213e049dceb4c5cef5384b06a.zip FreeBSD-src-c85a72688762659213e049dceb4c5cef5384b06a.tar.gz |
MFC r277643:
Remove Giant from /dev/mem and /dev/kmem.
MFC r277743:
Arm: ensure that _tmppt KVA is used exclusively.
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/mem.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/arm/arm/mem.c b/sys/arm/arm/mem.c index 460a004..58b0d25 100644 --- a/sys/arm/arm/mem.c +++ b/sys/arm/arm/mem.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mutex.h> #include <sys/proc.h> #include <sys/signalvar.h> +#include <sys/sx.h> #include <sys/systm.h> #include <sys/uio.h> @@ -72,6 +73,9 @@ MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); struct mem_range_softc mem_range_softc; +static struct sx tmppt_lock; +SX_SYSINIT(tmppt, &tmppt_lock, "mem4map"); + /* ARGSUSED */ int memrw(struct cdev *dev, struct uio *uio, int flags) @@ -82,8 +86,6 @@ memrw(struct cdev *dev, struct uio *uio, int flags) int error = 0; vm_offset_t addr, eaddr; - GIANT_REQUIRED; - while (uio->uio_resid > 0 && error == 0) { iov = uio->uio_iov; if (iov->iov_len == 0) { @@ -109,6 +111,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags) } if (!address_valid) return (EINVAL); + sx_xlock(&tmppt_lock); pmap_kenter((vm_offset_t)_tmppt, v); o = (int)uio->uio_offset & PAGE_MASK; c = (u_int)(PAGE_SIZE - ((int)iov->iov_base & PAGE_MASK)); @@ -116,6 +119,7 @@ memrw(struct cdev *dev, struct uio *uio, int flags) c = min(c, (u_int)iov->iov_len); error = uiomove((caddr_t)&_tmppt[o], (int)c, uio); pmap_qremove((vm_offset_t)_tmppt, 1); + sx_xunlock(&tmppt_lock); continue; } else if (dev2unit(dev) == CDEV_MINOR_KMEM) { |