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
This commit is contained in:
bushing 2008-12-25 02:24:46 +00:00
parent 0ed845f3d4
commit 84711122ee
2 changed files with 3 additions and 20 deletions

View File

@ -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) {

View File

@ -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();