Fix for not having a cr3 loaded at all times
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 23 Feb 2011 23:03:25 +0000 (15:03 -0800)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:58 +0000 (17:35 -0700)
If you were in _M mode and sent and event from a core with no proc
current, you'd end up with the old proc's cr3 loaded.

kern/src/event.c

index da08eae..a39efc5 100644 (file)
@@ -14,6 +14,7 @@
 #include <umem.h>
 #include <stdio.h>
 #include <assert.h>
+#include <pmap.h>
 
 /* Note this returns the KVA of the mbox, not the user one. */
 static struct event_mbox *get_proc_ev_mbox(struct proc *p, uint32_t vcoreid)
@@ -134,6 +135,8 @@ out:
                pcpui->cur_proc = old_proc;
                if (old_proc)
                        lcr3(old_proc->env_cr3);
+               else
+                       lcr3(boot_cr3);
        }
 }