Fix stack misalignment issues.

- Call ABI_AlignStack even on x86-64.

- Have ABI_AlignStack respect the difference in current alignment
  between the root JIT function, which has a prolog, and
  ProtectFunction thunks, which do not.  This was causing many games
  to crash on start on OS X.  Since this might otherwise mean changing
  the stack pointer before every call...

- Have one prolog/epilog function rather than two (one of which
  definitely did not do what it was thought to do), and make it
  actually work like a normal one, so that the stack frame shows up
  properly in the debugger.  There should be no performance impact.
This commit is contained in:
comex
2013-09-19 21:10:32 -04:00
parent 95aac4ff68
commit d334a9bc23
5 changed files with 116 additions and 164 deletions

View File

@ -409,7 +409,7 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
emitter.AlignCode4();
dl->compiled_code = emitter.GetCodePtr();
emitter.ABI_EmitPrologue(4);
emitter.ABI_PushAllCalleeSavedRegsAndAdjustStack();
while (g_pVideoData < end)
{
@ -572,7 +572,8 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
break;
}
}
emitter.ABI_EmitEpilogue(4);
emitter.ABI_PopAllCalleeSavedRegsAndAdjustStack();
emitter.RET();
INCSTAT(stats.numDListsCalled);
INCSTAT(stats.thisFrame.numDListsCalled);
Statistics::SwapDL();