diff options
author | rtm <rtm> | 2006-07-11 17:39:45 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-07-11 17:39:45 +0000 |
commit | b548df152b5a53ea8cfcb2d94fbdee07884d8050 (patch) | |
tree | b1eec270a0892fad7a256ae809ebedbbcfaeb720 /trap.c | |
parent | 5ce9751cab960e3b226eb0720e781e793a0be4ed (diff) | |
download | xv6-labs-b548df152b5a53ea8cfcb2d94fbdee07884d8050.tar.gz xv6-labs-b548df152b5a53ea8cfcb2d94fbdee07884d8050.tar.bz2 xv6-labs-b548df152b5a53ea8cfcb2d94fbdee07884d8050.zip |
pre-empt both user and kernel, in clock interrupt
usertest.c tests pre-emption
kill()
Diffstat (limited to 'trap.c')
-rw-r--r-- | trap.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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)){ |