Cut down on debug, fixed tabs, made process tree be killed when root is killed
[tpg/acess2.git] / Kernel / arch / x86 / mm_virt.c
index 2fec186..d2d4e4b 100644 (file)
@@ -40,6 +40,7 @@
 // === IMPORTS ===
 extern Uint32  gaInitPageDir[1024];
 extern Uint32  gaInitPageTable[1024];
+extern void    Threads_SegFault(Uint Addr);
 
 // === PROTOTYPES ===
 void   MM_PreinitVirtual();
@@ -124,6 +125,12 @@ void MM_PageFault(Uint Addr, Uint ErrorCode, tRegs *Regs)
                return;
        }
        
+       // If it was a user, tell the thread handler
+       if(ErrorCode & 4) {
+               Threads_SegFault(Addr);
+               return ;
+       }
+       
        // -- Check Error Code --
        if(ErrorCode & 8)
                Warning("Reserved Bits Trashed!");
@@ -386,10 +393,12 @@ Uint MM_ClearUser()
                }
                
                MM_DerefPhys( gaPageDir[i] & ~0xFFF );
+               gaPageDir[i] = 0;
+               INVLPG( &gaPageTable[i*1024] );
        }
+       INVLPG( gaPageDir );
        
-       
-       return *gTmpCR3;
+       return *gaPageCR3;
 }
 
 /**

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