X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Farm7%2Fmm_virt.c;h=7abf4e74e0ed196d4f48b50a535132ce5162295e;hb=6e41a8a3aa767cd5aeddbad393ce4f637a47a367;hp=6744bae21680964bf65f53806a025dc4761012b9;hpb=0823932d2ca869dc5dc972ac76261e1b264e70a0;p=tpg%2Facess2.git diff --git a/Kernel/arch/arm7/mm_virt.c b/Kernel/arch/arm7/mm_virt.c index 6744bae2..7abf4e74 100644 --- a/Kernel/arch/arm7/mm_virt.c +++ b/Kernel/arch/arm7/mm_virt.c @@ -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)