]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
parser: Populate pageframe structure completely
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 3 Jul 2010 12:08:56 +0000 (15:08 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 3 Jul 2010 12:12:53 +0000 (15:12 +0300)
Now all fields are filled. If page exists then either pfn or swap type
and offset are wrong. But the correct field can be determined by
inspecting the page_present and page_swapped fields.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
parse.c

diff --git a/parse.c b/parse.c
index 622add8cc704746cd5427b74f8cc6dc303a1e100..a9c3f8f2a09393c93c97c04907adfd4e9aeb3641 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -85,11 +85,14 @@ static void pageframe_to_struct(unsigned long long p, struct pageframe *pf)
 {
        pf->page_present = !!(BITRANGE(63, 63) & p);
        pf->page_swapped = !!(BITRANGE(62, 62) & p);
-       pf->page_shift   =   (BITRANGE(55, 60) & p) << 55;
+       pf->page_shift   =   (BITRANGE(55, 60) & p) >> 55;
        pf->pfn          =   (BITRANGE(0, 54) & p);
-
-       printf("pfn: %lx shift: %x present: %d swapped %d\n",
+       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)