From 1640b2e125aeb40f59148d5da40e4d5ee4ba3c9f Mon Sep 17 00:00:00 2001 From: 0x35c Date: Wed, 9 Oct 2024 16:16:22 +0200 Subject: [PATCH] fix: no more looping on some weird input --- src/interrupt/handler.c | 7 +++++-- src/interrupt/idt.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/interrupt/handler.c b/src/interrupt/handler.c index 87c8e9c..1f17e9c 100644 --- a/src/interrupt/handler.c +++ b/src/interrupt/handler.c @@ -53,9 +53,12 @@ void irq_handler(void) int8_t index = -1; __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; } + if (index == 0) + return; kpanic("%d\n", index); } diff --git a/src/interrupt/idt.c b/src/interrupt/idt.c index e8c6f74..f34954a 100644 --- a/src/interrupt/idt.c +++ b/src/interrupt/idt.c @@ -45,5 +45,5 @@ void init_idt(void) for (uint8_t j = 0; j < 16; j++) idt_set_descriptor(i + j, irq_stub_table[j], 0x8E); load_idt(&idtr); - asm volatile("sti"); + __asm__ volatile("sti"); }