fix: no more looping on some weird input

This commit is contained in:
0x35c 2024-10-09 16:16:22 +02:00
parent f3db3060af
commit 1640b2e125
2 changed files with 6 additions and 3 deletions

View File

@ -53,9 +53,12 @@ void irq_handler(void)
int8_t index = -1; int8_t index = -1;
__asm__ volatile("movb %%bl, %0" ::"m"(index)); __asm__ volatile("movb %%bl, %0" ::"m"(index));
if (index == 0) {
pic_send_eoi(index); pic_send_eoi(index);
if (index == -1) {
kprintf(KERN_ERR "interrupt triggered without a code\n");
return; return;
} }
if (index == 0)
return;
kpanic("%d\n", index); kpanic("%d\n", index);
} }

View File

@ -45,5 +45,5 @@ void init_idt(void)
for (uint8_t j = 0; j < 16; j++) for (uint8_t j = 0; j < 16; j++)
idt_set_descriptor(i + j, irq_stub_table[j], 0x8E); idt_set_descriptor(i + j, irq_stub_table[j], 0x8E);
load_idt(&idtr); load_idt(&idtr);
asm volatile("sti"); __asm__ volatile("sti");
} }