diff options
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -145,7 +145,7 @@ growproc(int n) if (!allocuvm(proc->pgdir, (char *)proc->sz, n)) return -1; proc->sz += n; - loadvm(proc); + switchuvm(proc); return 0; } @@ -214,9 +214,10 @@ scheduler(void) // to release ptable.lock and then reacquire it // before jumping back to us. proc = p; - loadvm(p); + switchuvm(p); p->state = RUNNING; swtch(&cpu->scheduler, proc->context); + switchkvm(); // Process is done running for now. // It should have changed its p->state before coming back. @@ -242,7 +243,6 @@ sched(void) panic("sched running"); if(readeflags()&FL_IF) panic("sched interruptible"); - lcr3(PADDR(kpgdir)); // Switch to the kernel page table intena = cpu->intena; swtch(&proc->context, cpu->scheduler); cpu->intena = intena; @@ -414,8 +414,8 @@ wait(void) // Found one. pid = p->pid; kfree(p->kstack, KSTACKSIZE); - p->kstack = 0; - freevm(p->pgdir); + p->kstack = 0; + freevm(p->pgdir); p->state = UNUSED; p->pid = 0; p->parent = 0; |