| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#include "factory.h" |
| 6 |
|
| 7 |
char *get_detail_sparc(csh *handle, cs_mode mode, cs_insn *ins) |
| 8 |
{ |
| 9 |
cs_sparc *sparc; |
| 10 |
int i; |
| 11 |
char *result; |
| 12 |
|
| 13 |
result = (char *)malloc(sizeof(char)); |
| 14 |
result[0] = '\0'; |
| 15 |
|
| 16 |
if (ins->detail == NULL) |
| 17 |
return result; |
| 18 |
|
| 19 |
sparc = &(ins->detail->sparc); |
| 20 |
if (sparc->op_count) |
| 21 |
add_str(&result, " ; op_count: %u", sparc->op_count); |
| 22 |
|
| 23 |
for (i = 0; i < sparc->op_count; i++) { |
| 24 |
cs_sparc_op *op = &(sparc->operands[i]); |
| 25 |
switch((int)op->type) { |
| 26 |
default: |
| 27 |
break; |
| 28 |
case SPARC_OP_REG: |
| 29 |
add_str(&result, " ; operands[%u].type: REG = %s", i, cs_reg_name(*handle, op->reg)); |
| 30 |
break; |
| 31 |
case SPARC_OP_IMM: |
| 32 |
add_str(&result, " ; operands[%u].type: IMM = 0x%" PRIx64 "", i, op->imm); |
| 33 |
break; |
| 34 |
case SPARC_OP_MEM: |
| 35 |
add_str(&result, " ; operands[%u].type: MEM", i); |
| 36 |
if (op->mem.base != X86_REG_INVALID) |
| 37 |
add_str(&result, " ; operands[%u].mem.base: REG = %s", i, cs_reg_name(*handle, op->mem.base)); |
| 38 |
if (op->mem.index != X86_REG_INVALID) |
| 39 |
add_str(&result, " ; operands[%u].mem.index: REG = %s", i, cs_reg_name(*handle, op->mem.index)); |
| 40 |
if (op->mem.disp != 0) |
| 41 |
add_str(&result, " ; operands[%u].mem.disp: 0x%x", i, op->mem.disp); |
| 42 |
|
| 43 |
break; |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
if (sparc->cc != 0) |
| 48 |
add_str(&result, " ; Code condition: %u", sparc->cc); |
| 49 |
|
| 50 |
if (sparc->hint != 0) |
| 51 |
add_str(&result, " ; Hint code: %u", sparc->hint); |
| 52 |
|
| 53 |
return result; |
| 54 |
} |
| 55 |
|