Newer
Older
extern uint vectors[]; // in vectors.S: array of 256 entry pointers
case T_IRQ0 + IRQ_TIMER:
if(cpu() == 0){
acquire(&tickslock);
ticks++;
wakeup(&ticks);
release(&tickslock);
case T_IRQ0 + IRQ_IDE:
case T_IRQ0 + IRQ_KBD:
case T_IRQ0 + IRQ_COM1:
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
cpu(), tf->cs, tf->eip);
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");
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;
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(cp && cp->killed && (tf->cs&3) == DPL_USER)
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(cp && cp->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
// Check if the process has been killed since we yielded
if(cp && cp->killed && (tf->cs&3) == DPL_USER)
exit();