X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fintr.c;h=a9bd5f1f772bb760af355be90d46e1a4c530e816;hb=a6507838a569762ec92493bfcb422e7dbc2cfae9;hp=1ace71e53b19317dd330faea96705559774762d4;hpb=a2f94f569a4c99204de02814a20098a71527e913;p=bootcensus diff --git a/src/intr.c b/src/intr.c index 1ace71e..a9bd5f1 100644 --- a/src/intr.c +++ b/src/intr.c @@ -1,3 +1,20 @@ +/* +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 . +*/ #include #include "intr.h" #include "desc.h" @@ -43,6 +60,8 @@ static void gate_desc(desc_t *desc, uint16_t sel, uint32_t addr, int dpl, int ty /* defined in intr_asm.S */ void set_idt(uint32_t addr, uint16_t limit); void intr_entry_default(void); +void irq7_entry_check_spurious(void); +void irq15_entry_check_spurious(void); /* the IDT (interrupt descriptor table) */ static desc_t idt[256] __attribute__((aligned(8))); @@ -73,6 +92,12 @@ void init_intr(void) */ #include "intrtab.h" + /* change irq7 and irq15 to special entry points which first + * make sure we didn't get a spurious interrupt before proceeding + */ + set_intr_entry(IRQ_TO_INTR(7), irq7_entry_check_spurious); + set_intr_entry(IRQ_TO_INTR(15), irq15_entry_check_spurious); + /* initialize the programmable interrupt controller * setting up the maping of IRQs [0, 15] to interrupts [32, 47] */