- struct pp_struct* pm = &pm_table[(intptr_t)page >> 12];
-
- // Is this a MMIO mapping or double free?
- if (((intptr_t)page >> 12) >= max_pg || !(pm->ref_counts)) {
+ pfn_t ppfn = pfn(page);
+ struct pp_struct* pm = &pm_table[ppfn];
+
+ assert(ppfn < max_pg && pm->ref_counts);
+ if (pm->attr && !(pm->attr & attr_mask)) {