Add memmmap on arm64 so we can mmap /dev/mem and /dev/kmem.

Obtained from:	ABT Systems Ltd
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
andrew 2016-07-13 23:03:34 +00:00
parent 126c1b40bc
commit 8c24a12208
2 changed files with 17 additions and 1 deletions

View File

@ -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);
}

View File

@ -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_ */