Use netbsd <sys/mman.h>

Change-Id: I80e9cffc80140383a6faf692248573c64d282b4a
This commit is contained in:
Ben Gras
2013-11-28 17:51:21 +01:00
committed by Lionel Sambuc
parent 364953ad40
commit 88be7bd333
10 changed files with 99 additions and 100 deletions

View File

@@ -86,8 +86,8 @@ int
do_mapcache(message *msg)
{
dev_t dev = msg->m_u.m_vmmcp.dev;
u64_t dev_off = (u64_t) msg->m_u.m_vmmcp.dev_offset_pages * VM_PAGE_SIZE;
u64_t ino_off = (u64_t) msg->m_u.m_vmmcp.ino_offset_pages * VM_PAGE_SIZE;
u64_t dev_off = msg->m_u.m_vmmcp.dev_offset;
u64_t ino_off = msg->m_u.m_vmmcp.ino_offset;
int n;
phys_bytes bytes = msg->m_u.m_vmmcp.pages * VM_PAGE_SIZE;
struct vir_region *vr;
@@ -95,6 +95,11 @@ do_mapcache(message *msg)
vir_bytes offset;
int io = 0;
if(dev_off % PAGE_SIZE || ino_off % PAGE_SIZE) {
printf("VM: unaligned cache operation\n");
return EFAULT;
}
if(vm_isokendpt(msg->m_source, &n) != OK) panic("bogus source");
caller = &vmproc[n];
@@ -166,8 +171,8 @@ do_setcache(message *msg)
{
int r;
dev_t dev = msg->m_u.m_vmmcp.dev;
u64_t dev_off = (u64_t) msg->m_u.m_vmmcp.dev_offset_pages * VM_PAGE_SIZE;
u64_t ino_off = (u64_t) msg->m_u.m_vmmcp.ino_offset_pages * VM_PAGE_SIZE;
u64_t dev_off = (u64_t) msg->m_u.m_vmmcp.dev_offset;
u64_t ino_off = (u64_t) msg->m_u.m_vmmcp.ino_offset;
int n;
struct vmproc *caller;
phys_bytes offset;
@@ -175,6 +180,11 @@ do_setcache(message *msg)
if(bytes < VM_PAGE_SIZE) return EINVAL;
if(dev_off % PAGE_SIZE || ino_off % PAGE_SIZE) {
printf("VM: unaligned cache operation\n");
return EFAULT;
}
if(vm_isokendpt(msg->m_source, &n) != OK) panic("bogus source");
caller = &vmproc[n];