From 0e47df07d3e44c7e18405387433a0d81a8c0c868 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 22 Sep 2013 23:48:30 +0800 Subject: [PATCH] Kernel - Added sanity check to template PMM --- KernelLand/Kernel/include/tpl_mm_phys_bitmap.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } -- 2.20.1