From 5ee8e17b76c8b3c4f5041d83425b9fef400403e6 Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 20 Sep 2022 17:16:23 +0200 Subject: [PATCH] Ensure we are in an interrupt in the interrupt handler --- kernel/src/interrupts/Entry.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/src/interrupts/Entry.cpp b/kernel/src/interrupts/Entry.cpp index e439287c..6f24af31 100644 --- a/kernel/src/interrupts/Entry.cpp +++ b/kernel/src/interrupts/Entry.cpp @@ -1,6 +1,8 @@ #define MODULE "isr" +#include "assert.h" #include "interrupts/IRQ.h" +#include "interrupts/Interrupts.h" #include "interrupts/SavedContext.h" #include "log/Log.h" #include "panic/hang.h" @@ -9,6 +11,7 @@ extern "C" void common_handler(SavedContext* context) { + ASSERT(Interrupts::is_in_handler()); if (context->number >= 0x20 && context->number < 0x30) { IRQ::interrupt_handler(context); @@ -38,6 +41,10 @@ extern "C" void common_handler(SavedContext* context) if (context->number == 8) { kerrorln("Double fault, halting"); + kinfoln("Stack trace:"); + + StackTracer tracer(context->rbp); + tracer.trace(); hang(); } if (context->number == 256) { kwarnln("Unused interrupt"); }