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:
Ben Gras
2012-06-06 00:50:13 +02:00
parent 1daf36038c
commit ee4016155e
12 changed files with 98 additions and 7 deletions

View File

@@ -942,6 +942,7 @@
# define VMM_FLAGS m5_s2
# define VMM_FD m5_i1
# define VMM_OFFSET m5_i2
# define VMM_FORWHOM m5_l3
# define VMM_RETADDR m5_l1 /* result */
#define VM_UMAP (VM_RQ_BASE+11)
# define VMU_SEG m1_i1
@@ -1076,8 +1077,14 @@
#define VM_REMAP_RO (VM_RQ_BASE+44)
/* same args as VM_REMAP */
#define VM_PROCCTL (VM_RQ_BASE+45)
#define VMPCTL_PARAM m1_i1
#define VMPCTL_WHO m1_i2
#define VMPPARAM_CLEAR 1 /* values for VMPCTL_PARAM */
/* Total. */
#define NR_VM_CALLS 45
#define NR_VM_CALLS 46
#define VM_CALL_MASK_SIZE BITMAP_CHUNKS(NR_VM_CALLS)
/* not handled as a normal VM call, thus at the end of the reserved rage */

View File

@@ -70,6 +70,7 @@ int vm_info_stats(struct vm_stats_info *vfi);
int vm_info_usage(endpoint_t who, struct vm_usage_info *vui);
int vm_info_region(endpoint_t who, struct vm_region_info *vri, int
count, vir_bytes *next);
int vm_procctl(endpoint_t ep, int param);
#endif /* _MINIX_VM_H */

View File

@@ -4,6 +4,7 @@
#include <sys/featuretest.h>
#include <machine/ansi.h>
#include <minix/type.h>
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
@@ -54,9 +55,10 @@ typedef __off_t off_t; /* file offset */
#define MAP_ALIGN64K 0x0040 /* physically aligned at 64kB */
#define MAP_LOWER1M 0x0080 /* physically below 16MB */
#define MAP_ALIGNMENT_64KB MAP_ALIGN64K
#define MAP_IPC_SHARED 0x0100 /* share changes */
#define MAP_IPC_SHARED 0x0100 /* share changes */
#define MAP_FIXED 0x0200 /* require mapping to happen at hint */
#define MAP_THIRDPARTY 0x0400 /* perform on behalf of any process */
/*
* Error indicator returned by mmap(2)
@@ -71,6 +73,7 @@ void * mmap(void *, size_t, int, int, int, off_t);
int munmap(void *, size_t);
#else
void * minix_mmap(void *, size_t, int, int, int, off_t);
void * minix_mmap_for(endpoint_t, void *, size_t, int, int, int, off_t);
int minix_munmap(void *, size_t);
int minix_munmap_text(void *, size_t);
void * vm_remap(int d, int s, void *da, void *sa, size_t si);