def ptwalk(addr):
    cpu,_ = get_cpu()
    vrn = addr >> 61
    rr = cpu.rr[vrn]
    rr_ps = (rr>>2) & 0x3f
    pt_entries = 1L << (rr_ps - 3)
    pgd = cpu.ar[7]
    print "rr_ps: 0x%x" % rr_ps
    ptd_index = (addr >> rr_ps) & (pt_entries - 1)
    pmd_index = (addr >> (rr_ps + rr_ps-3)) & (pt_entries - 1)
    pgd_index = ((addr >> (rr_ps + rr_ps-3 + rr_ps-3)) & ((pt_entries>>3) - 1) |
                 (vrn << (rr_ps - 6)))