#include "debug.h" #include "interrupts/IRQ.h" #include "interrupts/SavedContext.h" #include "panic/hang.h" #include "std/stdio.h" extern "C" void common_handler(SavedContext* context) { if (context->number < 0x20) { Debug::DebugStatus::the()->ThrowException(context->number); } if (context->number == 13) { printf("General protection fault at %x%x, %d, %d, %x%x, %d, %x%x\n", context->rip >> 32, context->rip & 0xFFFFFFFF, context->cs, context->ss, context->rsp >> 32, context->rsp & 0xFFFFFFFF, context->error_code, context->cr2 >> 32, context->cr2 & 0xFFFFFFFF); while (1) halt(); } if (context->number >= 0x20 && context->number < 0x30) { IRQ::interrupt_handler(context); } return; }