Kernel/vfs - Fixed bug in VFS_ParsePath
[tpg/acess2.git] / Kernel / arch / arm7 / mm_virt.c
index 6744bae..7abf4e7 100644 (file)
@@ -102,7 +102,6 @@ int MM_int_AllocateCoarse(tVAddr VAddr, int Domain)
        desc[2] = desc[0] + 0x800;
        desc[3] = desc[0] + 0xC00;
 
-       Log("FRACTAL(%p, %p) = %p", table1, VAddr, &FRACTAL(table1, VAddr));
        FRACTAL(table1, VAddr) = paddr | 3;
 
        // TLBIALL 
@@ -151,6 +150,8 @@ int MM_int_SetPageInfo(tVAddr VAddr, tMM_PageInfo *pi)
                        if( pi->bShared)        *desc |= 1 << 10;       // S
                        *desc |= (pi->AP & 3) << 4;     // AP
                        *desc |= ((pi->AP >> 2) & 1) << 9;      // APX
+                       LEAVE('i', 0);
+                       return 0;
                }
                else
                {
@@ -159,7 +160,7 @@ int MM_int_SetPageInfo(tVAddr VAddr, tMM_PageInfo *pi)
                }
                break;
        case 20:        // Section or unmapped
-               Log_Warning("MM", "TODO: Implement sections");
+               Warning("TODO: Implement sections");
                break;
        case 24:        // Supersection
                // Error if not aligned
@@ -184,6 +185,7 @@ int MM_int_SetPageInfo(tVAddr VAddr, tMM_PageInfo *pi)
                        LEAVE('i', 0);
                        return 0;
                }
+               // TODO: What here?
                LEAVE('i', 1);
                return 1;
        }
@@ -192,6 +194,8 @@ int MM_int_SetPageInfo(tVAddr VAddr, tMM_PageInfo *pi)
        return 1;
 }
 
+extern tShortSpinlock  glDebug_Lock;
+
 int MM_int_GetPageInfo(tVAddr VAddr, tMM_PageInfo *pi)
 {
        Uint32  *table0, *table1;
@@ -200,11 +204,15 @@ int MM_int_GetPageInfo(tVAddr VAddr, tMM_PageInfo *pi)
        MM_int_GetTables(VAddr, &table0, &table1);
 
        desc = table0[ VAddr >> 20 ];
+
+//     if( VAddr > 0x90000000)
+//             LOG("table0 desc(%p) = %x", &table0[ VAddr >> 20 ], desc);
        
        pi->bExecutable = 1;
        pi->bGlobal = 0;
        pi->bShared = 0;
 
+
        switch( (desc & 3) )
        {
        // 0: Unmapped
@@ -220,6 +228,7 @@ int MM_int_GetPageInfo(tVAddr VAddr, tMM_PageInfo *pi)
                pi->Domain = (desc >> 5) & 7;
                // Get next level
                desc = table1[ VAddr >> 12 ];
+//             LOG("table1 desc(%p) = %x", &table1[ VAddr >> 12 ], desc);
                switch( desc & 3 )
                {
                // 0: Unmapped
@@ -239,7 +248,7 @@ int MM_int_GetPageInfo(tVAddr VAddr, tMM_PageInfo *pi)
                        pi->bExecutable = desc & 1;
                        pi->bGlobal = !(desc >> 11);
                        pi->bShared = (desc >> 10) & 1;
-                       return 1;
+                       return 0;
                }
                return 1;
        
@@ -277,7 +286,7 @@ tPAddr MM_GetPhysAddr(tVAddr VAddr)
        tMM_PageInfo    pi;
        if( MM_int_GetPageInfo(VAddr, &pi) )
                return 0;
-       return pi.PhysAddr;
+       return pi.PhysAddr | (VAddr & ((1 << pi.Size)-1));
 }
 
 Uint MM_GetFlags(tVAddr VAddr)

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