9 __weak_alias(vm_remap
, _vm_remap
)
10 __weak_alias(vm_unmap
, _vm_unmap
)
11 __weak_alias(vm_getphys
, _vm_getphys
)
12 __weak_alias(vm_getrefcount
, _vm_getrefcount
)
13 __weak_alias(minix_mmap
, _minix_mmap
)
14 __weak_alias(minix_munmap
, _minix_munmap
)
23 void *minix_mmap_for(endpoint_t forwhom
,
24 void *addr
, size_t len
, int prot
, int flags
, int fd
, off_t offset
)
29 m
.VMM_ADDR
= (vir_bytes
) addr
;
34 m
.VMM_OFFSET
= offset
;
35 m
.VMM_FORWHOM
= forwhom
;
38 m
.VMM_FLAGS
|= MAP_THIRDPARTY
;
41 r
= _syscall(VM_PROC_NR
, VM_MMAP
, &m
);
47 return (void *) m
.VMM_RETADDR
;
50 void *minix_mmap(void *addr
, size_t len
, int prot
, int flags
,
53 return minix_mmap_for(SELF
, addr
, len
, prot
, flags
, fd
, offset
);
56 int minix_munmap(void *addr
, size_t len
)
63 return _syscall(VM_PROC_NR
, VM_MUNMAP
, &m
);
67 void *vm_remap(endpoint_t d
,
78 m
.VMRE_DA
= (char *) da
;
79 m
.VMRE_SA
= (char *) sa
;
82 r
= _syscall(VM_PROC_NR
, VM_REMAP
, &m
);
85 return (void *) m
.VMRE_RETA
;
88 void *vm_remap_ro(endpoint_t d
,
99 m
.VMRE_DA
= (char *) da
;
100 m
.VMRE_SA
= (char *) sa
;
103 r
= _syscall(VM_PROC_NR
, VM_REMAP_RO
, &m
);
106 return (void *) m
.VMRE_RETA
;
109 int vm_unmap(endpoint_t endpt
, void *addr
)
113 m
.VMUN_ENDPT
= endpt
;
114 m
.VMUN_ADDR
= (long) addr
;
116 return _syscall(VM_PROC_NR
, VM_SHM_UNMAP
, &m
);
119 unsigned long vm_getphys(int endpt
, void *addr
)
124 m
.VMPHYS_ENDPT
= endpt
;
125 m
.VMPHYS_ADDR
= (long) addr
;
127 r
= _syscall(VM_PROC_NR
, VM_GETPHYS
, &m
);
130 return m
.VMPHYS_RETA
;
133 u8_t
vm_getrefcount(endpoint_t endpt
, void *addr
)
138 m
.VMREFCNT_ENDPT
= endpt
;
139 m
.VMREFCNT_ADDR
= (long) addr
;
141 r
= _syscall(VM_PROC_NR
, VM_GETREF
, &m
);
144 return (u8_t
) m
.VMREFCNT_RETC
;