mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
[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.
This commit is contained in:
parent
c3c80e9440
commit
ca04601b14
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user