Ensure we are in an interrupt in the interrupt handler

This commit is contained in:
apio 2022-09-20 17:16:23 +02:00
parent d0d2d4381c
commit 5ee8e17b76

View File

@ -1,6 +1,8 @@
#define MODULE "isr" #define MODULE "isr"
#include "assert.h"
#include "interrupts/IRQ.h" #include "interrupts/IRQ.h"
#include "interrupts/Interrupts.h"
#include "interrupts/SavedContext.h" #include "interrupts/SavedContext.h"
#include "log/Log.h" #include "log/Log.h"
#include "panic/hang.h" #include "panic/hang.h"
@ -9,6 +11,7 @@
extern "C" void common_handler(SavedContext* context) extern "C" void common_handler(SavedContext* context)
{ {
ASSERT(Interrupts::is_in_handler());
if (context->number >= 0x20 && context->number < 0x30) if (context->number >= 0x20 && context->number < 0x30)
{ {
IRQ::interrupt_handler(context); IRQ::interrupt_handler(context);
@ -38,6 +41,10 @@ extern "C" void common_handler(SavedContext* context)
if (context->number == 8) if (context->number == 8)
{ {
kerrorln("Double fault, halting"); kerrorln("Double fault, halting");
kinfoln("Stack trace:");
StackTracer tracer(context->rbp);
tracer.trace();
hang(); hang();
} }
if (context->number == 256) { kwarnln("Unused interrupt"); } if (context->number == 256) { kwarnln("Unused interrupt"); }