Skip to content

Commit

Permalink
Correctly handle left shift and 64-bit sign extension for PC relative…
Browse files Browse the repository at this point in the history
… addressing instructions (ADR and ADRP)
  • Loading branch information
ssunny7 committed May 20, 2016
1 parent f47f425 commit 4618ea2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions instructionAPI/src/InstructionDecoder-aarch64.C
Original file line number Diff line number Diff line change
Expand Up @@ -2590,10 +2590,12 @@ void InstructionDecoder_aarch64::OPRimm()
else if(IS_FIELD_IMMHI(startBit, endBit))
{
int page = field<31, 31>(insn);
int offset = (immVal<<immloLen) | immlo;
int64_t offset = (immVal<<immloLen) | immlo;
offset = offset<<(page*12);
int size = immloLen + immLen + (page*12);

insn_in_progress->appendOperand(makePCExpr(), true, false);
Expression::Ptr imm = Immediate::makeImmediate(Result(s64, sign_extend64(immloLen + immLen + page*12, offset<<(page*12))));
Expression::Ptr imm = Immediate::makeImmediate(Result(s64, (offset << (64 - size)) >> (64 - size)));

insn_in_progress->appendOperand(imm, true, false);
}
Expand Down

0 comments on commit 4618ea2

Please sign in to comment.