diff --git a/initcode.S b/initcode.S index 109341a..80ac5d8 100644 --- a/initcode.S +++ b/initcode.S @@ -1,4 +1,5 @@ # Initial process execs /init. +# This code runs in user space. #include "syscall.h" #include "traps.h" diff --git a/proc.c b/proc.c index 3ac41f6..b6dd11f 100644 --- a/proc.c +++ b/proc.c @@ -283,7 +283,7 @@ scheduler(void) proc = p; switchuvm(p); p->state = RUNNING; - swtch(&cpu->scheduler, proc->context); + swtch(&cpu->scheduler, p->context); switchkvm(); // Process is done running for now. diff --git a/vm.c b/vm.c index cd36db5..dfc5b3c 100644 --- a/vm.c +++ b/vm.c @@ -171,7 +171,7 @@ switchuvm(struct proc *p) ltr(SEG_TSS << 3); if(p->pgdir == 0) panic("switchuvm: no pgdir"); - lcr3(v2p(p->pgdir)); // switch to new address space + lcr3(v2p(p->pgdir)); // switch to process's address space popcli(); }