Handle spurious interrupts

This commit is contained in:
Gitea 2021-01-03 21:33:10 -06:00
parent 1747d88ff3
commit 125a613de1

View file

@ -222,6 +222,8 @@ void irq6_handler(void) {
/* LPT1 (Parallel Port)/Primary PIC Spurious Interrupts */ /* LPT1 (Parallel Port)/Primary PIC Spurious Interrupts */
void irq7_handler(void) { void irq7_handler(void) {
outb(0x20, 0x0b);
if(inb(0x20) & 0x80) { return; } /* Spurious interrupt */
outb(0x20, 0x20); /* Don't send this for spurious interrupts */ outb(0x20, 0x20); /* Don't send this for spurious interrupts */
} }
@ -269,6 +271,10 @@ void irq14_handler(void) {
/* Secondary ATA Hard Drive/Secondary PIC Spurious Interrupt */ /* Secondary ATA Hard Drive/Secondary PIC Spurious Interrupt */
void irq15_handler(void) { void irq15_handler(void) {
outb(0xA0, 0x0b);
if(!(inb(0xA0) & 0x80)) {
/* Not spurious. Do stuff here! */
outb(0xA0, 0x20); outb(0xA0, 0x20);
}
outb(0x20, 0x20); outb(0x20, 0x20);
} }