summaryrefslogtreecommitdiff
path: root/trap.c
diff options
context:
space:
mode:
Diffstat (limited to 'trap.c')
-rw-r--r--trap.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/trap.c b/trap.c
index ccbc754..7031223 100644
--- a/trap.c
+++ b/trap.c
@@ -34,6 +34,14 @@ void
trap(struct trapframe *tf)
{
int v = tf->trapno;
+
+ if(cpus[cpu()].nlock){
+ cprintf("trap v %d eip %x cpu %d nlock %d\n",
+ v, tf->eip, cpu(), cpus[cpu()].nlock);
+ panic("interrupt while holding a lock");
+ }
+ if((read_eflags() & FL_IF) == 0)
+ panic("interrupt but interrupts now disabled");
if(v == T_SYSCALL){
struct proc *cp = curproc[cpu()];
@@ -61,16 +69,13 @@ trap(struct trapframe *tf)
panic("trap ret esp wrong");
if(cp->killed)
proc_exit();
+ // XXX probably ought to lgdt on trap return
return;
}
if(v == (IRQ_OFFSET + IRQ_TIMER)){
struct proc *cp = curproc[cpu()];
lapic_timerintr();
- if(cpus[cpu()].nlock)
- panic("timer interrupt while holding a lock");
- if((read_eflags() & FL_IF) == 0)
- panic("timer interrupt but interrupts now disabled");
if(cp){
// Force process exit if it has been killed
// and the interrupt came from user space.
@@ -92,8 +97,5 @@ trap(struct trapframe *tf)
return;
}
-
- // XXX probably ought to lgdt on trap return
-
return;
}