diff options
| author | shuffle2 <godisgovernment@gmail.com> | 2014-09-18 15:46:10 -0700 |
|---|---|---|
| committer | shuffle2 <godisgovernment@gmail.com> | 2014-09-18 15:46:10 -0700 |
| commit | fcf1016827086341969ef60380da2efead9be02f (patch) | |
| tree | 1bd087eca101862a77511788c42b8a8631486c38 /Source/Core | |
| parent | e9164247d6e8adcba659226205b268becdc9b00c (diff) | |
| parent | 3df935b98ee1df8798f13aa81054297257bb89d8 (diff) | |
Merge pull request #1116 from comex/fix-blr-optimization-again-simpler
Reset RSP after calling Jit in case it cleared the code cache.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64/JitAsm.cpp | 24 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64/JitAsm.h | 1 |
2 files changed, 16 insertions, 9 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp index dcfffaa3e9..73dfb8af66 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp @@ -56,10 +56,7 @@ void Jit64AsmRoutineManager::Generate() ABI_PopRegistersAndAdjustStack(1 << RSCRATCH, 0); #endif - if (m_stack_top) - MOV(64, R(RSP), Imm64((u64)m_stack_top - 0x20)); - else - MOV(64, R(RSP), M(&s_saved_rsp)); + ResetStack(); SUB(32, PPCSTATE(downcount), R(RSCRATCH)); @@ -147,6 +144,9 @@ void Jit64AsmRoutineManager::Generate() ABI_CallFunctionA((void *)&Jit, PPCSTATE(pc)); ABI_PopRegistersAndAdjustStack(0, 0); + // Jit might have cleared the code cache + ResetStack(); + JMP(dispatcherNoCheck); // no point in special casing this SetJumpTarget(bail); @@ -168,21 +168,27 @@ void Jit64AsmRoutineManager::Generate() //Landing pad for drec space if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging) SetJumpTarget(dbg_exit); + ResetStack(); if (m_stack_top) { - MOV(64, R(RSP), Imm64((u64)m_stack_top - 0x8)); + ADD(64, R(RSP), Imm8(0x18)); POP(RSP); } - else - { - MOV(64, R(RSP), M(&s_saved_rsp)); - } ABI_PopRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8, 16); RET(); GenerateCommon(); } +void Jit64AsmRoutineManager::ResetStack() +{ + if (m_stack_top) + MOV(64, R(RSP), Imm64((u64)m_stack_top - 0x20)); + else + MOV(64, R(RSP), M(&s_saved_rsp)); +} + + void Jit64AsmRoutineManager::GenerateCommon() { fifoDirectWrite8 = AlignCode4(); diff --git a/Source/Core/Core/PowerPC/Jit64/JitAsm.h b/Source/Core/Core/PowerPC/Jit64/JitAsm.h index 9272f5c8aa..9d999b558f 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitAsm.h +++ b/Source/Core/Core/PowerPC/Jit64/JitAsm.h @@ -24,6 +24,7 @@ class Jit64AsmRoutineManager : public CommonAsmRoutines { private: void Generate(); + void ResetStack(); void GenerateCommon(); u8* m_stack_top; |
