Skip to content

Commit c7eb4c8

Browse files
Merge pull request FEX-Emu#5202 from Sonicadvance1/41
Relocations: Disable 6-byte size optimization in `InsertGuestRIPMove`
2 parents 6c06f47 + ac3cabe commit c7eb4c8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

FEXCore/Source/Interface/Core/JIT/Arm64Relocations.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ void Arm64JITCore::InsertGuestRIPMove(ARMEmitter::Register Reg, uint64_t Constan
9494
MoveABI.GuestRIP.RegisterIndex = Reg.Idx();
9595

9696
// Pointers are required to fit within 48-bit VA space.
97-
LoadConstant(ARMEmitter::Size::i64Bit, Reg, Constant, FEXCore::CPU::Arm64Emitter::PadType::AUTOPAD, 6);
97+
// TODO: Force 6-byte `MaxSize`, with sign extension to 64-bit. Current code not smart enough to handle negatives.
98+
// 48-bit sign extension works because x86-64 guests only receive 47-bit VA space, with 48-bit being reserved for kernel.
99+
// Additional quirk, "canonical" 48-bit pointers on x86-64, sign extend the 48-bit as well (Which is why kernel pointers are negative).
100+
LoadConstant(ARMEmitter::Size::i64Bit, Reg, Constant, FEXCore::CPU::Arm64Emitter::PadType::AUTOPAD);
98101
Relocations.emplace_back(MoveABI);
99102
}
100103

0 commit comments

Comments
 (0)