A64/data_processing_pcrel: bug: ADR{,P} instructions sign extend their immediate

This commit is contained in:
MerryMage 2018-01-13 18:02:19 +00:00
parent 7c4b70751c
commit 21fe61eac6

View file

@ -10,14 +10,14 @@ namespace Dynarmic {
namespace A64 {
bool TranslatorVisitor::ADR(Imm<2> immlo, Imm<19> immhi, Reg Rd) {
u64 imm = concatenate(immhi, immlo).ZeroExtend<u64>();
u64 imm = concatenate(immhi, immlo).SignExtend<u64>();
u64 base = ir.PC();
X(64, Rd, ir.Imm64(base + imm));
return true;
}
bool TranslatorVisitor::ADRP(Imm<2> immlo, Imm<19> immhi, Reg Rd) {
u64 imm = concatenate(immhi, immlo).ZeroExtend<u64>() << 12;
u64 imm = concatenate(immhi, immlo).SignExtend<u64>() << 12;
u64 base = ir.PC() & ~u64(0xFFF);
X(64, Rd, ir.Imm64(base + imm));
return true;