def test_customdesc_extmod_conv(self): sys = addrxlat.System() map = addrxlat.Map() sys.set_meth(addrxlat.SYS_METH_CUSTOM, self.meth_extmod) map.set(0, addrxlat.Range(0xffff, addrxlat.SYS_METH_CUSTOM)) sys.set_map(addrxlat.SYS_MAP_KV_PHYS, map) addr = addrxlat.FullAddress(addrxlat.KVADDR, 0x2345) addr.conv(addrxlat.KPHYSADDR, self.ctx, sys) self.assertEqual(addr.addrspace, addrxlat.KPHYSADDR) self.assertEqual(addr.addr, 0x123456 + 0x4523)
def test_sys_map(self): sys = addrxlat.System() newmap = addrxlat.Map() for mapidx in xrange(addrxlat.SYS_MAP_NUM): sys.set_map(mapidx, newmap) for i in xrange(mapidx + 1): map = sys.get_map(i) self.assertEqual(map, newmap) for i in xrange(mapidx + 1, addrxlat.SYS_MAP_NUM): map = sys.get_map(i) self.assertIs(map, None) for i in xrange(addrxlat.SYS_METH_NUM): meth = sys.get_meth(i) self.assertEquals(meth.kind, addrxlat.NOMETH)