From 84711122eec14929bd1fcb1996a6a5c1cd729f48 Mon Sep 17 00:00:00 2001 From: bushing Date: Thu, 25 Dec 2008 02:24:46 +0000 Subject: [PATCH] Linux may not care, but Darwin will barf if we don't actually align the stack on the code we generate. Fix some existing code to do what the comments claim it already does, and then actually use that code. :) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1650 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/ABI.cpp | 2 ++ Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp | 21 +------------------ 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/Source/Core/Common/Src/ABI.cpp b/Source/Core/Common/Src/ABI.cpp index 941a1e9ff8..a481663eaf 100644 --- a/Source/Core/Common/Src/ABI.cpp +++ b/Source/Core/Common/Src/ABI.cpp @@ -103,6 +103,7 @@ void XEmitter::ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2 } void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() { + ABI_AlignStack(0); // Note: 4 * 4 = 16 bytes, so alignment is preserved. PUSH(EBP); PUSH(EBX); @@ -115,6 +116,7 @@ void XEmitter::ABI_PopAllCalleeSavedRegsAndAdjustStack() { POP(ESI); POP(EBX); POP(EBP); + ABI_RestoreStack(0); } unsigned int XEmitter::ABI_GetAlignedFrameSize(unsigned int frameSize) { diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp index ad7bb21e0f..856829de98 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp @@ -67,13 +67,8 @@ AsmRoutineManager asm_routines; void AsmRoutineManager::Generate() { enterCode = AlignCode16(); -#ifdef _M_IX86 - PUSH(EBP); - PUSH(EBX); - PUSH(ESI); - PUSH(EDI); -#else ABI_PushAllCalleeSavedRegsAndAdjustStack(); +#ifndef _M_IX86 // Two statically allocated registers. MOV(64, R(RBX), Imm64((u64)Memory::base)); MOV(64, R(R15), Imm64((u64)jit.GetBlockCache()->GetCodePointers())); //It's below 2GB so 32 bits are good enough @@ -162,27 +157,13 @@ void AsmRoutineManager::Generate() TEST(32, M((void*)&PowerPC::state), Imm32(0xFFFFFFFF)); J_CC(CC_Z, outerLoop, true); -#ifdef _M_IX86 - POP(EDI); - POP(ESI); - POP(EBX); - POP(EBP); -#else //Landing pad for drec space ABI_PopAllCalleeSavedRegsAndAdjustStack(); -#endif RET(); breakpointBailout = GetCodePtr(); -#ifdef _M_IX86 - POP(EDI); - POP(ESI); - POP(EBX); - POP(EBP); -#else //Landing pad for drec space ABI_PopAllCalleeSavedRegsAndAdjustStack(); -#endif RET(); GenerateCommon();