Skip to content

Commit

Permalink
Arm Disassembler: Correct ADR target when direction is backwards (#172)
Browse files Browse the repository at this point in the history
Change-Id: Icbfd68adad233ed99a552876214e0ddf37060d2d
  • Loading branch information
hoglet67 committed Jun 21, 2023
1 parent 61adcdf commit c0ddeb5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/darm/darm.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,12 @@ static int darm_str(const darm_t *d, darm_str_t *str)
// branch stuff has been initialized yet
if(d->instr == I_BLX && d->H == B_INVLD) break;

uint32_t target = (d->addr + 8 + d->imm) & d->addr_mask;
uint32_t target;
if(d->U == B_UNSET) {
target = (d->addr + 8 - d->imm) & d->addr_mask;
} else {
target = (d->addr + 8 + d->imm) & d->addr_mask;
}
*args[arg]++ = '&';
args[arg] += _utoa(target, args[arg], 16);
continue;
Expand Down

0 comments on commit c0ddeb5

Please sign in to comment.