From ac3cabec07e2f10e8abdd8cc89f022dc0cb36321 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 7 Jan 2026 09:19:13 -0800 Subject: [PATCH] Relocations: Disable 6-byte size optimization in `InsertGuestRIPMove` This wasn't handling negatives correctly which was causing xalia.exe to assert. Disable for now rather than further changing logic, with a TODO that it should get fixed in the future. --- FEXCore/Source/Interface/Core/JIT/Arm64Relocations.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FEXCore/Source/Interface/Core/JIT/Arm64Relocations.cpp b/FEXCore/Source/Interface/Core/JIT/Arm64Relocations.cpp index 7713501a7..0dd046861 100644 --- a/FEXCore/Source/Interface/Core/JIT/Arm64Relocations.cpp +++ b/FEXCore/Source/Interface/Core/JIT/Arm64Relocations.cpp @@ -94,7 +94,10 @@ void Arm64JITCore::InsertGuestRIPMove(ARMEmitter::Register Reg, uint64_t Constan MoveABI.GuestRIP.RegisterIndex = Reg.Idx(); // Pointers are required to fit within 48-bit VA space. - LoadConstant(ARMEmitter::Size::i64Bit, Reg, Constant, FEXCore::CPU::Arm64Emitter::PadType::AUTOPAD, 6); + // TODO: Force 6-byte `MaxSize`, with sign extension to 64-bit. Current code not smart enough to handle negatives. + // 48-bit sign extension works because x86-64 guests only receive 47-bit VA space, with 48-bit being reserved for kernel. + // Additional quirk, "canonical" 48-bit pointers on x86-64, sign extend the 48-bit as well (Which is why kernel pointers are negative). + LoadConstant(ARMEmitter::Size::i64Bit, Reg, Constant, FEXCore::CPU::Arm64Emitter::PadType::AUTOPAD); Relocations.emplace_back(MoveABI); }