aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-09-16 15:22:07 -0400
committerRaghuram Subramani <raghus2247@gmail.com>2025-09-16 15:23:32 -0400
commitb963213a51da1ae0dc995e26445d21250c7fea44 (patch)
tree90f2ffb26ad0f5dff59b97270d6668beda618aa5
parent9b52d6ba404a7daa7bffbeb37c65d3e2eacf7fac (diff)
interrupts: exception_handler should accept IRQ numberHEADmain
-rw-r--r--kernel/boot/interrupts/exceptions.cc4
-rw-r--r--kernel/boot/interrupts/isr.s2
-rw-r--r--kernel/include/boot/interrupts.h2
3 files changed, 6 insertions, 2 deletions
diff --git a/kernel/boot/interrupts/exceptions.cc b/kernel/boot/interrupts/exceptions.cc
index d05bd77..964d025 100644
--- a/kernel/boot/interrupts/exceptions.cc
+++ b/kernel/boot/interrupts/exceptions.cc
@@ -26,8 +26,10 @@ namespace Interrupts
{
void
-exception_handler(void)
+exception_handler(int irq_number)
{
+ printk("interrupts", "Interrupt: %d", irq_number);
+
ASSERT_NOT_REACHED();
while (true)
__asm__ volatile("cli; hlt");
diff --git a/kernel/boot/interrupts/isr.s b/kernel/boot/interrupts/isr.s
index 925bb27..9ffd94e 100644
--- a/kernel/boot/interrupts/isr.s
+++ b/kernel/boot/interrupts/isr.s
@@ -28,12 +28,14 @@ dd ISR_%+i
%macro ISR_WITH_ERROR 1
ISR_%+%1:
+ push %1
call exception_handler
iret
%endmacro
%macro ISR_NO_ERROR 1
ISR_%+%1:
+ push %1
call exception_handler
iret
%endmacro
diff --git a/kernel/include/boot/interrupts.h b/kernel/include/boot/interrupts.h
index 2bd4493..4df66e9 100644
--- a/kernel/include/boot/interrupts.h
+++ b/kernel/include/boot/interrupts.h
@@ -67,7 +67,7 @@ void disable(void);
void load_idt(void);
bool idt_loaded(void);
-extern "C" NORETURN void exception_handler(void);
+extern "C" NORETURN void exception_handler(int irq_number);
}