A64/data_processing_pcrel: bug: ADR{,P} instructions sign extend their immediate
This commit is contained in:
parent
7c4b70751c
commit
21fe61eac6
1 changed files with 2 additions and 2 deletions
|
@ -10,14 +10,14 @@ namespace Dynarmic {
|
||||||
namespace A64 {
|
namespace A64 {
|
||||||
|
|
||||||
bool TranslatorVisitor::ADR(Imm<2> immlo, Imm<19> immhi, Reg Rd) {
|
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();
|
u64 base = ir.PC();
|
||||||
X(64, Rd, ir.Imm64(base + imm));
|
X(64, Rd, ir.Imm64(base + imm));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::ADRP(Imm<2> immlo, Imm<19> immhi, Reg Rd) {
|
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);
|
u64 base = ir.PC() & ~u64(0xFFF);
|
||||||
X(64, Rd, ir.Imm64(base + imm));
|
X(64, Rd, ir.Imm64(base + imm));
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue