summaryrefslogtreecommitdiff
path: root/trap.c
diff options
context:
space:
mode:
authorrsc <rsc>2007-09-26 23:32:00 +0000
committerrsc <rsc>2007-09-26 23:32:00 +0000
commitfbaa7b428e3292dec10781f5fa5c9a3eae982426 (patch)
tree80fd80d8ece24c2319c30b4dbf4d9a91327d2bb6 /trap.c
parent56c1a151d2e3e0d10bf1b7c69e64fcdf35cc1f61 (diff)
downloadxv6-labs-fbaa7b428e3292dec10781f5fa5c9a3eae982426.tar.gz
xv6-labs-fbaa7b428e3292dec10781f5fa5c9a3eae982426.tar.bz2
xv6-labs-fbaa7b428e3292dec10781f5fa5c9a3eae982426.zip
various comment and print tweaks
Diffstat (limited to 'trap.c')
-rw-r--r--trap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/trap.c b/trap.c
index 72678a6..f6a6ce6 100644
--- a/trap.c
+++ b/trap.c
@@ -44,8 +44,7 @@ trap(struct trapframe *tf)
return;
}
- // Increment nlock to make sure interrupts stay off
- // during interrupt handler. Decrement before returning.
+ // Make sure interrupts stay off during handler.
cpus[cpu()].nlock++;
switch(tf->trapno){
@@ -67,22 +66,24 @@ trap(struct trapframe *tf)
lapic_eoi();
break;
case IRQ_OFFSET + IRQ_SPURIOUS:
- cprintf("spurious interrupt from cpu %d eip %x\n", cpu(), tf->eip);
+ cprintf("cpu%d: spurious interrupt at %x:%x\n",
+ cpu(), tf->cs, tf->eip);
lapic_eoi();
break;
default:
- if(cp == 0 || (tf->cs & 3) == 0){
- // Otherwise it's our mistake.
+ if(cp == 0 || (tf->cs&3) == 0){
+ // In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x\n",
tf->trapno, cpu(), tf->eip);
panic("trap");
}
- // Assume process divided by zero or dereferenced null, etc.
+ // In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d eip %x -- kill proc\n",
cp->pid, cp->name, tf->trapno, tf->err, cpu(), tf->eip);
cp->killed = 1;
}
+
cpus[cpu()].nlock--;
// Force process exit if it has been killed and is in user space.