Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159289759
D26622.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26622.id.diff
View Options
Index: head/sys/riscv/include/memdev.h
===================================================================
--- head/sys/riscv/include/memdev.h
+++ head/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: head/sys/riscv/riscv/mem.c
===================================================================
--- head/sys/riscv/riscv/mem.c
+++ head/sys/riscv/riscv/mem.c
@@ -122,6 +122,21 @@
return (error);
}
+/*
+ * Allow user processes to MMAP some memory sections
+ * instead of going through read/write.
+ */
+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)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 13, 11:13 AM (6 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33923956
Default Alt Text
D26622.id.diff (1 KB)
Attached To
Mode
D26622: riscv: Add memmmap so we can mmap /dev/mem
Attached
Detach File
Event Timeline
Log In to Comment