summaryrefslogtreecommitdiff
path: root/kc/core/pic8259.c
diff options
context:
space:
mode:
Diffstat (limited to 'kc/core/pic8259.c')
-rw-r--r--kc/core/pic8259.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/kc/core/pic8259.c b/kc/core/pic8259.c
index f449e38..b1de903 100644
--- a/kc/core/pic8259.c
+++ b/kc/core/pic8259.c
@@ -21,11 +21,18 @@
#define OCW3_READ_ISR 0xb
#define OCW3_EOI 0x20
-typedef int (*pic8259_handler_func)(uint8_t irq);
-
pic8259_handler_func irq_handlers[PIC_ISR_COUNT];
-__attribute__((optimize("O3")))
+void pic8259_irq_install(uint8_t irq, pic8259_handler_func h)
+{
+ if (irq_handlers[irq])
+ {
+ kprintf("attempt to overwrite irq handler for %u\n", irq);
+ return;
+ }
+ irq_handlers[irq] = h;
+}
+
static void wait(void)
{
// stall for a few cycles