提交 aad8c084 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

soft page faults only when proc is not null

上级 21fb8c30
...@@ -47,13 +47,6 @@ trap(struct trapframe *tf) ...@@ -47,13 +47,6 @@ trap(struct trapframe *tf)
return; return;
} }
if(tf->trapno == T_PGFLT){
if(pagefault(proc->pgdir, proc->vmap, rcr2()) >= 0){
switchuvm(proc);
return;
}
}
switch(tf->trapno){ switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER: case T_IRQ0 + IRQ_TIMER:
if(cpu->id == 0){ if(cpu->id == 0){
...@@ -94,6 +87,14 @@ trap(struct trapframe *tf) ...@@ -94,6 +87,14 @@ trap(struct trapframe *tf)
tf->trapno, cpu->id, tf->eip, rcr2()); tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap"); panic("trap");
} }
if(tf->trapno == T_PGFLT){
if(pagefault(proc->pgdir, proc->vmap, rcr2()) >= 0){
switchuvm(proc);
return;
}
}
// In user space, assume process misbehaved. // In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d " cprintf("pid %d %s: trap %d err %d on cpu %d "
"eip 0x%x addr 0x%x--kill proc\n", "eip 0x%x addr 0x%x--kill proc\n",
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论