Disassembly bug fixes.
This commit is contained in:
parent
01e26ce3a8
commit
f3c66c5aa4
13
dis.c
13
dis.c
|
@ -438,6 +438,13 @@ int dis_decode(u_int8_t *code, u_int16_t offset, u_int16_t len,
|
|||
find_cgens(insn);
|
||||
find_emulated_ops(insn);
|
||||
|
||||
if (insn->is_byte_op) {
|
||||
if (insn->src_mode == MSP430_AMODE_IMMEDIATE)
|
||||
insn->src_addr &= 0xff;
|
||||
if (insn->dst_mode == MSP430_AMODE_IMMEDIATE)
|
||||
insn->dst_addr &= 0xff;
|
||||
}
|
||||
|
||||
insn->len = ret;
|
||||
return ret;
|
||||
}
|
||||
|
@ -538,7 +545,6 @@ static int format_addr(msp430_amode_t amode, u_int16_t addr)
|
|||
const char *prefix = "";
|
||||
|
||||
switch (amode) {
|
||||
case MSP430_AMODE_SYMBOLIC:
|
||||
case MSP430_AMODE_REGISTER:
|
||||
case MSP430_AMODE_INDIRECT:
|
||||
case MSP430_AMODE_INDIRECT_INC:
|
||||
|
@ -553,6 +559,9 @@ static int format_addr(msp430_amode_t amode, u_int16_t addr)
|
|||
case MSP430_AMODE_ABSOLUTE:
|
||||
prefix = "&";
|
||||
break;
|
||||
|
||||
case MSP430_AMODE_SYMBOLIC:
|
||||
break;
|
||||
}
|
||||
|
||||
len = printf("%s", prefix);
|
||||
|
@ -672,7 +681,7 @@ static void dis_format(const struct msp430_instruction *insn)
|
|||
|
||||
printf(",");
|
||||
count++;
|
||||
while (count < 19) {
|
||||
while (count < 23) {
|
||||
count++;
|
||||
printf(" ");
|
||||
}
|
||||
|
|
5
main.c
5
main.c
|
@ -185,7 +185,7 @@ static int cmd_dis(char **arg)
|
|||
char *len_text = get_arg(arg);
|
||||
int offset = 0;
|
||||
int length = 0x40;
|
||||
u_int8_t buf[512];
|
||||
u_int8_t buf[4096];
|
||||
|
||||
if (!off_text) {
|
||||
fprintf(stderr, "md: offset must be specified\n");
|
||||
|
@ -1034,6 +1034,9 @@ int main(int argc, char **argv)
|
|||
while (optind < argc)
|
||||
process_command(argv[optind++], 0);
|
||||
} else {
|
||||
printf("\n");
|
||||
cmd_help(NULL);
|
||||
|
||||
do {
|
||||
reader_loop();
|
||||
} while (syms_modify_check());
|
||||
|
|
Loading…
Reference in New Issue