5 from __future__
import print_function
8 from xprint
import to_x, to_hex
11 SYSZ_CODE = b
"\xed\x00\x00\x00\x00\x1a\x5a\x0f\x1f\xff\xc2\x09\x80\x00\x00\x00\x07\xf7\xeb\x2a\xff\xff\x7f\x57\xe3\x01\xff\xff\x7f\x57\xeb\x00\xf0\x00\x00\x24\xb2\x4f\x00\x78\xec\x18\x00\x00\xc1\x7f"
14 (CS_ARCH_SYSZ, 0, SYSZ_CODE,
"SystemZ"),
20 print(
"0x%x:\t%s\t%s" % (insn.address, insn.mnemonic, insn.op_str))
26 if len(insn.operands) > 0:
27 print(
"\top_count: %u" %
len(insn.operands))
29 for i
in insn.operands:
30 if i.type == SYSZ_OP_REG:
31 print(
"\t\toperands[%u].type: REG = %s" % (c, insn.reg_name(i.reg)))
32 if i.type == SYSZ_OP_ACREG:
33 print(
"\t\toperands[%u].type: ACREG = %u" % (c, i.reg))
34 if i.type == SYSZ_OP_IMM:
35 print(
"\t\toperands[%u].type: IMM = 0x%s" % (c,
to_x(i.imm)))
36 if i.type == SYSZ_OP_MEM:
37 print(
"\t\toperands[%u].type: MEM" % c)
39 print(
"\t\t\toperands[%u].mem.base: REG = %s" \
40 % (c, insn.reg_name(i.mem.base)))
42 print(
"\t\t\toperands[%u].mem.index: REG = %s" \
43 % (c, insn.reg_name(i.mem.index)))
45 print(
"\t\t\toperands[%u].mem.length: 0x%s" \
46 % (c,
to_x(i.mem.length)))
48 print(
"\t\t\toperands[%u].mem.disp: 0x%s" \
49 % (c,
to_x(i.mem.disp)))
53 print(
"\tConditional code: %u" % insn.cc)
59 for (arch, mode, code, comment)
in all_tests:
61 print(
"Platform: %s" %comment)
62 print(
"Code: %s" %
to_hex(code))
68 for insn
in md.disasm(code, 0x1000):
71 print(
"0x%x:\n" % (insn.address + insn.size))
76 if __name__ ==
'__main__':
def print_insn_detail(insn)
def to_hex(s, prefix_0x=True)