diff options
author | andrew <andrew@FreeBSD.org> | 2016-08-31 17:30:21 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2016-08-31 17:30:21 +0000 |
commit | 47dcae7f54a756595c86331ae6e66c8f9cebc96c (patch) | |
tree | 5c498f74de2eb17e83b634c458447bbb6540a833 /sys/arm64 | |
parent | 2747f0b55bcb0c07f48112af79913df4b5f9cd6a (diff) | |
download | FreeBSD-src-47dcae7f54a756595c86331ae6e66c8f9cebc96c.zip FreeBSD-src-47dcae7f54a756595c86331ae6e66c8f9cebc96c.tar.gz |
MFC 302789:
Add memmmap on arm64 so we can mmap /dev/mem and /dev/kmem.
Diffstat (limited to 'sys/arm64')
-rw-r--r-- | sys/arm64/arm64/mem.c | 16 | ||||
-rw-r--r-- | sys/arm64/include/memdev.h | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/sys/arm64/arm64/mem.c b/sys/arm64/arm64/mem.c index 481ef884..9044fb3 100644 --- a/sys/arm64/arm64/mem.c +++ b/sys/arm64/arm64/mem.c @@ -114,3 +114,19 @@ memrw(struct cdev *dev, struct uio *uio, int flags) return (error); } +/* + * allow user processes to MMAP some memory sections + * instead of going through read/write + */ +/* ARGSUSED */ +int +memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot __unused, vm_memattr_t *memattr __unused) +{ + if (dev2unit(dev) == CDEV_MINOR_MEM) + *paddr = offset; + else if (dev2unit(dev) == CDEV_MINOR_KMEM) + *paddr = vtophys(offset); + /* else panic! */ + return (0); +} diff --git a/sys/arm64/include/memdev.h b/sys/arm64/include/memdev.h index f16ba16..85fca07 100644 --- a/sys/arm64/include/memdev.h +++ b/sys/arm64/include/memdev.h @@ -35,6 +35,6 @@ d_open_t memopen; d_read_t memrw; #define memioctl (d_ioctl_t *)NULL -#define memmmap (d_mmap_t *)NULL +d_mmap_t memmmap; #endif /* _MACHINE_MEMDEV_H_ */ |