提交 72fef4f8 创建 作者: rsc's avatar rsc

Don't kill process when inside kernel.

上级 4ed974f5
...@@ -70,11 +70,18 @@ trap(struct Trapframe *tf) ...@@ -70,11 +70,18 @@ trap(struct Trapframe *tf)
lapic_timerintr(); lapic_timerintr();
if(cpus[cpu()].nlock) if(cpus[cpu()].nlock)
panic("timer interrupt while holding a lock"); panic("timer interrupt while holding a lock");
if((read_eflags() & FL_IF) == 0)
panic("timer interrupt but interrupts now disabled");
if(cp){ if(cp){
if((read_eflags() & FL_IF) == 0) // Force process exit if it has been killed
panic("timer interrupt but interrupts now disabled"); // and the interrupt came from user space.
if(cp->killed) // (If the kernel was executing at time of interrupt,
// don't kill the process. Let the process get back
// out to its regular system call return.)
if((tf->tf_cs&3) == 3 && cp->killed)
proc_exit(); proc_exit();
// Force process to give up CPU and let others run.
if(cp->state == RUNNING) if(cp->state == RUNNING)
yield(); yield();
} }
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论