diff options
| -rw-r--r-- | arch/x86_64/arch/cpu/interrupts.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/x86_64/arch/cpu/interrupts.cpp b/arch/x86_64/arch/cpu/interrupts.cpp index cf225a90..94806621 100644 --- a/arch/x86_64/arch/cpu/interrupts.cpp +++ b/arch/x86_64/arch/cpu/interrupts.cpp @@ -6,6 +6,7 @@ #include <kapi/cpu.hpp> #include <kapi/interrupts.hpp> #include <kapi/memory.hpp> +#include <kapi/system.hpp> #include <kstd/print.hpp> @@ -124,6 +125,12 @@ namespace arch::cpu } pic_master_control_port::write(pic_end_of_interrupt); } + + auto handle_double_fault(interrupt_frame * frame) -> void + { + kapi::system::panic("[ARCH:CPU] Double fault! Possible kernel stack corruption! rsp was {}", + frame->cpu_saved.rsp); + } } // namespace extern "C" @@ -134,7 +141,11 @@ namespace arch::cpu { auto [number, code] = frame->interrupt; - if (number < number_of_exception_vectors) + if (number == static_cast<std::uint64_t>(exception::double_fault)) + { + handle_double_fault(frame); + } + else if (number < number_of_exception_vectors) { if (!dispatch_exception(frame)) { |
