summaryrefslogtreecommitdiff
path: root/trap.c
diff options
context:
space:
mode:
authorrtm <rtm>2006-08-08 19:58:06 +0000
committerrtm <rtm>2006-08-08 19:58:06 +0000
commit0e84a0ec6e7893dad13dff9a958c5bc987b79c82 (patch)
tree5739d0a2af8277db7a47c74e52975d9e9d81cef7 /trap.c
parente8d11c2e846ad15b32caacc8a919722b76d00f79 (diff)
downloadxv6-labs-0e84a0ec6e7893dad13dff9a958c5bc987b79c82.tar.gz
xv6-labs-0e84a0ec6e7893dad13dff9a958c5bc987b79c82.tar.bz2
xv6-labs-0e84a0ec6e7893dad13dff9a958c5bc987b79c82.zip
fix race in holding() check in acquire()
give cpu1 a TSS and gdt for when it enters scheduler() and a pseudo proc[] entry for each cpu cpu0 waits for each other cpu to start up read() for files
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;
}