fix: irqs are handled correctly with regs->int_no (and the keyboard handler works)

This commit is contained in:
0x35c 2024-10-09 18:03:17 +02:00
parent 4fb51d4356
commit e5d7b80ed5
4 changed files with 6 additions and 8 deletions

View File

@ -1,8 +1,6 @@
#include "interrupts.h" #include "interrupts.h"
#include "kprintf.h"
void clock_handler(struct registers *regs) void clock_handler(struct registers *regs)
{ {
(void)regs; (void)regs;
kprintf("test\n");
} }

View File

@ -3,6 +3,6 @@
void load_drivers(void) void load_drivers(void)
{ {
register_interrupt_handler(1, keyboard_handler);
register_interrupt_handler(0, clock_handler); register_interrupt_handler(0, clock_handler);
register_interrupt_handler(1, keyboard_handler);
} }

View File

@ -50,7 +50,7 @@ void register_interrupt_handler(int i, isr_t handler)
void irq_handler(struct registers *regs) void irq_handler(struct registers *regs)
{ {
if (regs->int_no != 0) { if (regs->int_no != 0) {
isr_t handler = interrupt_handlers[regs->int_no]; isr_t handler = interrupt_handlers[regs->int_no - 32];
handler(regs); handler(regs);
} }
pic_send_eoi(regs->int_no); pic_send_eoi(regs->int_no);

View File

@ -28,8 +28,8 @@ void kernel_main(void)
init_gdt(); init_gdt();
init_idt(); init_idt();
init_memory(); init_memory();
/* load_drivers(); */ load_drivers();
/* while (42) */ while (42)
/* ; */ ;
shell_init(); /* shell_init(); */
} }