cstool: delete tab
diff --git a/cstool/cstool.c b/cstool/cstool.c
index aab0e80..44de4da 100644
--- a/cstool/cstool.c
+++ b/cstool/cstool.c
@@ -17,7 +17,7 @@
void print_insn_detail_sparc(csh handle, cs_insn *ins);
void print_insn_detail_sysz(csh handle, cs_insn *ins);
void print_insn_detail_xcore(csh handle, cs_insn *ins);
-void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins);
+void print_insn_detail_m68k(csh handle, cs_insn *ins);
void print_string_hex(char *comment, unsigned char *str, size_t len)
{
@@ -127,7 +127,6 @@
if (cs_support(CS_ARCH_M68K)) {
printf(" m68kb: m68k+big endian\n");
printf(" m68k40: m68k_040\n");
-
}
printf("\n");
diff --git a/cstool/cstool_arm.c b/cstool/cstool_arm.c
index e624365..035d268 100644
--- a/cstool/cstool_arm.c
+++ b/cstool/cstool_arm.c
@@ -15,12 +15,12 @@
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
if (ins->detail == NULL)
return;
-
+
arm = &(ins->detail->arm);
-
+
if (arm->op_count)
printf("\top_count: %u\n", arm->op_count);
-
+
for (i = 0; i < arm->op_count; i++) {
cs_arm_op *op = &(arm->operands[i]);
switch((int)op->type) {
@@ -95,44 +95,44 @@
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) {
printf("\t\toperands[%u].vector_index = %u\n", i, op->vector_index);
}
-
+
if (op->subtracted)
printf("\t\tSubtracted: True\n");
}
-
+
if (arm->cc != ARM_CC_AL && arm->cc != ARM_CC_INVALID)
printf("\tCode condition: %u\n", arm->cc);
-
+
if (arm->update_flags)
printf("\tUpdate-flags: True\n");
-
+
if (arm->writeback)
printf("\tWrite-back: True\n");
-
+
if (arm->cps_mode)
printf("\tCPSI-mode: %u\n", arm->cps_mode);
-
+
if (arm->cps_flag)
printf("\tCPSI-flag: %u\n", arm->cps_flag);
-
+
if (arm->vector_data)
printf("\tVector-data: %u\n", arm->vector_data);
-
+
if (arm->vector_size)
printf("\tVector-size: %u\n", arm->vector_size);
-
+
if (arm->usermode)
printf("\tUser-mode: True\n");
-
+
if (arm->mem_barrier)
printf("\tMemory-barrier: %u\n", arm->mem_barrier);
-
+
// Print out all registers accessed by this instruction (either implicit or explicit)
if (!cs_regs_access(handle, ins,
regs_read, ®s_read_count,
diff --git a/cstool/cstool_arm64.c b/cstool/cstool_arm64.c
index bdb01ba..e196f03 100644
--- a/cstool/cstool_arm64.c
+++ b/cstool/cstool_arm64.c
@@ -18,11 +18,11 @@
// detail can be NULL if SKIPDATA option is turned ON
if (ins->detail == NULL)
return;
-
+
arm64 = &(ins->detail->arm64);
if (arm64->op_count)
printf("\top_count: %u\n", arm64->op_count);
-
+
for (i = 0; i < arm64->op_count; i++) {
cs_arm64_op *op = &(arm64->operands[i]);
switch(op->type) {
@@ -50,7 +50,7 @@
printf("\t\t\toperands[%u].mem.index: REG = %s\n", i, cs_reg_name(handle, op->mem.index));
if (op->mem.disp != 0)
printf("\t\t\toperands[%u].mem.disp: 0x%x\n", i, op->mem.disp);
-
+
break;
case ARM64_OP_CIMM:
printf("\t\toperands[%u].type: C-IMM = %u\n", i, (int)op->imm);
@@ -94,29 +94,29 @@
op->shift.value)
printf("\t\t\tShift: type = %u, value = %u\n",
op->shift.type, op->shift.value);
-
+
if (op->ext != ARM64_EXT_INVALID)
printf("\t\t\tExt: %u\n", op->ext);
-
+
if (op->vas != ARM64_VAS_INVALID)
printf("\t\t\tVector Arrangement Specifier: 0x%x\n", op->vas);
-
+
if (op->vess != ARM64_VESS_INVALID)
printf("\t\t\tVector Element Size Specifier: %u\n", op->vess);
-
+
if (op->vector_index != -1)
printf("\t\t\tVector Index: %u\n", op->vector_index);
}
-
+
if (arm64->update_flags)
printf("\tUpdate-flags: True\n");
-
+
if (arm64->writeback)
printf("\tWrite-back: True\n");
-
+
if (arm64->cc)
printf("\tCode-condition: %u\n", arm64->cc);
-
+
// Print out all registers accessed by this instruction (either implicit or explicit)
if (!cs_regs_access(handle, ins,
regs_read, ®s_read_count,
diff --git a/cstool/cstool_m68k.c b/cstool/cstool_m68k.c
index 902bf97..d08bf78 100644
--- a/cstool/cstool_m68k.c
+++ b/cstool/cstool_m68k.c
@@ -11,9 +11,9 @@
void print_string_hex(char *comment, unsigned char *str, size_t len);
-const char* s_addressing_modes[] = {
+static const char* s_addressing_modes[] = {
"<invalid mode>",
-
+
"Register Direct - Data",
"Register Direct - Address",
@@ -41,19 +41,17 @@
"Immediate value",
};
-void print_read_write_regs(cs_detail* detail, csh handle)
+static void print_read_write_regs(cs_detail* detail, csh handle)
{
int i;
-
- for (i = 0; i < detail->regs_read_count; ++i)
- {
+
+ for (i = 0; i < detail->regs_read_count; ++i) {
uint16_t reg_id = detail->regs_read[i];
const char* reg_name = cs_reg_name(handle, reg_id);
printf("\treading from reg: %s\n", reg_name);
}
-
- for (i = 0; i < detail->regs_write_count; ++i)
- {
+
+ for (i = 0; i < detail->regs_write_count; ++i) {
uint16_t reg_id = detail->regs_write[i];
const char* reg_name = cs_reg_name(handle, reg_id);
printf("\twriting to reg: %s\n", reg_name);
@@ -65,7 +63,7 @@
cs_m68k* m68k;
cs_detail* detail;
int i;
-
+
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
if (ins->detail == NULL)
return;
@@ -119,7 +117,7 @@
break;
}
}
-
+
printf("\n");
}
diff --git a/cstool/cstool_mips.c b/cstool/cstool_mips.c
index 01557f3..9706640 100644
--- a/cstool/cstool_mips.c
+++ b/cstool/cstool_mips.c
@@ -12,15 +12,15 @@
{
int i;
cs_mips *mips;
-
+
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
if (ins->detail == NULL)
return;
-
+
mips = &(ins->detail->mips);
if (mips->op_count)
printf("\top_count: %u\n", mips->op_count);
-
+
for (i = 0; i < mips->op_count; i++) {
cs_mips_op *op = &(mips->operands[i]);
switch((int)op->type) {
@@ -39,11 +39,11 @@
i, cs_reg_name(handle, op->mem.base));
if (op->mem.disp != 0)
printf("\t\t\toperands[%u].mem.disp: 0x%" PRIx64 "\n", i, op->mem.disp);
-
+
break;
}
-
+
}
-
+
printf("\n");
}
diff --git a/cstool/cstool_x86.c b/cstool/cstool_x86.c
index 339c53a..2b72ff3 100644
--- a/cstool/cstool_x86.c
+++ b/cstool/cstool_x86.c
@@ -118,19 +118,16 @@
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
if (ins->detail == NULL)
return;
-
+
x86 = &(ins->detail->x86);
-
+
print_string_hex("\tPrefix:", x86->prefix, 4);
-
print_string_hex("\tOpcode:", x86->opcode, 4);
-
printf("\trex: 0x%x\n", x86->rex);
-
printf("\taddr_size: %u\n", x86->addr_size);
printf("\tmodrm: 0x%x\n", x86->modrm);
printf("\tdisp: 0x%x\n", x86->disp);
-
+
// SIB is not available in 16-bit mode
if ((mode & CS_MODE_16) == 0) {
printf("\tsib: 0x%x\n", x86->sib);
@@ -141,32 +138,32 @@
if (x86->sib_scale != 0)
printf("\t\tsib_scale: %d\n", x86->sib_scale);
}
-
+
// XOP code condition
if (x86->xop_cc != X86_XOP_CC_INVALID) {
printf("\txop_cc: %u\n", x86->xop_cc);
}
-
+
// SSE code condition
if (x86->sse_cc != X86_SSE_CC_INVALID) {
printf("\tsse_cc: %u\n", x86->sse_cc);
}
-
+
// AVX code condition
if (x86->avx_cc != X86_AVX_CC_INVALID) {
printf("\tavx_cc: %u\n", x86->avx_cc);
}
-
+
// AVX Suppress All Exception
if (x86->avx_sae) {
printf("\tavx_sae: %u\n", x86->avx_sae);
}
-
+
// AVX Rounding Mode
if (x86->avx_rm != X86_AVX_RM_INVALID) {
printf("\tavx_rm: %u\n", x86->avx_rm);
}
-
+
// Print out all immediate operands
count = cs_op_count(ud, ins, X86_OP_IMM);
if (count) {
@@ -176,14 +173,14 @@
printf("\t\timms[%u]: 0x%" PRIx64 "\n", i, x86->operands[index].imm);
}
}
-
+
if (x86->op_count)
printf("\top_count: %u\n", x86->op_count);
-
+
// Print out all operands
for (i = 0; i < x86->op_count; i++) {
cs_x86_op *op = &(x86->operands[i]);
-
+
switch((int)op->type) {
case X86_OP_REG:
printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(ud, op->reg));
@@ -207,17 +204,17 @@
default:
break;
}
-
+
// AVX broadcast type
if (op->avx_bcast != X86_AVX_BCAST_INVALID)
printf("\t\toperands[%u].avx_bcast: %u\n", i, op->avx_bcast);
-
+
// AVX zero opmask {z}
if (op->avx_zero_opmask != false)
printf("\t\toperands[%u].avx_zero_opmask: TRUE\n", i);
-
+
printf("\t\toperands[%u].size: %u\n", i, op->size);
-
+
switch(op->access) {
default:
break;
@@ -232,7 +229,7 @@
break;
}
}
-
+
// Print out all registers accessed by this instruction (either implicit or explicit)
if (!cs_regs_access(ud, ins,
regs_read, ®s_read_count,
@@ -244,7 +241,7 @@
}
printf("\n");
}
-
+
if (regs_write_count) {
printf("\tRegisters modified:");
for(i = 0; i < regs_write_count; i++) {
@@ -253,7 +250,7 @@
printf("\n");
}
}
-
+
if (x86->eflags) {
printf("\tEFLAGS:");
for(i = 0; i <= 45; i++)
@@ -262,6 +259,6 @@
}
printf("\n");
}
-
+
printf("\n");
}