summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2021-06-06 22:43:38 +0200
committerJosJuice <josjuice@gmail.com>2021-06-06 22:43:57 +0200
commit4ef4ac41d1654565aa5f0a975da7ebda84118ba0 (patch)
treed2620d0832c7e4753ab63865cf6645f28199870f /Source/Core
parent684d09b342511b5a3c1809b1eef1a46c53cd3370 (diff)
JitArm64: Fix clobbering LR in FakeLKExit
Fixes Need for Speed: Carbon accessing invalid memory when branch following and BLR optimization are enabled simultaneously.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/JitArm64/Jit.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp
index b606b071ea..b3a6c4e6fd 100644
--- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp
+++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp
@@ -398,6 +398,7 @@ void JitArm64::FakeLKExit(u32 exit_address_after_return)
// We may need to fake the BLR stack on inlined CALL instructions.
// Else we can't return to this location any more.
+ gpr.Lock(ARM64Reg::W30);
ARM64Reg after_reg = gpr.GetReg();
ARM64Reg code_reg = gpr.GetReg();
MOVI2R(after_reg, exit_address_after_return);
@@ -406,6 +407,7 @@ void JitArm64::FakeLKExit(u32 exit_address_after_return)
gpr.Unlock(after_reg, code_reg);
FixupBranch skip_exit = BL();
+ gpr.Unlock(ARM64Reg::W30);
// Write the regular exit node after the return.
JitBlock* b = js.curBlock;