kernel/vm: change pde table info from single buffer to explicit per-process.
[minix.git] / kernel / arch / i386 / arch_do_vmctl.c
bloba1be5e39d85732b43296824b1d831d2931bd932a
1 /* The kernel call implemented in this file:
2 * m_type: SYS_VMCTL
4 * The parameters for this kernel call are:
5 * SVMCTL_WHO which process
6 * SVMCTL_PARAM set this setting (VMCTL_*)
7 * SVMCTL_VALUE to this value
8 */
10 #include "kernel/system.h"
11 #include <minix/type.h>
13 #include "proto.h"
15 /*===========================================================================*
16 * arch_do_vmctl *
17 *===========================================================================*/
18 PUBLIC int arch_do_vmctl(m_ptr, p)
19 register message *m_ptr; /* pointer to request message */
20 struct proc *p;
22 switch(m_ptr->SVMCTL_PARAM) {
23 case VMCTL_I386_GETCR3:
24 /* Get process CR3. */
25 m_ptr->SVMCTL_VALUE = p->p_seg.p_cr3;
26 return OK;
27 case VMCTL_SETADDRSPACE:
28 /* Set process CR3. */
29 if(m_ptr->SVMCTL_PTROOT) {
30 p->p_seg.p_cr3 = m_ptr->SVMCTL_PTROOT;
31 p->p_seg.p_cr3_v = (u32_t *) m_ptr->SVMCTL_PTROOT_V;
32 p->p_misc_flags |= MF_FULLVM;
33 } else {
34 p->p_seg.p_cr3 = 0;
35 p->p_seg.p_cr3_v = NULL;
36 p->p_misc_flags &= ~MF_FULLVM;
38 RTS_UNSET(p, RTS_VMINHIBIT);
39 return OK;
40 case VMCTL_INCSP:
41 /* Increase process SP. */
42 p->p_reg.sp += m_ptr->SVMCTL_VALUE;
43 return OK;
44 case VMCTL_I386_KERNELLIMIT:
46 int r;
47 /* VM wants kernel to increase its segment. */
48 r = prot_set_kern_seg_limit(m_ptr->SVMCTL_VALUE);
49 return r;
51 case VMCTL_I386_FREEPDE:
53 i386_freepde(m_ptr->SVMCTL_VALUE);
54 return OK;
56 case VMCTL_FLUSHTLB:
58 reload_cr3();
59 return OK;
65 printf("arch_do_vmctl: strange param %d\n", m_ptr->SVMCTL_PARAM);
66 return EINVAL;