Cleaning up and adding page fault handler
[tpg/acess2.git] / Kernel / arch / x86_64 / errors.c
index 361ccb0..c73ac0f 100644 (file)
@@ -5,6 +5,9 @@
 #include <acess.h>
 #include <proc.h>
 
+// === IMPORTS ===
+void   MM_PageFault(tVAddr Addr, Uint ErrorCode, tRegs *Regs);
+
 // === PROTOTYPES ===
 void   Error_Handler(tRegs *Regs);
 
@@ -25,6 +28,12 @@ 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);

UCC git Repository :: git.ucc.asn.au