various comment and print tweaks

This commit is contained in:
rsc 2007-09-26 23:32:00 +00:00
parent 56c1a151d2
commit fbaa7b428e

13
trap.c
View file

@ -44,8 +44,7 @@ trap(struct trapframe *tf)
return; return;
} }
// Increment nlock to make sure interrupts stay off // Make sure interrupts stay off during handler.
// during interrupt handler. Decrement before returning.
cpus[cpu()].nlock++; cpus[cpu()].nlock++;
switch(tf->trapno){ switch(tf->trapno){
@ -67,22 +66,24 @@ trap(struct trapframe *tf)
lapic_eoi(); lapic_eoi();
break; break;
case IRQ_OFFSET + IRQ_SPURIOUS: 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(); lapic_eoi();
break; break;
default: default:
if(cp == 0 || (tf->cs & 3) == 0){ if(cp == 0 || (tf->cs&3) == 0){
// Otherwise it's our mistake. // In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x\n", cprintf("unexpected trap %d from cpu %d eip %x\n",
tf->trapno, cpu(), tf->eip); tf->trapno, cpu(), tf->eip);
panic("trap"); 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", 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->pid, cp->name, tf->trapno, tf->err, cpu(), tf->eip);
cp->killed = 1; cp->killed = 1;
} }
cpus[cpu()].nlock--; cpus[cpu()].nlock--;
// Force process exit if it has been killed and is in user space. // Force process exit if it has been killed and is in user space.