27 lines
830 B
C++
Raw Normal View History

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,
context->rsp, context->error_code, context->cr2);
2022-09-05 16:13:51 +02:00
while (1) halt();
}
if (context->number == 14)
{
2022-09-11 08:23:32 +02:00
printf("Page fault (RIP 0x%lx), while trying to access %lx, error code %lx\n", context->rip, context->cr2,
context->error_code);
hang();
}
if (context->number == 8)
{
printf("Double fault");
hang();
}
2022-09-05 16:13:51 +02:00
if (context->number >= 0x20 && context->number < 0x30) { IRQ::interrupt_handler(context); }
return;
}