x86_64: Add a friendlier handler for page faults
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
1d0dd8fa93
commit
8ff9cb4b96
@ -293,7 +293,15 @@ static void setup_idt()
|
|||||||
kerrorln("FIXME(interrupt): %s", name); \
|
kerrorln("FIXME(interrupt): %s", name); \
|
||||||
CPU::efficient_halt();
|
CPU::efficient_halt();
|
||||||
|
|
||||||
extern "C" void handle_x86_exception([[maybe_unused]] Registers* regs)
|
[[noreturn]] void handle_page_fault(Registers* regs)
|
||||||
|
{
|
||||||
|
u64 cr2;
|
||||||
|
asm volatile("mov %%cr2, %0" : "=r"(cr2));
|
||||||
|
kerrorln("Page fault at RIP %lx while accessing %lx!", regs->rip, cr2);
|
||||||
|
CPU::efficient_halt();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void handle_x86_exception(Registers* regs)
|
||||||
{
|
{
|
||||||
switch (regs->isr)
|
switch (regs->isr)
|
||||||
{
|
{
|
||||||
@ -309,7 +317,7 @@ extern "C" void handle_x86_exception([[maybe_unused]] Registers* regs)
|
|||||||
case 11: FIXME_UNHANDLED_INTERRUPT("Segment not present");
|
case 11: FIXME_UNHANDLED_INTERRUPT("Segment not present");
|
||||||
case 12: FIXME_UNHANDLED_INTERRUPT("Stack-segment fault");
|
case 12: FIXME_UNHANDLED_INTERRUPT("Stack-segment fault");
|
||||||
case 13: FIXME_UNHANDLED_INTERRUPT("General protection fault");
|
case 13: FIXME_UNHANDLED_INTERRUPT("General protection fault");
|
||||||
case 14: FIXME_UNHANDLED_INTERRUPT("Page fault");
|
case 14: handle_page_fault(regs);
|
||||||
case 16: FIXME_UNHANDLED_INTERRUPT("x87 floating-point exception");
|
case 16: FIXME_UNHANDLED_INTERRUPT("x87 floating-point exception");
|
||||||
case 17: FIXME_UNHANDLED_INTERRUPT("Alignment check");
|
case 17: FIXME_UNHANDLED_INTERRUPT("Alignment check");
|
||||||
case 19: FIXME_UNHANDLED_INTERRUPT("SIMD floating-point exception");
|
case 19: FIXME_UNHANDLED_INTERRUPT("SIMD floating-point exception");
|
||||||
|
Loading…
Reference in New Issue
Block a user