#include <acess.h>
#include <proc.h>
+// === IMPORTS ===
+void MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs);
+
// === PROTOTYPES ===
void Error_Handler(tRegs *Regs);
{
Uint cr;
+ if( Regs->IntNum == 14 ) {
+ __asm__ __volatile__ ("mov %%cr2, %0":"=r"(cr));
+ MM_PageFault(cr, Regs->ErrorCode, Regs);
+ return ;
+ }
+
Debug_KernelPanic();
Log("CPU Error %x, Code: 0x%x", Regs->IntNum, Regs->ErrorCode);
{
case 6: // #UD
Warning(" Offending bytes: %02x %02x %02x %02x",
- *(Uint8*)Regs->RIP+0, *(Uint8*)Regs->RIP+1,
- *(Uint8*)Regs->RIP+2, *(Uint8*)Regs->RIP+3);
+ *(Uint8*)(Regs->RIP+0), *(Uint8*)(Regs->RIP+1),
+ *(Uint8*)(Regs->RIP+2), *(Uint8*)(Regs->RIP+3)
+ );
break;
}
+ __asm__ __volatile__ ("cli");
for(;;)
__asm__ __volatile__ ("hlt");
}