vm: add third-party mmap() mode and PROCCTL
these two functions will be used to support all exec() functionality going into a single library shared by RS and VFS and exec() knowledge leaving VM. . third-party mmap: allow certain processes (VFS, RS) to do mmap() on behalf of another process . PROCCTL: used to free and clear a process' address space
This commit is contained in:
@@ -21,8 +21,8 @@ __weak_alias(minix_munmap_text, _minix_munmap_text)
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
void *minix_mmap(void *addr, size_t len, int prot, int flags,
|
||||
int fd, off_t offset)
|
||||
void *minix_mmap_for(endpoint_t forwhom,
|
||||
void *addr, size_t len, int prot, int flags, int fd, off_t offset)
|
||||
{
|
||||
message m;
|
||||
int r;
|
||||
@@ -33,6 +33,11 @@ void *minix_mmap(void *addr, size_t len, int prot, int flags,
|
||||
m.VMM_FLAGS = flags;
|
||||
m.VMM_FD = fd;
|
||||
m.VMM_OFFSET = offset;
|
||||
m.VMM_FORWHOM = forwhom;
|
||||
|
||||
if(forwhom != SELF) {
|
||||
m.VMM_FLAGS |= MAP_THIRDPARTY;
|
||||
}
|
||||
|
||||
r = _syscall(VM_PROC_NR, VM_MMAP, &m);
|
||||
|
||||
@@ -43,6 +48,12 @@ void *minix_mmap(void *addr, size_t len, int prot, int flags,
|
||||
return (void *) m.VMM_RETADDR;
|
||||
}
|
||||
|
||||
void *minix_mmap(void *addr, size_t len, int prot, int flags,
|
||||
int fd, off_t offset)
|
||||
{
|
||||
return minix_mmap_for(SELF, addr, len, prot, flags, fd, offset);
|
||||
}
|
||||
|
||||
int minix_munmap(void *addr, size_t len)
|
||||
{
|
||||
message m;
|
||||
|
||||
@@ -127,6 +127,7 @@ SRCS= \
|
||||
vm_push_sig.c \
|
||||
vm_umap.c \
|
||||
vm_yield_get_block.c \
|
||||
vm_procctl.c \
|
||||
vprintf.c \
|
||||
|
||||
.if ${MKCOVERAGE} != "no"
|
||||
|
||||
22
lib/libsys/vm_procctl.c
Normal file
22
lib/libsys/vm_procctl.c
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
#include "syslib.h"
|
||||
|
||||
#include <minix/vm.h>
|
||||
#include <string.h>
|
||||
|
||||
/*===========================================================================*
|
||||
* vm_exit *
|
||||
*===========================================================================*/
|
||||
int vm_procctl(endpoint_t ep, int param)
|
||||
{
|
||||
message m;
|
||||
int result;
|
||||
|
||||
memset(&m, 0, sizeof(m));
|
||||
|
||||
m.VMPCTL_WHO = ep;
|
||||
m.VMPCTL_PARAM = param;
|
||||
|
||||
result = _taskcall(VM_PROC_NR, VM_PROCCTL, &m);
|
||||
return(result);
|
||||
}
|
||||
Reference in New Issue
Block a user