# HG changeset patch # User Akshat Kumar # Date 1326835804 28800 # Node ID 8d84f339223733993701709da97178a91b0fdd3b # Parent 4725d6a2b123175c157a55cde6444b6323099d98 trap: enable handling of unknown interrupts Fixes an off-by-one error and allows unknown interrupts to pass through (taken from Plan 9). The latter was required to boot nix on my computer, since it was receiving a spurious interrupts 0x27. R=nix-dev CC=nix-dev, noah.evans http://codereview.appspot.com/5543053 Committer: John Floren diff -r 4725d6a2b123 -r 8d84f3392237 sys/src/nix/k10/trap.c --- a/sys/src/nix/k10/trap.c Tue Jan 17 13:29:39 2012 -0800 +++ b/sys/src/nix/k10/trap.c Tue Jan 17 13:30:04 2012 -0800 @@ -359,11 +359,31 @@ preempted(); } } - else if(vno <= nelem(excname) && user){ + else if(vno < nelem(excname) && user){ spllo(); sprint(buf, "sys: trap: %s", excname[vno]); postnote(up, 1, buf, NDebug); } + else if(vno >= VectorPIC && vno != VectorSYSCALL){ + /* + * An unknown interrupt. + * Check for a default IRQ7. This can happen when + * the IRQ input goes away before the acknowledge. + * In this case, a 'default IRQ7' is generated, but + * the corresponding bit in the ISR isn't set. + * In fact, just ignore all such interrupts. + */ + + /* clear the interrupt */ + i8259isr(vno); + + iprint("cpu%d: spurious interrupt %d, last %d\n", + m->machno, vno, m->lastintr); + + if(user) + kexit(ureg); + return; + } else{ if(vno == VectorNMI){ nmienable();