make vfs & filesystems use failable copying
[minix3.git] / lib / libsys / vm_map_phys.c
blob135608197d2675caf42800eee04f1800bd88a730
1 #include "syslib.h"
3 #include <sys/mman.h>
4 #include <minix/vm.h>
5 #include <stdarg.h>
6 #include <string.h>
8 void *
9 vm_map_phys(endpoint_t who, void *phaddr, size_t len)
11 message m;
12 int r;
14 memset(&m, 0, sizeof(m));
15 m.VMMP_EP = who;
16 m.VMMP_PHADDR = phaddr;
17 m.VMMP_LEN = len;
19 r = _taskcall(VM_PROC_NR, VM_MAP_PHYS, &m);
21 if (r != OK) return MAP_FAILED;
23 return (void *) m.VMMP_VADDR_REPLY;
26 int
27 vm_unmap_phys(endpoint_t who, void *vaddr, size_t len)
29 message m;
31 memset(&m, 0, sizeof(m));
32 m.VMUP_EP = who;
33 m.VMUP_VADDR = vaddr;
35 return _taskcall(VM_PROC_NR, VM_UNMAP_PHYS, &m);