X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fintr_asm.S;h=8434a8fa683214515bdb30d767b455a94bd065b7;hb=6e968b9e724d9626ed6bdf2119ac7de6a5248f14;hp=ea0be36d1561b53a3f6a32bce77371b065d782b1;hpb=a2f94f569a4c99204de02814a20098a71527e913;p=bootcensus diff --git a/src/intr_asm.S b/src/intr_asm.S index ea0be36..8434a8f 100644 --- a/src/intr_asm.S +++ b/src/intr_asm.S @@ -1,3 +1,19 @@ +# pcboot - bootable PC demo/game kernel +# Copyright (C) 2018 John Tsiombikas +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + .data .align 4 .short 0 @@ -88,7 +104,42 @@ intr_entry_fast_timer: out %al, $0x20 pop %eax iret - + +/* special case for IRQ 7 and IRQ 15, to catch spurious interrupts */ + .set PIC1_CMD, 0x20 + .set PIC2_CMD, 0xa0 + .set OCW2_EOI, 0x20 + .set OCW3_ISR, 0x0b + + .extern intr_entry_irq7 + .global irq7_entry_check_spurious +irq7_entry_check_spurious: + push %eax + mov $OCW3_ISR, %al + out %al, $PIC1_CMD + in $PIC1_CMD, %al + and $0x80, %al + pop %eax + jnz intr_entry_irq7 + iret + + .extern intr_entry_irq15 + .global irq15_entry_check_spurious +irq15_entry_check_spurious: + push %eax + mov $OCW3_ISR, %al + out %al, $PIC2_CMD + in $PIC2_CMD, %al + and $0x80, %al + jnz 0f + # it was spurious, send EOI to master PIC and iret + mov $OCW2_EOI, %al + out %al, $PIC1_CMD + pop %eax + iret +0: pop %eax + jmp intr_entry_irq15 + /* XXX not necessary for now, just leaving it in in case it's useful * down the road.