x86_64: Add general protection fault handler
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f71ccde833
commit
59d69f684f
@ -28,6 +28,8 @@ extern void setup_idt();
|
||||
|
||||
[[noreturn]] void handle_page_fault(Registers* regs)
|
||||
{
|
||||
CPU::disable_interrupts();
|
||||
|
||||
u64 cr2;
|
||||
asm volatile("mov %%cr2, %0" : "=r"(cr2));
|
||||
kerrorln("Page fault at RIP %lx while accessing %lx!", regs->rip, cr2);
|
||||
@ -37,6 +39,17 @@ extern void setup_idt();
|
||||
CPU::efficient_halt();
|
||||
}
|
||||
|
||||
[[noreturn]] void handle_general_protection_fault(Registers* regs)
|
||||
{
|
||||
CPU::disable_interrupts();
|
||||
|
||||
kerrorln("General protection fault at RIP %lx, error code %lx!", regs->rip, regs->error);
|
||||
|
||||
CPU::print_stack_trace_at(regs);
|
||||
|
||||
CPU::efficient_halt();
|
||||
}
|
||||
|
||||
extern "C" void handle_x86_exception(Registers* regs)
|
||||
{
|
||||
switch (regs->isr)
|
||||
@ -52,7 +65,7 @@ extern "C" void handle_x86_exception(Registers* regs)
|
||||
case 10: FIXME_UNHANDLED_INTERRUPT("Invalid TSS");
|
||||
case 11: FIXME_UNHANDLED_INTERRUPT("Segment not present");
|
||||
case 12: FIXME_UNHANDLED_INTERRUPT("Stack-segment fault");
|
||||
case 13: FIXME_UNHANDLED_INTERRUPT("General protection fault");
|
||||
case 13: handle_general_protection_fault(regs);
|
||||
case 14: handle_page_fault(regs);
|
||||
case 16: FIXME_UNHANDLED_INTERRUPT("x87 floating-point exception");
|
||||
case 17: FIXME_UNHANDLED_INTERRUPT("Alignment check");
|
||||
|
Loading…
Reference in New Issue
Block a user