From 78c53bfec869cb40f5f21fb219cbaa722c69fe64 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 14 Jan 2023 18:47:37 +0100 Subject: [PATCH] Jit64: Fix the offsetAddedToAddress correction The LEA that the signal handler is trying to undo the effects of is a 32-bit instruction, and the value in the register prior to the LEA is also 32-bit, so the signal handler should use a 32-bit write. (Actually, in the end this doesn't really matter, because the first instruction that reads this value after backpatching is also a 32-bit instruction...) --- Source/Core/Core/PowerPC/Jit64/Jit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 62108eea6538..75d788c413e9 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -329,7 +329,7 @@ bool Jit64::BackPatch(SContext* ctx) if (info.offsetAddedToAddress) { u64* ptr = ContextRN(ctx, info.op_arg.GetSimpleReg()); - *ptr -= static_cast(info.offset); + *ptr = static_cast(*ptr - info.offset); } ctx->CTX_PC = reinterpret_cast(trampoline);