summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-01-09 02:35:19 +0000
committerkib <kib@FreeBSD.org>2015-01-09 02:35:19 +0000
commita47e5e5116a0779d1cefc68c695cb8f3b898acb0 (patch)
tree11bdcd07ab3aecb3d79fb141ab179b2899656d3e /sys/amd64
parentb085354527cc8071757ab87d86b538b2e52133eb (diff)
downloadFreeBSD-src-a47e5e5116a0779d1cefc68c695cb8f3b898acb0.zip
FreeBSD-src-a47e5e5116a0779d1cefc68c695cb8f3b898acb0.tar.gz
MFC r276523:
Restore access to the page at zero through /dev/mem after r263475.
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/mem.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index 170da3f..2b6b112 100644
--- a/sys/amd64/amd64/mem.c
+++ b/sys/amd64/amd64/mem.c
@@ -77,7 +77,7 @@ int
memrw(struct cdev *dev, struct uio *uio, int flags)
{
struct iovec *iov;
- u_long c, v;
+ u_long c, v, vd;
int error, o, sflags;
vm_offset_t addr, eaddr;
@@ -98,15 +98,15 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
kmemphys:
o = v & PAGE_MASK;
c = min(uio->uio_resid, (u_int)(PAGE_SIZE - o));
- v = PHYS_TO_DMAP(v);
- if (v < DMAP_MIN_ADDRESS ||
- (v > DMAP_MIN_ADDRESS + dmaplimit &&
- v <= DMAP_MAX_ADDRESS) ||
- pmap_kextract(v) == 0) {
+ vd = PHYS_TO_DMAP(v);
+ if (vd < DMAP_MIN_ADDRESS ||
+ (vd > DMAP_MIN_ADDRESS + dmaplimit &&
+ vd <= DMAP_MAX_ADDRESS) ||
+ (pmap_kextract(vd) == 0 && (v & PG_FRAME) != 0)) {
error = EFAULT;
goto ret;
}
- error = uiomove((void *)v, (int)c, uio);
+ error = uiomove((void *)vd, (int)c, uio);
continue;
} else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
v = uio->uio_offset;
OpenPOWER on IntegriCloud