diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2014-12-02 19:07:31 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2014-12-02 21:08:38 -0600 |
| commit | ca04601b141bca5aea325aa2708c299ce964786b (patch) | |
| tree | 60d0dbc73b0f9652f98fb73ad50af37fe6d6465d /Source | |
| parent | c3c80e94400653cd80db5cb30406d6ad1368cf4d (diff) | |
[AArch64] Fixes the dispatcher
Changes the dispatcher to make sure to we are saving the LR(X30) to the stack. Also makes sure to keep the stack aligned.
AArch64's AAPCS64 mandates the stack to be quad-word aligned.
Fixes the dispatcher from infinite looping due to a downcount check jumping to the dispatcher. This was because checking exceptions and the state
pointer wouldn't reset the global conditional flags. So it would leave the timing/exception, jump to the start of the dispatcher and then jump back
again due to the conditional branch.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/PowerPC/JitArm64/JitAsm.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Source/Core/Core/PowerPC/JitArm64/JitAsm.cpp b/Source/Core/Core/PowerPC/JitArm64/JitAsm.cpp index ee36b50e63..0cc89722cc 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitAsm.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitAsm.cpp @@ -15,6 +15,9 @@ void JitArm64AsmRoutineManager::Generate() { enterCode = GetCodePtr(); + SUB(SP, SP, 16); + STR(INDEX_UNSIGNED, X30, SP, 0); + MOVI2R(X29, (u64)&PowerPC::ppcState); dispatcher = GetCodePtr(); @@ -64,14 +67,20 @@ void JitArm64AsmRoutineManager::Generate() // Check the state pointer to see if we are exiting // Gets checked on every exception check - MOVI2R(W0, (u64)PowerPC::GetStatePtr()); - LDR(INDEX_UNSIGNED, W0, W0, 0); - FixupBranch Exit = CBNZ(W0); + MOVI2R(X0, (u64)PowerPC::GetStatePtr()); + LDR(INDEX_UNSIGNED, W0, X0, 0); + + CMP(W0, 0); + FixupBranch Exit = B(CC_NEQ); B(dispatcher); SetJumpTarget(Exit); + LDR(INDEX_UNSIGNED, X30, SP, 0); + ADD(SP, SP, 16); + RET(X30); + FlushIcache(); } |
