Wrapping fix in vterm, increased verbosity of MM_Allocate
[tpg/acess2.git] / Kernel / arch / x86 / mm_virt.c
index b4fd222..cdd071c 100644 (file)
@@ -99,7 +99,7 @@ void MM_InstallVirtual()
  */
 void MM_PageFault(Uint Addr, Uint ErrorCode, tRegs *Regs)
 {
-       ENTER("xAddr bErrorCode", Addr, ErrorCode);
+       //ENTER("xAddr bErrorCode", Addr, ErrorCode);
        
        // -- Check for COW --
        if( gaPageDir  [Addr>>22] & PF_PRESENT
@@ -112,7 +112,7 @@ void MM_PageFault(Uint Addr, Uint ErrorCode, tRegs *Regs)
                gaPageTable[Addr>>12] &= PF_USER;
                gaPageTable[Addr>>12] |= paddr|PF_PRESENT|PF_WRITE;
                INVLPG( Addr & ~0xFFF );
-               LEAVE('-');
+               //LEAVE('-')
                return;
        }
        
@@ -136,7 +136,6 @@ void MM_PageFault(Uint Addr, Uint ErrorCode, tRegs *Regs)
        MM_DumpTables(0, -1);   
        
        Panic("Page Fault at 0x%x\n", Regs->eip);
-       LEAVE('-');
 }
 
 /**
@@ -213,7 +212,7 @@ tPAddr MM_Allocate(Uint VAddr)
        }
        // Check if the page is already allocated
        else if( gaPageTable[ VAddr >> 12 ] != 0 ) {
-               Warning("MM_Allocate - Allocating to used address");
+               Warning("MM_Allocate - Allocating to used address (%p)", VAddr);
                return gaPageTable[ VAddr >> 12 ] & ~0xFFF;
        }
        
@@ -524,6 +523,19 @@ void MM_SetFlags(Uint VAddr, Uint Flags, Uint Mask)
                if( Flags & MM_PFLAG_KERNEL )   *ent &= ~PF_USER;
                else    *ent |= PF_USER;
        }
+       
+       // Copy-On-Write
+       if( Mask & MM_PFLAG_COW )
+       {
+               if( Flags & MM_PFLAG_COW ) {
+                       *ent &= ~PF_WRITE;
+                       *ent |= PF_COW;
+               }
+               else {
+                       *ent &= ~PF_COW;
+                       *ent |= PF_WRITE;
+               }
+       }
 }
 
 /**

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