def pt64_walk(data, ttbr, tnsz, levels=3): print("Dumping page tables (levels=%d)" % levels) print("First level (ptbase = %016x)" % ttbr) print("---------------------------------------------") fl = data[ttbr - ttbr:ttbr - ttbr + 0x1000] if levels <= 1: return for (va, fle) in pt64.parse_pt(fl, 0, tnsz, 1): if "TABLE" in str(fle): print("Second level (ptbase = %016x)" % fle.output) print("---------------------------------------------") sl = data[fle.output - ttbr:fle.output - ttbr + 0x4000] sl = pt64.parse_pt(sl, va, tnsz, 2) if levels <= 2: continue for (mva, sle) in sl: if "TABLE" in str(sle): print("Third level (ptbase = %016x)" % sle.output) print("---------------------------------------------") tl = data[sle.output - ttbr:sle.output - ttbr + 0x1000] pt64.parse_pt(tl, mva, tnsz, 3)
def pt64_walk(ttbr, tnsz, levels=3): I("Dumping page tables (levels=%d)", levels) I("First level (ptbase = %016x)", ttbr) I("---------------------------------------------") fl = Framework.peek(ttbr, 0x1000) if levels <= 1: return for (va, fle) in pt64.parse_pt(fl, 0, tnsz, 1): if "TABLE" in str(fle): I("Second level (ptbase = %016x)" % fle.output) I("---------------------------------------------") sl = Framework.peek(fle.output, 0x4000) sl = pt64.parse_pt(sl, va, tnsz, 2) if levels <= 2: continue for (va, sle) in sl: if "TABLE" in str(sle): I("Third level (ptbase = %016x)" % sle.output) I("---------------------------------------------") tl = Framework.peek(sle.output, 0x1000) pt64.parse_pt(tl, va, tnsz, 3)