2022-09-05 16:13:51 +02:00
|
|
|
#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)
|
|
|
|
{
|
2022-09-05 16:59:45 +02:00
|
|
|
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);
|
2022-09-05 16:13:51 +02:00
|
|
|
while (1) halt();
|
|
|
|
}
|
2022-09-06 18:08:15 +02:00
|
|
|
if (context->number == 14)
|
|
|
|
{
|
|
|
|
printf("Page fault at 0x%zx\n");
|
|
|
|
hang();
|
|
|
|
}
|
2022-09-05 16:13:51 +02:00
|
|
|
if (context->number >= 0x20 && context->number < 0x30) { IRQ::interrupt_handler(context); }
|
|
|
|
return;
|
|
|
|
}
|