mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-02-12 18:08:42 +00:00
cleanup
This commit is contained in:
parent
0a6b074929
commit
835042587f
@ -125,7 +125,7 @@ static void usage(char *prog)
|
||||
}
|
||||
|
||||
if (cs_support(CS_ARCH_M68K)) {
|
||||
printf(" m68kb: m68k+big endian\n");
|
||||
printf(" m68k: m68k + big endian\n");
|
||||
printf(" m68k40: m68k_040\n");
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ int main(int argc, char **argv)
|
||||
err = cs_open(CS_ARCH_XCORE, CS_MODE_BIG_ENDIAN, &handle);
|
||||
}
|
||||
|
||||
if (!strcmp(mode,"m68kb")) {
|
||||
if (!strcmp(mode,"m68k")) {
|
||||
arch = CS_ARCH_M68K;
|
||||
err = cs_open(CS_ARCH_M68K, CS_MODE_BIG_ENDIAN, &handle);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||
int i;
|
||||
cs_regs regs_read, regs_write;
|
||||
uint8_t regs_read_count, regs_write_count;
|
||||
|
||||
|
||||
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
|
||||
if (ins->detail == NULL)
|
||||
return;
|
||||
@ -44,17 +44,17 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||
printf("\t\toperands[%u].type: MEM\n", i);
|
||||
if (op->mem.base != ARM_REG_INVALID)
|
||||
printf("\t\t\toperands[%u].mem.base: REG = %s\n",
|
||||
i, cs_reg_name(handle, op->mem.base));
|
||||
i, cs_reg_name(handle, op->mem.base));
|
||||
if (op->mem.index != ARM_REG_INVALID)
|
||||
printf("\t\t\toperands[%u].mem.index: REG = %s\n",
|
||||
i, cs_reg_name(handle, op->mem.index));
|
||||
i, cs_reg_name(handle, op->mem.index));
|
||||
if (op->mem.scale != 1)
|
||||
printf("\t\t\toperands[%u].mem.scale: %u\n", i, op->mem.scale);
|
||||
if (op->mem.disp != 0)
|
||||
printf("\t\t\toperands[%u].mem.disp: 0x%x\n", i, op->mem.disp);
|
||||
if (op->mem.lshift != 0)
|
||||
printf("\t\t\toperands[%u].mem.lshift: 0x%x\n", i, op->mem.lshift);
|
||||
|
||||
|
||||
break;
|
||||
case ARM_OP_PIMM:
|
||||
printf("\t\toperands[%u].type: P-IMM = %u\n", i, op->imm);
|
||||
@ -69,11 +69,11 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||
printf("\t\toperands[%u].type: SYSREG = %u\n", i, op->reg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (op->neon_lane != -1) {
|
||||
printf("\t\toperands[%u].neon_lane = %u\n", i, op->neon_lane);
|
||||
}
|
||||
|
||||
|
||||
switch(op->access) {
|
||||
default:
|
||||
break;
|
||||
@ -87,7 +87,7 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||
printf("\t\toperands[%u].access: READ | WRITE\n", i);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (op->shift.type != ARM_SFT_INVALID && op->shift.value) {
|
||||
if (op->shift.type < ARM_SFT_ASR_REG)
|
||||
// shift with constant value
|
||||
@ -95,7 +95,7 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||
else
|
||||
// shift with register
|
||||
printf("\t\t\tShift: %u = %s\n", op->shift.type,
|
||||
cs_reg_name(handle, op->shift.value));
|
||||
cs_reg_name(handle, op->shift.value));
|
||||
}
|
||||
|
||||
if (op->vector_index != -1) {
|
||||
@ -135,8 +135,8 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||
|
||||
// Print out all registers accessed by this instruction (either implicit or explicit)
|
||||
if (!cs_regs_access(handle, ins,
|
||||
regs_read, ®s_read_count,
|
||||
regs_write, ®s_write_count)) {
|
||||
regs_read, ®s_read_count,
|
||||
regs_write, ®s_write_count)) {
|
||||
if (regs_read_count) {
|
||||
printf("\tRegisters read:");
|
||||
for(i = 0; i < regs_read_count; i++) {
|
||||
@ -144,7 +144,7 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
if (regs_write_count) {
|
||||
printf("\tRegisters modified:");
|
||||
for(i = 0; i < regs_write_count; i++) {
|
||||
@ -153,6 +153,6 @@ void print_insn_detail_arm(csh handle, cs_insn *ins)
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -16,26 +16,26 @@ static const char* s_addressing_modes[] = {
|
||||
|
||||
"Register Direct - Data",
|
||||
"Register Direct - Address",
|
||||
|
||||
|
||||
"Register Indirect - Address",
|
||||
"Register Indirect - Address with Postincrement",
|
||||
"Register Indirect - Address with Predecrement",
|
||||
"Register Indirect - Address with Displacement",
|
||||
|
||||
|
||||
"Address Register Indirect With Index - 8-bit displacement",
|
||||
"Address Register Indirect With Index - Base displacement",
|
||||
|
||||
|
||||
"Memory indirect - Postindex",
|
||||
"Memory indirect - Preindex",
|
||||
|
||||
|
||||
"Program Counter Indirect - with Displacement",
|
||||
|
||||
|
||||
"Program Counter Indirect with Index - with 8-Bit Displacement",
|
||||
"Program Counter Indirect with Index - with Base Displacement",
|
||||
|
||||
|
||||
"Program Counter Memory Indirect - Postindexed",
|
||||
"Program Counter Memory Indirect - Preindexed",
|
||||
|
||||
|
||||
"Absolute Data Addressing - Short",
|
||||
"Absolute Data Addressing - Long",
|
||||
"Immediate value",
|
||||
@ -67,19 +67,19 @@ void print_insn_detail_m68k(csh handle, cs_insn *ins)
|
||||
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
|
||||
if (ins->detail == NULL)
|
||||
return;
|
||||
|
||||
|
||||
detail = ins->detail;
|
||||
m68k = &detail->m68k;
|
||||
if (m68k->op_count)
|
||||
printf("\top_count: %u\n", m68k->op_count);
|
||||
|
||||
|
||||
print_read_write_regs(detail, handle);
|
||||
|
||||
|
||||
printf("\tgroups_count: %u\n", detail->groups_count);
|
||||
|
||||
|
||||
for (i = 0; i < m68k->op_count; i++) {
|
||||
cs_m68k_op* op = &(m68k->operands[i]);
|
||||
|
||||
|
||||
switch((int)op->type) {
|
||||
default:
|
||||
break;
|
||||
@ -93,18 +93,18 @@ void print_insn_detail_m68k(csh handle, cs_insn *ins)
|
||||
printf("\t\toperands[%u].type: MEM\n", i);
|
||||
if (op->mem.base_reg != M68K_REG_INVALID)
|
||||
printf("\t\t\toperands[%u].mem.base: REG = %s\n",
|
||||
i, cs_reg_name(handle, op->mem.base_reg));
|
||||
i, cs_reg_name(handle, op->mem.base_reg));
|
||||
if (op->mem.index_reg != M68K_REG_INVALID) {
|
||||
printf("\t\t\toperands[%u].mem.index: REG = %s\n",
|
||||
i, cs_reg_name(handle, op->mem.index_reg));
|
||||
i, cs_reg_name(handle, op->mem.index_reg));
|
||||
printf("\t\t\toperands[%u].mem.index: size = %c\n",
|
||||
i, op->mem.index_size ? 'l' : 'w');
|
||||
i, op->mem.index_size ? 'l' : 'w');
|
||||
}
|
||||
if (op->mem.disp != 0)
|
||||
printf("\t\t\toperands[%u].mem.disp: 0x%x\n", i, op->mem.disp);
|
||||
if (op->mem.scale != 0)
|
||||
printf("\t\t\toperands[%u].mem.scale: %d\n", i, op->mem.scale);
|
||||
|
||||
|
||||
printf("\t\taddress mode: %s\n", s_addressing_modes[op->address_mode]);
|
||||
break;
|
||||
case M68K_OP_FP_SINGLE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user