diff options
Diffstat (limited to 'src/drivers/interrupts.c')
-rw-r--r-- | src/drivers/interrupts.c | 64 |
1 files changed, 58 insertions, 6 deletions
diff --git a/src/drivers/interrupts.c b/src/drivers/interrupts.c index bd20911..e3e8699 100644 --- a/src/drivers/interrupts.c +++ b/src/drivers/interrupts.c @@ -1,4 +1,5 @@ // MIT License, Copyright (c) 2020 Marvin Borner +// TODO: Remove some magic numbers #include <cpu.h> #include <def.h> @@ -68,7 +69,7 @@ void irq_remap() } // Handle IRQ ISRs -__attribute__((interrupt)) void irq_handler(struct regs *r) +void irq_handler(struct regs *r) { __asm__("cli"); void (*handler)(struct regs * r); @@ -91,8 +92,24 @@ __attribute__((interrupt)) void irq_handler(struct regs *r) void irq_install() { irq_remap(); - for (int i = 32; i < 48; i++) - idt_set_gate(i, (u32)irq_handler, 0x08, 0x8E); + + idt_set_gate(32, (u32)irq0, 0x08, 0x8E); + idt_set_gate(33, (u32)irq1, 0x08, 0x8E); + idt_set_gate(34, (u32)irq2, 0x08, 0x8E); + idt_set_gate(35, (u32)irq3, 0x08, 0x8E); + idt_set_gate(36, (u32)irq4, 0x08, 0x8E); + idt_set_gate(37, (u32)irq5, 0x08, 0x8E); + idt_set_gate(38, (u32)irq6, 0x08, 0x8E); + idt_set_gate(39, (u32)irq7, 0x08, 0x8E); + + idt_set_gate(40, (u32)irq8, 0x08, 0x8E); + idt_set_gate(41, (u32)irq9, 0x08, 0x8E); + idt_set_gate(42, (u32)irq10, 0x08, 0x8E); + idt_set_gate(43, (u32)irq11, 0x08, 0x8E); + idt_set_gate(44, (u32)irq12, 0x08, 0x8E); + idt_set_gate(45, (u32)irq13, 0x08, 0x8E); + idt_set_gate(46, (u32)irq14, 0x08, 0x8E); + idt_set_gate(47, (u32)irq15, 0x08, 0x8E); } /** @@ -111,7 +128,7 @@ void isr_uninstall_handler(int isr) isr_routines[isr] = 0; } -__attribute__((interrupt)) void isr_handler(struct regs *r) +void isr_handler(struct regs *r) { __asm__("cli"); void (*handler)(struct regs * r); @@ -131,8 +148,43 @@ __attribute__((interrupt)) void isr_handler(struct regs *r) void isr_install() { - for (int i = 0; i < 32; i++) - idt_set_gate(i, (u32)isr_handler, 0x08, 0x8E); + idt_set_gate(0, (u32)isr0, 0x08, 0x8E); + idt_set_gate(1, (u32)isr1, 0x08, 0x8E); + idt_set_gate(2, (u32)isr2, 0x08, 0x8E); + idt_set_gate(3, (u32)isr3, 0x08, 0x8E); + idt_set_gate(4, (u32)isr4, 0x08, 0x8E); + idt_set_gate(5, (u32)isr5, 0x08, 0x8E); + idt_set_gate(6, (u32)isr6, 0x08, 0x8E); + idt_set_gate(7, (u32)isr7, 0x08, 0x8E); + + idt_set_gate(8, (u32)isr8, 0x08, 0x8E); + idt_set_gate(9, (u32)isr9, 0x08, 0x8E); + idt_set_gate(10, (u32)isr10, 0x08, 0x8E); + idt_set_gate(11, (u32)isr11, 0x08, 0x8E); + idt_set_gate(12, (u32)isr12, 0x08, 0x8E); + idt_set_gate(13, (u32)isr13, 0x08, 0x8E); + idt_set_gate(14, (u32)isr14, 0x08, 0x8E); + idt_set_gate(15, (u32)isr15, 0x08, 0x8E); + + idt_set_gate(16, (u32)isr16, 0x08, 0x8E); + idt_set_gate(17, (u32)isr17, 0x08, 0x8E); + idt_set_gate(18, (u32)isr18, 0x08, 0x8E); + idt_set_gate(19, (u32)isr19, 0x08, 0x8E); + idt_set_gate(20, (u32)isr20, 0x08, 0x8E); + idt_set_gate(21, (u32)isr21, 0x08, 0x8E); + idt_set_gate(22, (u32)isr22, 0x08, 0x8E); + idt_set_gate(23, (u32)isr23, 0x08, 0x8E); + + idt_set_gate(24, (u32)isr24, 0x08, 0x8E); + idt_set_gate(25, (u32)isr25, 0x08, 0x8E); + idt_set_gate(26, (u32)isr26, 0x08, 0x8E); + idt_set_gate(27, (u32)isr27, 0x08, 0x8E); + idt_set_gate(28, (u32)isr28, 0x08, 0x8E); + idt_set_gate(29, (u32)isr29, 0x08, 0x8E); + idt_set_gate(30, (u32)isr30, 0x08, 0x8E); + idt_set_gate(31, (u32)isr31, 0x08, 0x8E); + + idt_set_gate(0x80, (u32)isr128, 0x08, 0x8E); } /** |