2013-11-03 22:33:44 +01:00
|
|
|
#include "syslib.h"
|
|
|
|
|
2008-11-19 13:26:10 +01:00
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <minix/vm.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2013-11-03 22:33:44 +01:00
|
|
|
void *
|
|
|
|
vm_map_phys(endpoint_t who, void *phaddr, size_t len)
|
2008-11-19 13:26:10 +01:00
|
|
|
{
|
|
|
|
message m;
|
|
|
|
int r;
|
|
|
|
|
2013-11-03 22:33:44 +01:00
|
|
|
memset(&m, 0, sizeof(m));
|
2014-07-26 13:53:58 +02:00
|
|
|
m.m_lsys_vm_map_phys.ep = who;
|
|
|
|
m.m_lsys_vm_map_phys.phaddr = phaddr;
|
|
|
|
m.m_lsys_vm_map_phys.len = len;
|
2008-11-19 13:26:10 +01:00
|
|
|
|
2008-12-11 15:37:42 +01:00
|
|
|
r = _taskcall(VM_PROC_NR, VM_MAP_PHYS, &m);
|
2008-11-19 13:26:10 +01:00
|
|
|
|
2013-11-03 22:33:44 +01:00
|
|
|
if (r != OK) return MAP_FAILED;
|
2008-11-19 13:26:10 +01:00
|
|
|
|
2014-07-26 13:53:58 +02:00
|
|
|
return m.m_lsys_vm_map_phys.reply;
|
2008-11-19 13:26:10 +01:00
|
|
|
}
|
|
|
|
|
2013-11-03 22:33:44 +01:00
|
|
|
int
|
|
|
|
vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
|
2008-11-19 13:26:10 +01:00
|
|
|
{
|
|
|
|
message m;
|
|
|
|
|
2013-11-03 22:33:44 +01:00
|
|
|
memset(&m, 0, sizeof(m));
|
2014-07-26 13:53:59 +02:00
|
|
|
m.m_lsys_vm_unmap_phys.ep = who;
|
|
|
|
m.m_lsys_vm_unmap_phys.vaddr = vaddr;
|
2008-11-19 13:26:10 +01:00
|
|
|
|
2008-12-11 15:37:42 +01:00
|
|
|
return _taskcall(VM_PROC_NR, VM_UNMAP_PHYS, &m);
|
2008-11-19 13:26:10 +01:00
|
|
|
}
|