PRIVATE int psok = 0;
-#define FREE_PDES_PER_CPU 3
+#define FREE_PDES_PER_CPU 2
#define MAX_FREEPDES (FREE_PDES_PER_CPU * CONFIG_MAX_CPUS)
PRIVATE int nfreepdes = 0, freepdes[MAX_FREEPDES];
proc_nr_t procslot;
assert(vm_running);
- assert(nfreepdes >= 3);
+ assert(nfreepdes >= 2);
assert(get_cpulocal_var(ptproc));
assert(get_cpulocal_var(proc_ptr));
return OK;
}
- assert(nfreepdes >= 3);
+ assert(nfreepdes >= 2);
assert(get_cpulocal_var(ptproc)->p_seg.p_cr3_v);
#include "memory.h"
+/* Free PDE slots we tell kernel about */
+#define FREE_PDES 2
+PRIVATE int first_free_pde = -1;
+
/* PDE used to map in kernel, kernel physical address. */
PRIVATE int id_map_high_pde = -1, pagedir_pde = -1;
PRIVATE u32_t global_bit = 0, pagedir_pde_val;
return OK;
}
+PUBLIC int pt_clearmapcache(void)
+{
+ int f;
+ /* Make sure kernel will invalidate tlb when using current
+ * pagetable (i.e. vm's) to make new mappings before new cr3
+ * is loaded.
+ */
+ for(f = first_free_pde; f < first_free_pde+FREE_PDES; f++) {
+ vmprocess->vm_pt.pt_dir[f] = 0;
+ }
+}
+
/*===========================================================================*
* pt_writemap *
*===========================================================================*/
vir_bytes sparepages_mem;
phys_bytes sparepages_ph;
vir_bytes ptr;
+ int f = 0;
/* Shorthand. */
newpt = &vmprocess->vm_pt;
I386_VM_PRESENT | I386_VM_USER | I386_VM_WRITE;
/* Tell kernel about free pde's. */
- while(free_pde*I386_BIG_PAGE_SIZE < VM_PROCSTART) {
+ first_free_pde = free_pde;
+ while(free_pde*I386_BIG_PAGE_SIZE < VM_PROCSTART && f < FREE_PDES) {
if((r=sys_vmctl(SELF, VMCTL_I386_FREEPDE, free_pde++)) != OK) {
panic("VMCTL_I386_FREEPDE failed: %d", r);
}
+ f++;
}
/* first pde in use by process. */
"message!\n", msg.m_source);
}
do_pagefaults(&msg);
+ pt_clearmapcache();
/*
* do not reply to this call, the caller is unblocked by
* a sys_vmctl() call in do_pagefaults if success. VM panics
if(missing_spares > 0) {
pt_cycle(); /* pagetable code wants to be called */
}
+
+ pt_clearmapcache();
}
/*===========================================================================*