23 lines
741 B
C++

#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 %zx, %d, %d, %zx, %d, %zx\n", context->rip, context->cs, context->ss,
context->rsp, context->error_code, context->cr2);
while (1) halt();
}
if (context->number == 14)
{
printf("Page fault at 0x%zx\n");
hang();
}
if (context->number >= 0x20 && context->number < 0x30) { IRQ::interrupt_handler(context); }
return;
}