+ gaMainBitmap[ page >> 6 ] &= ~(1LL << (page&63));
+ }
+ else
+ gaMainBitmap[ page >> 6 ] &= ~(1LL << (page&63));
+
+ // Update the free counts if the page was freed
+ if( !(gaMainBitmap[ page >> 6 ] & (1LL << (page&63))) )
+ {
+ int rangeID;
+ rangeID = MM_int_GetRangeID( PAddr );
+ giPhysRangeFree[ rangeID ] ++;
+ if( giPhysRangeFirst[rangeID] > page )
+ giPhysRangeFirst[rangeID] = page;
+ if( giPhysRangeLast[rangeID] < page )
+ giPhysRangeLast[rangeID] = page;
+ }
+
+ // If the bitmap entry is not -1, unset the bit in the super bitmap
+ if(gaMainBitmap[ page >> 6 ] + 1 != 0 ) {
+ gaSuperBitmap[page >> 12] &= ~(1LL << ((page >> 6) & 63));
+ }
+}
+
+int MM_GetRefCount( tPAddr PAddr )
+{
+ PAddr >>= 12;
+
+ if( PAddr >> 12 > giMaxPhysPage ) return 0;
+
+ if( gaMultiBitmap[ PAddr >> 6 ] & (1LL << (PAddr&63)) ) {
+ return gaiPageReferences[PAddr];
+ }
+
+ if( gaMainBitmap[ PAddr >> 6 ] & (1LL << (PAddr&63)) )
+ {
+ return 1;