diff options
Diffstat (limited to 'src/kernel/interrupts/interrupts.h')
-rw-r--r-- | src/kernel/interrupts/interrupts.h | 95 |
1 files changed, 89 insertions, 6 deletions
diff --git a/src/kernel/interrupts/interrupts.h b/src/kernel/interrupts/interrupts.h index cb30492..10612c0 100644 --- a/src/kernel/interrupts/interrupts.h +++ b/src/kernel/interrupts/interrupts.h @@ -2,6 +2,7 @@ #define MELVIX_INTERRUPTS_H #include <stdint.h> +#include <stddef.h> /** * Initialize the Interrupt Descriptor Table with 256 entries @@ -18,11 +19,6 @@ void idt_install(); void idt_set_gate(unsigned char num, unsigned long base, unsigned short sel, unsigned char flags); /** - * Install 32 exception ISRs into the IDT - */ -void isrs_install(); - -/** * Registers that get passed into an IRQ handler */ struct regs { @@ -33,6 +29,26 @@ struct regs { }; /** + * Install 32 exception ISRs into the IDT + */ +void isrs_install(); + +/** + * Add a new Interrupt Request Handler + * @param irq The index of the IRQ routine + * @param handler The interrupt handler function + */ +typedef void (*irq_handler_t)(struct regs *); + +void isr_install_handler(size_t isr, irq_handler_t handler); + +/** + * Uninstall a handler by index + * @param irq The index of the IRQ routine that should be removed + */ +void isr_uninstall_handler(size_t isr); + +/** * Initialize the Interrupt Requests by mapping the ISRs to the correct * entries in the IDT (install the exception handlers) */ @@ -64,4 +80,71 @@ void irq_handler(struct regs *r); */ int irq_is_installed(int irq); -#endif +// Defined in isr.asm +extern void isr0(); + +extern void isr1(); + +extern void isr2(); + +extern void isr3(); + +extern void isr4(); + +extern void isr5(); + +extern void isr6(); + +extern void isr7(); + +extern void isr8(); + +extern void isr9(); + +extern void isr10(); + +extern void isr11(); + +extern void isr12(); + +extern void isr13(); + +extern void isr14(); + +extern void isr15(); + +extern void isr16(); + +extern void isr17(); + +extern void isr18(); + +extern void isr19(); + +extern void isr20(); + +extern void isr21(); + +extern void isr22(); + +extern void isr23(); + +extern void isr24(); + +extern void isr25(); + +extern void isr26(); + +extern void isr27(); + +extern void isr28(); + +extern void isr29(); + +extern void isr30(); + +extern void isr31(); + +extern void isr128(); + +#endif
\ No newline at end of file |