diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-03-26 16:47:41 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-03-27 07:02:35 +0100 |
| commit | f4dc64976049761a6f56dd55d9d0b651f1e9475f (patch) | |
| tree | 87bbed7943f2f90505b68be5acc58f423a508ef8 /arch/x86_64/kapi | |
| parent | 00a77644192642e06462c11479a5c0e9bd859e9a (diff) | |
| download | teachos-f4dc64976049761a6f56dd55d9d0b651f1e9475f.tar.xz teachos-f4dc64976049761a6f56dd55d9d0b651f1e9475f.zip | |
kapi: move interrupt handling to kernel
Diffstat (limited to 'arch/x86_64/kapi')
| -rw-r--r-- | arch/x86_64/kapi/interrupts.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/arch/x86_64/kapi/interrupts.cpp b/arch/x86_64/kapi/interrupts.cpp index babc926..cf1defa 100644 --- a/arch/x86_64/kapi/interrupts.cpp +++ b/arch/x86_64/kapi/interrupts.cpp @@ -1,22 +1,8 @@ #include "kapi/interrupts.hpp" -#include "kapi/system.hpp" - -#include <kstd/print> -#include <kstd/vector> - -#include <array> -#include <cstdint> - namespace kapi::interrupts { - namespace - { - constexpr auto irq_offset = 32uz; - auto constinit handlers = std::array<kstd::vector<handler *>, 256 - irq_offset>{}; - } // namespace - auto enable() -> void { asm volatile("sti"); @@ -27,42 +13,4 @@ namespace kapi::interrupts asm volatile("cli"); } - auto register_handler(std::uint32_t irq_number, handler & handler) -> void - { - if (irq_number < irq_offset) - { - system::panic("[x86_64:CPU] IRQ number must be in range [32, 255]."); - } - - handlers[irq_number - irq_offset].push_back(&handler); - } - - auto unregister_handler(std::uint32_t irq_number, [[maybe_unused]] handler & handler) -> void - { - if (irq_number < irq_offset) - { - system::panic("[x86_64:CPU] IRQ number must be in range [32, 255]."); - } - - kstd::println("[x86_64:CPU] TODO: support erasure from vector."); - } - - auto dispatch(std::uint32_t irq_number) -> status - { - if (irq_number < irq_offset) - { - return status::unhandled; - } - - for (auto handler : handlers[irq_number - irq_offset]) - { - if (handler && handler->handle_interrupt(irq_number) == status::handled) - { - return status::handled; - } - } - - return status::unhandled; - } - } // namespace kapi::interrupts
\ No newline at end of file |
