From: Ben Gras Date: Mon, 21 Sep 2009 14:45:09 +0000 (+0000) Subject: more vm stubs X-Git-Tag: v3.1.5~126 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-keygen.html?a=commitdiff_plain;h=76ba69151dc1c9e6492ea03c2fa906fa84344cae;p=minix.git more vm stubs --- diff --git a/lib/posix/_mmap.c b/lib/posix/_mmap.c index 4dbbbc8a3..a1bfd6638 100755 --- a/lib/posix/_mmap.c +++ b/lib/posix/_mmap.c @@ -2,6 +2,11 @@ #include #define mmap _mmap #define munmap _munmap +#define munmap_text _munmap_text +#define vm_remap _vm_remap +#define vm_unmap _vm_unmap +#define vm_getphys _vm_getphys +#define vm_getrefcount _vm_getrefcount #include #include #include @@ -36,5 +41,74 @@ PUBLIC int munmap(void *addr, size_t len) m.VMUM_ADDR = addr; m.VMUM_LEN = len; - return _syscall(VM_PROC_NR, VM_UNMAP, &m); + return _syscall(VM_PROC_NR, VM_MUNMAP, &m); } + + +PUBLIC int munmap_text(void *addr, size_t len) +{ + message m; + + m.VMUM_ADDR = addr; + m.VMUM_LEN = len; + + return _syscall(VM_PROC_NR, VM_MUNMAP_TEXT, &m); +} + +PUBLIC void *vm_remap(int d, int s, void *da, void *sa, size_t size) +{ + message m; + int r; + + m.VMRE_D = d; + m.VMRE_S = s; + m.VMRE_DA = (char *) da; + m.VMRE_SA = (char *) sa; + m.VMRE_SIZE = size; + + r = _syscall(VM_PROC_NR, VM_REMAP, &m); + if (r != OK) + return MAP_FAILED; + return (void *) m.VMRE_RETA; +} + +PUBLIC int vm_unmap(int endpt, void *addr) +{ + message m; + + m.VMUN_ENDPT = endpt; + m.VMUN_ADDR = (long) addr; + + return _syscall(VM_PROC_NR, VM_SHM_UNMAP, &m); +} + +PUBLIC unsigned long vm_getphys(int endpt, void *addr) +{ + message m; + unsigned long ret; + int r; + + m.VMPHYS_ENDPT = endpt; + m.VMPHYS_ADDR = (long) addr; + + r = _syscall(VM_PROC_NR, VM_GETPHYS, &m); + if (r != OK) + return 0; + return m.VMPHYS_RETA; +} + +PUBLIC u8_t vm_getrefcount(int endpt, void *addr) +{ + message m; + u8_t ret; + int r; + + m.VMREFCNT_ENDPT = endpt; + m.VMREFCNT_ADDR = (long) addr; + + r = _syscall(VM_PROC_NR, VM_GETREF, &m); + if (r != OK) + return (u8_t) -1; + return (u8_t) m.VMREFCNT_RETC; +} +