From ba4d5b0b95f620c50f6566d506d8c477b2b9f525 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 30 Nov 2015 08:43:43 +0100 Subject: [PATCH] mvu: keep stack aligned on 16B Fix a stack fault with address sanitizer (on linux) v2: protect the code with GNUC (as it is already done in microVU_Execute.inl) --- pcsx2/x86/microVU_Misc.inl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pcsx2/x86/microVU_Misc.inl b/pcsx2/x86/microVU_Misc.inl index 397821022d..52f77fae3e 100644 --- a/pcsx2/x86/microVU_Misc.inl +++ b/pcsx2/x86/microVU_Misc.inl @@ -291,12 +291,19 @@ __fi void mVUaddrFix(mV, const x32& gprReg) xPUSH(gprT1); xPUSH(gprT2); xPUSH(gprT3); + // Align the stackframe (GCC only, since GCC assumes stackframe is always aligned) +#ifdef __GNUC__ + xSUB(esp, 4); +#endif if (IsDevBuild && !isCOP2) { // Lets see which games do this! xMOV (gprT2, mVU.prog.cur->idx); // Note: Kernel does it via COP2 to initialize VU1! xMOV (gprT3, xPC); // So we don't spam console, we'll only check micro-mode... xCALL(mVUwarningRegAccess); } xCALL(mVUwaitMTVU); +#ifdef __GNUC__ + xADD(esp, 4); +#endif xPOP (gprT3); xPOP (gprT2); xPOP (gprT1);