2022-09-05 16:13:51 +02:00
|
|
|
#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 == 13)
|
|
|
|
{
|
2022-09-06 18:31:27 +02:00
|
|
|
printf("General protection fault at %zx, %ld, %ld, %zx, %ld, %zx\n", context->rip, context->cs, context->ss,
|
2022-09-05 16:59:45 +02:00
|
|
|
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)
|
|
|
|
{
|
2022-09-07 19:41:08 +02:00
|
|
|
printf("Page fault (RIP 0x%lx), while trying to access %lx\n", context->rip, context->cr2);
|
2022-09-06 18:08:15 +02:00
|
|
|
hang();
|
|
|
|
}
|
2022-09-05 16:13:51 +02:00
|
|
|
if (context->number >= 0x20 && context->number < 0x30) { IRQ::interrupt_handler(context); }
|
|
|
|
return;
|
|
|
|
}
|