| 31 | } |
| 32 | |
| 33 | public static void print_ins_detail(Capstone.CsInsn ins) { |
| 34 | System.out.printf("0x%x:\t%s\t%s\n", ins.address, ins.mnemonic, ins.opStr); |
| 35 | |
| 36 | Xcore.OpInfo operands = (Xcore.OpInfo) ins.operands; |
| 37 | |
| 38 | if (operands.op.length != 0) { |
| 39 | System.out.printf("\top_count: %d\n", operands.op.length); |
| 40 | for (int c=0; c<operands.op.length; c++) { |
| 41 | Xcore.Operand i = (Xcore.Operand) operands.op[c]; |
| 42 | if (i.type == XCORE_OP_REG) |
| 43 | System.out.printf("\t\toperands[%d].type: REG = %s\n", c, ins.regName(i.value.reg)); |
| 44 | if (i.type == XCORE_OP_IMM) |
| 45 | System.out.printf("\t\toperands[%d].type: IMM = 0x%x\n", c, i.value.imm); |
| 46 | if (i.type == XCORE_OP_MEM) { |
| 47 | System.out.printf("\t\toperands[%d].type: MEM\n", c); |
| 48 | if (i.value.mem.base != XCORE_REG_INVALID) |
| 49 | System.out.printf("\t\t\toperands[%d].mem.base: REG = %s\n", c, ins.regName(i.value.mem.base)); |
| 50 | if (i.value.mem.index != XCORE_REG_INVALID) |
| 51 | System.out.printf("\t\t\toperands[%d].mem.index: REG = %s\n", c, ins.regName(i.value.mem.index)); |
| 52 | if (i.value.mem.disp != 0) |
| 53 | System.out.printf("\t\t\toperands[%d].mem.disp: 0x%x\n", c, i.value.mem.disp); |
| 54 | if (i.value.mem.direct != 1) |
| 55 | System.out.printf("\t\t\toperands[%d].mem.direct: -1\n", c); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | public static void main(String argv[]) { |
| 62 | |