Index: sys/riscv/include/memdev.h =================================================================== --- sys/riscv/include/memdev.h +++ sys/riscv/include/memdev.h @@ -35,6 +35,6 @@ d_open_t memopen; d_read_t memrw; d_ioctl_t memioctl_md; -#define memmmap (d_mmap_t *)NULL +d_mmap_t memmmap; #endif /* _MACHINE_MEMDEV_H_ */ Index: sys/riscv/riscv/mem.c =================================================================== --- sys/riscv/riscv/mem.c +++ sys/riscv/riscv/mem.c @@ -122,6 +122,22 @@ 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; + return (0); + } + return (-1); +} + int memioctl_md(struct cdev *dev __unused, u_long cmd __unused, caddr_t data __unused, int flags __unused, struct thread *td __unused)