From b548df152b5a53ea8cfcb2d94fbdee07884d8050 Mon Sep 17 00:00:00 2001 From: rtm Date: Tue, 11 Jul 2006 17:39:45 +0000 Subject: pre-empt both user and kernel, in clock interrupt usertest.c tests pre-emption kill() --- trap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'trap.c') diff --git a/trap.c b/trap.c index d177d04..d7739f7 100644 --- a/trap.c +++ b/trap.c @@ -45,6 +45,8 @@ trap(struct Trapframe *tf) struct proc *cp = curproc[cpu()]; if(cp == 0) panic("syscall with no proc"); + if(cp->killed) + proc_exit(); cp->tf = tf; syscall(); if(cp != curproc[cpu()]) @@ -55,11 +57,20 @@ trap(struct Trapframe *tf) panic("trap ret wrong tf"); if(read_esp() < (unsigned)cp->kstack || read_esp() >= (unsigned)cp->kstack + KSTACKSIZE) panic("trap ret esp wrong"); + if(cp->killed) + proc_exit(); return; } if(v == (IRQ_OFFSET + IRQ_TIMER)){ + struct proc *cp = curproc[cpu()]; lapic_timerintr(); + if(cp){ + sti(); + if(cp->killed) + proc_exit(); + yield(); + } return; } if(v == (IRQ_OFFSET + IRQ_IDE)){ -- cgit v1.2.3