Kernel - Added sanity check to template PMM
authorJohn Hodge <[email protected]>
Sun, 22 Sep 2013 15:48:30 +0000 (23:48 +0800)
committerJohn Hodge <[email protected]>
Sun, 22 Sep 2013 15:48:30 +0000 (23:48 +0800)
KernelLand/Kernel/include/tpl_mm_phys_bitmap.h

index 005a2f8..106efd7 100644 (file)
@@ -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;
        }
        

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