14 byte[] data =
new byte[
len / 2];
15 for (
int i = 0;
i <
len;
i += 2) {
16 data[
i / 2] = (byte) ((Character.digit(
s.charAt(
i), 16) << 4)
17 + Character.digit(
s.charAt(
i+1), 16));
22 static final String SYSZ_CODE =
"ed000000001a5a0f1fffc2098000000007f7eb2affff7f57e301ffff7f57eb00f0000024b24f0078ec180000c17f";
24 public static Capstone
cs;
27 return Integer.toString(
i, 16);
31 return Long.toString(
i, 16);
35 System.out.printf(
"0x%x:\t%s\t%s\n", ins.address, ins.mnemonic, ins.opStr);
40 System.out.printf(
"\top_count: %d\n",
operands.op.length);
44 System.out.printf(
"\t\toperands[%d].type: REG = %s\n",
c, ins.regName(
i.value.reg));
46 System.out.printf(
"\t\toperands[%d].type: ACREG = %s\n",
c,
i.value.reg);
48 System.out.printf(
"\t\toperands[%d].type: IMM = 0x%x\n",
c,
i.value.imm);
50 System.out.printf(
"\t\toperands[%d].type: MEM\n",
c);
52 System.out.printf(
"\t\t\toperands[%d].mem.base: REG = %s\n",
c, ins.regName(
i.value.mem.base));
54 System.out.printf(
"\t\t\toperands[%d].mem.index: REG = %s\n",
c, ins.regName(
i.value.mem.index));
55 if (
i.value.mem.length != 0)
56 System.out.printf(
"\t\t\toperands[%d].mem.length: 0x%x\n",
c,
i.value.mem.disp);
57 if (
i.value.mem.disp != 0)
58 System.out.printf(
"\t\t\toperands[%d].mem.disp: 0x%x\n",
c,
i.value.mem.disp);
64 System.out.printf(
"\tConditional code: %d\n",
operands.cc);
76 System.out.println(
new String(
new char[16]).
replace(
"\0",
"*"));
77 System.out.println(
"Platform: " +
test.comment);
79 System.out.println(
"Disasm:");
82 cs.setDetail(Capstone.CS_OPT_ON);
83 Capstone.CsInsn[] all_ins =
cs.disasm(
test.code, 0x1000);
85 for (
int j = 0; j < all_ins.length; j++) {
89 System.out.printf(
"0x%x:\n\n", (all_ins[all_ins.length-1].address + all_ins[all_ins.length-1].size));
@ SYSZ_OP_MEM
= CS_OP_MEM (Memory operand).
@ SYSZ_OP_IMM
= CS_OP_IMM (Immediate operand).
@ SYSZ_OP_ACREG
Access register operand.
@ SYSZ_OP_REG
= CS_OP_REG (Register operand).
static String stringToHex(byte[] code)
static byte[] hexString2Byte(String s)
static void main(String argv[])
static String hex(long i)
static final String SYSZ_CODE
static void print_ins_detail(Capstone.CsInsn ins)
static static fork const void static count static fd const char const char static newpath char char argv
int replace(char *string, const char *token, const char *fmt,...)
if(dbg->bits==RZ_SYS_BITS_64)