4 #include <minix/callnr.h>
6 #include <minix/config.h>
7 #include <minix/const.h>
9 #include <minix/endpoint.h>
10 #include <minix/keymap.h>
11 #include <minix/minlib.h>
12 #include <minix/type.h>
13 #include <minix/ipc.h>
14 #include <minix/sysutil.h>
15 #include <minix/syslib.h>
16 #include <minix/bitmap.h>
25 #include "sanitycheck.h"
27 void free_proc(struct vmproc
*vmp
)
31 region_init(&vmp
->vm_regions_avl
);
32 vmp
->vm_region_top
= 0;
34 vmp
->vm_bytecopies
= 0;
38 void clear_proc(struct vmproc
*vmp
)
40 region_init(&vmp
->vm_regions_avl
);
41 vmp
->vm_region_top
= 0;
42 vmp
->vm_callback
= NULL
; /* No pending vfs callback. */
43 vmp
->vm_flags
= 0; /* Clear INUSE, so slot is free. */
46 vmp
->vm_bytecopies
= 0;
50 /*===========================================================================*
52 *===========================================================================*/
53 int do_exit(message
*msg
)
58 SANITYCHECK(SCL_FUNCTIONS
);
60 if(vm_isokendpt(msg
->VME_ENDPOINT
, &proc
) != OK
) {
61 printf("VM: bogus endpoint VM_EXIT %d\n", msg
->VME_ENDPOINT
);
65 if(!(vmp
->vm_flags
& VMF_EXITING
)) {
66 printf("VM: unannounced VM_EXIT %d\n", msg
->VME_ENDPOINT
);
71 /* Free pagetable and pages allocated by pt code. */
72 SANITYCHECK(SCL_DETAIL
);
74 SANITYCHECK(SCL_DETAIL
);
76 SANITYCHECK(SCL_DETAIL
);
78 /* Reset process slot fields. */
81 SANITYCHECK(SCL_FUNCTIONS
);
85 /*===========================================================================*
87 *===========================================================================*/
88 int do_willexit(message
*msg
)
93 if(vm_isokendpt(msg
->VMWE_ENDPOINT
, &proc
) != OK
) {
94 printf("VM: bogus endpoint VM_EXITING %d\n",
100 vmp
->vm_flags
|= VMF_EXITING
;
105 int do_procctl(message
*msg
)
110 if(vm_isokendpt(msg
->VMPCTL_WHO
, &proc
) != OK
) {
111 printf("VM: bogus endpoint VM_PROCCTL %d\n",
117 switch(msg
->VMPCTL_PARAM
) {
119 if(msg
->m_source
!= RS_PROC_NR
120 && msg
->m_source
!= VFS_PROC_NR
)
124 pt_bind(&vmp
->vm_pt
, vmp
);