From: John Hodge Date: Fri, 26 Aug 2011 03:13:34 +0000 (+0800) Subject: Kernel/x86 - Added node display to DumpTables, fixed bug in GetPageNode X-Git-Tag: rel0.11~121 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=d5e3bd6b50a3e6b0e18380c041fe512cd0f20a03;p=tpg%2Facess2.git Kernel/x86 - Added node display to DumpTables, fixed bug in GetPageNode --- diff --git a/Kernel/arch/x86/mm_phys.c b/Kernel/arch/x86/mm_phys.c index fc71bd99..b84ceb6b 100644 --- a/Kernel/arch/x86/mm_phys.c +++ b/Kernel/arch/x86/mm_phys.c @@ -530,6 +530,7 @@ int MM_GetPageNode(tPAddr PAddr, void **Node) if( MM_GetRefCount(PAddr) == 0 ) { return 1; } + PAddr /= PAGE_SIZE; if( !MM_GetPhysAddr( (tVAddr) &gaPageNodes[PAddr] ) ) { *Node = NULL; return 0; diff --git a/Kernel/arch/x86/mm_virt.c b/Kernel/arch/x86/mm_virt.c index af3daa34..b2f11c38 100644 --- a/Kernel/arch/x86/mm_virt.c +++ b/Kernel/arch/x86/mm_virt.c @@ -247,6 +247,7 @@ void MM_DumpTables(tVAddr Start, tVAddr End) { tVAddr rangeStart = 0; tPAddr expected = 0; + void *expected_node = NULL, *tmpnode = NULL; tVAddr curPos; Uint page; const tPAddr MASK = ~0xF78; @@ -276,11 +277,12 @@ void MM_DumpTables(tVAddr Start, tVAddr End) { if( !(gaPageDir[curPos>>22] & PF_PRESENT) || !(gaPageTable[page] & PF_PRESENT) - || (gaPageTable[page] & MASK) != expected) + || (gaPageTable[page] & MASK) != expected + || (tmpnode=NULL,MM_GetPageNode(curPos, &tmpnode), tmpnode != expected_node)) { if(expected) { tPAddr orig = gaPageTable[rangeStart>>12]; - Log(" 0x%08x => 0x%08x - 0x%08x (%s%s%s%s%s)", + Log(" 0x%08x => 0x%08x - 0x%08x (%s%s%s%s%s) %p", rangeStart, orig & ~0xFFF, curPos - rangeStart, @@ -288,7 +290,8 @@ void MM_DumpTables(tVAddr Start, tVAddr End) (orig & PF_COW ? "C" : "-"), (orig & PF_GLOBAL ? "G" : "-"), (orig & PF_USER ? "U" : "-"), - (orig & PF_WRITE ? "W" : "-") + (orig & PF_WRITE ? "W" : "-"), + expected_node ); expected = 0; } @@ -296,20 +299,24 @@ void MM_DumpTables(tVAddr Start, tVAddr End) if( !(gaPageTable[curPos>>12] & PF_PRESENT) ) continue; expected = (gaPageTable[page] & MASK); + MM_GetPageNode(curPos, &expected_node); rangeStart = curPos; } if(expected) expected += 0x1000; } if(expected) { - Log("0x%08x => 0x%08x - 0x%08x (%s%s%s%s)", + tPAddr orig = gaPageTable[rangeStart>>12]; + Log("0x%08x => 0x%08x - 0x%08x (%s%s%s%s%s) %p", rangeStart, - gaPageTable[rangeStart>>12] & ~0xFFF, + orig & ~0xFFF, curPos - rangeStart, - (expected & PF_NOPAGE ? "p" : "-"), - (expected & PF_COW ? "C" : "-"), - (expected & PF_USER ? "U" : "-"), - (expected & PF_WRITE ? "W" : "-") + (orig & PF_NOPAGE ? "p" : "-"), + (orig & PF_COW ? "C" : "-"), + (orig & PF_GLOBAL ? "G" : "-"), + (orig & PF_USER ? "U" : "-"), + (orig & PF_WRITE ? "W" : "-"), + expected_node ); expected = 0; }