return pageframe;
}
-#define BITRANGE(first, last) (((2ll << (last - first)) - 1) << first)
-
-static void pageframe_to_struct(unsigned long long p, struct pageframe *pf)
-{
- /* Refer Documentation/vm/pagemap.txt for the format */
- pf->page_present = !!(BITRANGE(63, 63) & p);
- pf->page_swapped = !!(BITRANGE(62, 62) & p);
- pf->page_shift = (BITRANGE(55, 60) & p) >> 55;
- pf->pfn = (BITRANGE(0, 54) & p);
- pf->swap_type = (BITRANGE(0, 4) & p);
- pf->swap_offset = (BITRANGE(5, 54) & p) >> 5;
-#if 0
- printf("pfn: %lx shift: %d present: %d swapped %d\n",
- pf->pfn, pf->page_shift, pf->page_present, pf->page_swapped);
-#endif
-}
-
static int compare_pageframe(struct bintree *at, struct bintree *bt)
{
struct pageframe *a, *b;
a = tree_to_pageframe(at);
b = tree_to_pageframe(bt);
- return a->pfn - b->pfn;
+ return a->pf - b->pf;
}
struct bintree_ops pageframe_ops = {
if (!pf[ret / sizeof(pf[0])])
continue;
- pageframe_to_struct(pf[ret / sizeof(pf[0])], pageframe);
+ pageframe->pf = (pf[ret / sizeof(pf[0])]);
/* ignore unused pages */
- if (!(pageframe->page_swapped ||
- pageframe->page_present))
+ if (!(page_swapped(pageframe) ||
+ page_present(pageframe)))
continue;
if (should_add_to_tree(opts, pageframe, map)) {
tmp->map = map;
list_add(&tmp->list, &match->ml.list);
- if (match->page_present)
+ if (page_present(match))
map->pages_present++;
- else if (match->page_swapped)
+ else if (page_swapped(match))
map->pages_swapped++;
}
}