CPU/Recompiler: Align ARM32 backpatch thunk calls

Pad odd register save lists with the reserved state register to preserve the required eight-byte stack alignment when calling memory helpers.
This commit is contained in:
Stenzek
2026-10-10 21:47:42 +10:00
parent beb75d1dec
commit a5d6e76ef1
+7
View File
@@ -2542,6 +2542,10 @@ u32 CPU::Recompiler::CompileLoadStoreThunk(void* thunk_code, u32 thunk_space, vo
save_regs.Combine(RegisterList(Register(i)));
}
const bool pad_stack = ((save_regs.GetCount() & 1) != 0);
if (pad_stack)
armAsm->sub(sp, sp, 4);
if (!save_regs.IsEmpty())
armAsm->push(save_regs);
@@ -2642,6 +2646,9 @@ u32 CPU::Recompiler::CompileLoadStoreThunk(void* thunk_code, u32 thunk_space, vo
if (!save_regs.IsEmpty())
armAsm->pop(save_regs);
if (pad_stack)
armAsm->add(sp, sp, 4);
armEmitJmp(armAsm, static_cast<const u8*>(code_address) + code_size, true);
armAsm->FinalizeCode();