2008-11-19 13:26:10 +01:00
|
|
|
#define _SYSTEM 1
|
|
|
|
#include <lib.h>
|
|
|
|
#include <sys/mman.h>
|
2009-08-17 20:48:27 +02:00
|
|
|
#include <minix/syslib.h>
|
2008-11-19 13:26:10 +01:00
|
|
|
#include <minix/vm.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
2008-12-11 15:37:42 +01:00
|
|
|
PUBLIC void *vm_map_phys(endpoint_t who, void *phaddr, size_t len)
|
2008-11-19 13:26:10 +01:00
|
|
|
{
|
|
|
|
message m;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
m.VMMP_EP = who;
|
|
|
|
m.VMMP_PHADDR = phaddr;
|
|
|
|
m.VMMP_LEN = len;
|
|
|
|
|
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
|
|
|
|
|
|
|
if(r != OK) return MAP_FAILED;
|
|
|
|
|
|
|
|
return (void *) m.VMMP_VADDR_REPLY;
|
|
|
|
}
|
|
|
|
|
|
|
|
PUBLIC int vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
|
|
|
|
{
|
|
|
|
message m;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
m.VMUP_EP = who;
|
|
|
|
m.VMUP_VADDR = vaddr;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|