aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-03-25 16:39:13 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-03-27 07:02:35 +0100
commita82416648d148152338dc612c25bf8dff428e773 (patch)
treeb4953e734ce8d28babd4c3905fcd988b09d52d1b /arch/x86_64/src
parentfd1c5a50bb35f772b8e37125188640447d4b3b2a (diff)
downloadteachos-a82416648d148152338dc612c25bf8dff428e773.tar.xz
teachos-a82416648d148152338dc612c25bf8dff428e773.zip
kapi: introduce cpu::interrupt_handler
Diffstat (limited to 'arch/x86_64/src')
-rw-r--r--arch/x86_64/src/cpu/interrupts.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/arch/x86_64/src/cpu/interrupts.cpp b/arch/x86_64/src/cpu/interrupts.cpp
index e578aa2..1f65336 100644
--- a/arch/x86_64/src/cpu/interrupts.cpp
+++ b/arch/x86_64/src/cpu/interrupts.cpp
@@ -46,7 +46,6 @@ namespace arch::cpu
constexpr auto pic_master_irq_start = 0x20;
constexpr auto pic_master_irq_end = pic_master_irq_start + 8;
constexpr auto pic_slave_irq_start = pic_master_irq_end;
- constexpr auto pic_slave_irq_end = pic_slave_irq_start + 8;
constexpr auto to_exception_type(exception e)
{
@@ -96,10 +95,8 @@ namespace arch::cpu
}
}
- auto handle_legacy_interrupt(interrupt_frame * frame) -> void
+ auto acknowledge_pic_interrupt(interrupt_frame * frame) -> void
{
- kstd::println("[x86_64:SYS] Ignoring 8259 legacy interrupt {:#04x}", frame->interrupt.number);
-
if (frame->interrupt.number >= pic_slave_irq_start)
{
pic_slave_control_port::write(pic_end_of_interrupt);
@@ -120,19 +117,13 @@ namespace arch::cpu
{
kstd::println(kstd::print_sink::stderr,
"[x86_64:CPU] Unhandled exception number {:#04x} received with code {:#04x}", number, code);
- kapi::cpu::halt();
}
-
- if ((number >= pic_master_irq_start && number < pic_master_irq_end) ||
- (number >= pic_slave_irq_start && number < pic_slave_irq_end))
+ else if (number >= pic_master_irq_start && kapi::cpu::dispatch_interrupt(number) == kapi::cpu::status::unhandled)
{
- handle_legacy_interrupt(frame);
- return;
+ kstd::println(kstd::print_sink::stderr, "[x86_64:CPU] Unhandled interrupt {:#04x}", number);
}
- kstd::println(kstd::print_sink::stderr, "[x86_64:CPU] Unhandled interrupt {:#04x} received with code {:#04x}",
- frame->interrupt.number, frame->interrupt.error_code);
- kapi::cpu::halt();
+ acknowledge_pic_interrupt(frame);
}
}