From 15ce79de141f66c7dd2f2948ce4584a2d31f7040 Mon Sep 17 00:00:00 2001
From: kolya <kolya>
Date: Wed, 15 Oct 2008 04:57:02 +0000
Subject: [PATCH] check cp->killed before returning to user from a timer
 interrupt

---
 trap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/trap.c b/trap.c
index 533f3f0..fd00071 100644
--- 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();
 }
-- 
GitLab