Skip to content

Commit

Permalink
i#1569 AArch64: Change disassembly of offsets.
Browse files Browse the repository at this point in the history
- On AArch64, disassemble offset with top bit set as negative.
- On ARM/AArch64, use 2, 4 or 8 hex digits for offset, as required.

Review-URL: https://codereview.appspot.com/302680043
  • Loading branch information
egrimley-arm committed Sep 28, 2016
1 parent 029f65d commit 7090b33
Show file tree
Hide file tree
Showing 3 changed files with 1,116 additions and 1,116 deletions.
12 changes: 6 additions & 6 deletions core/arch/disassemble_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ opnd_base_disp_disassemble(char *buf, size_t bufsz, size_t *sofar INOUT, opnd_t
if (disp != 0 || (base == REG_NULL && index == REG_NULL) ||
opnd_is_disp_encode_zero(opnd)) {
if (TEST(DR_DISASM_INTEL, DYNAMO_OPTION(disasm_mask))
/* Always negating for ARM. I would do the same for x86 but I don't
* want to break any existing scripts.
/* Always negating for ARM and AArch64. I would do the same for x86 but
* I don't want to break any existing scripts.
*/
IF_ARM(|| true)) {
IF_NOT_X86(|| true)) {
/* windbg negates if top byte is 0xff
* for x64 udis86 negates if at all negative
*/
Expand All @@ -315,10 +315,10 @@ opnd_base_disp_disassemble(char *buf, size_t bufsz, size_t *sofar INOUT, opnd_t
}
if (TEST(DR_DISASM_ARM, DYNAMO_OPTION(disasm_mask)))
print_to_buffer(buf, bufsz, sofar, "%d", disp);
else if (disp >= INT8_MIN && disp <= INT8_MAX &&
!opnd_is_disp_force_full(opnd))
else if ((unsigned)disp <= 0xff && !opnd_is_disp_force_full(opnd))
print_to_buffer(buf, bufsz, sofar, "0x%02x", disp);
else if (opnd_is_disp_short_addr(opnd))
else if ((unsigned)disp <= 0xffff
IF_X86(&& opnd_is_disp_short_addr(opnd)))
print_to_buffer(buf, bufsz, sofar, "0x%04x", disp);
else /* there are no 64-bit displacements */
print_to_buffer(buf, bufsz, sofar, "0x%08x", disp);
Expand Down
Loading

0 comments on commit 7090b33

Please sign in to comment.