Merge branch 'master' into v4.1

This commit is contained in:
Nguyen Anh Quynh 2019-01-04 17:23:50 +08:00
commit 0ff8220ade
2 changed files with 14 additions and 5 deletions

View File

@ -650,14 +650,14 @@ static bool is_indexed09_post_byte_valid(const m680x_info *info,
case 0x9D: // [n16,PCR] case 0x9D: // [n16,PCR]
insn_description->insn_size += 2; insn_description->insn_size += 2;
retval = read_byte(info, &ir, *address + 1); retval = read_byte(info, &ir, *address + 1);
address += 2; *address += 2;
return retval; return retval;
case 0x9F: // [n] case 0x9F: // [n]
insn_description->insn_size += 2; insn_description->insn_size += 2;
retval = (post_byte & 0x60) == 0 && retval = (post_byte & 0x60) == 0 &&
read_byte(info, &ir, *address + 1); read_byte(info, &ir, *address + 1);
address += 2; *address += 2;
return retval; return retval;
} }

View File

@ -135,7 +135,7 @@ static uint8_t *preprocess(char *code, size_t *size)
static void usage(char *prog) static void usage(char *prog)
{ {
printf("Cstool for Capstone Disassembler Engine v%u.%u.%u\n\n", CS_VERSION_MAJOR, CS_VERSION_MINOR, CS_VERSION_EXTRA); printf("Cstool for Capstone Disassembler Engine v%u.%u.%u\n\n", CS_VERSION_MAJOR, CS_VERSION_MINOR, CS_VERSION_EXTRA);
printf("Syntax: %s [-u|-d] <arch+mode> <assembly-hexstring> [start-address-in-hex-format]\n", prog); printf("Syntax: %s [-u|-d|-s] <arch+mode> <assembly-hexstring> [start-address-in-hex-format]\n", prog);
printf("\nThe following <arch+mode> options are supported:\n"); printf("\nThe following <arch+mode> options are supported:\n");
if (cs_support(CS_ARCH_X86)) { if (cs_support(CS_ARCH_X86)) {
@ -215,7 +215,8 @@ static void usage(char *prog)
printf("\nExtra options:\n"); printf("\nExtra options:\n");
printf(" -d show detailed information of the instructions\n"); printf(" -d show detailed information of the instructions\n");
printf(" -u show immediates as unsigned\n\n"); printf(" -u show immediates as unsigned\n");
printf(" -s decode in SKIPDATA mode\n\n");
} }
static void print_details(csh handle, cs_arch arch, cs_mode md, cs_insn *ins) static void print_details(csh handle, cs_arch arch, cs_mode md, cs_insn *ins)
@ -290,10 +291,14 @@ int main(int argc, char **argv)
cs_arch arch = CS_ARCH_ALL; cs_arch arch = CS_ARCH_ALL;
bool detail_flag = false; bool detail_flag = false;
bool unsigned_flag = false; bool unsigned_flag = false;
bool skipdata = false;
int args_left; int args_left;
while ((c = getopt (argc, argv, "udhv")) != -1) { while ((c = getopt (argc, argv, "sudhv")) != -1) {
switch (c) { switch (c) {
case 's':
skipdata = true;
break;
case 'u': case 'u':
unsigned_flag = true; unsigned_flag = true;
break; break;
@ -343,6 +348,10 @@ int main(int argc, char **argv)
if (strstr (mode, "att")) { if (strstr (mode, "att")) {
cs_option(handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT); cs_option(handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT);
} }
// turn on SKIPDATA mode
if (skipdata)
cs_option(handle, CS_OPT_SKIPDATA, CS_OPT_ON);
} }
break; break;
} }