From: John Hodge Date: Sun, 22 Sep 2013 15:48:30 +0000 (+0800) Subject: Kernel - Added sanity check to template PMM X-Git-Tag: rel0.15~177 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=0e47df07d3e44c7e18405387433a0d81a8c0c868;p=tpg%2Facess2.git Kernel - Added sanity check to template PMM --- diff --git a/KernelLand/Kernel/include/tpl_mm_phys_bitmap.h b/KernelLand/Kernel/include/tpl_mm_phys_bitmap.h index 005a2f8c..106efd75 100644 --- a/KernelLand/Kernel/include/tpl_mm_phys_bitmap.h +++ b/KernelLand/Kernel/include/tpl_mm_phys_bitmap.h @@ -354,7 +354,13 @@ int MM_GetRefCount(tPAddr PAddr) return gaiPageReferences[PAddr]; } - if( gaPageBitmaps[ PAddr / 32 ] & (1LL << (PAddr&31)) ) { + Uint32 *bm = &gaPageBitmaps[ PAddr / 32 ]; + if( !MM_GetPhysAddr(bm) ) { + Log_Error("MMPhys", "MM_GetRefCount: bitmap for ppage 0x%x not mapped %p", + PAddr, bm); + return 0; + } + if( (*bm) & (1LL << (PAddr&31)) ) { return 1; }