]> Devi Nivas Git - cs3210-lab0.git/commitdiff
check cp->killed before returning to user from a timer interrupt
authorkolya <kolya>
Wed, 15 Oct 2008 04:57:02 +0000 (04:57 +0000)
committerkolya <kolya>
Wed, 15 Oct 2008 04:57:02 +0000 (04:57 +0000)
trap.c

diff --git a/trap.c b/trap.c
index 533f3f0a43eef4abe2a5e584679b262f52c5669a..fd000716b7b2400bfbc8173407c7e3d627e78ecb 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -91,4 +91,8 @@ trap(struct trapframe *tf)
   // If interrupts were on while locks held, would need to check nlock.
   if(cp && cp->state == RUNNING && tf->trapno == IRQ_OFFSET+IRQ_TIMER)
     yield();
+
+  // Check if the process has been killed since we yielded
+  if(cp && cp->killed && (tf->cs&3) == DPL_USER)
+    exit();
 }