Skip to content

Commit

Permalink
Skipped the EE check if there is a CP interrupt pending.
Browse files Browse the repository at this point in the history
Fixes issue 4336.
  • Loading branch information
skidau committed Feb 28, 2013
1 parent b83a1e3 commit 0399959
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp
Expand Up @@ -28,6 +28,7 @@

#include "Jit.h"
#include "JitRegCache.h"
#include "HW/ProcessorInterface.h"

void Jit64::mtspr(UGeckoInstruction inst)
{
Expand Down Expand Up @@ -126,19 +127,23 @@ void Jit64::mtmsr(UGeckoInstruction inst)
// If some exceptions are pending and EE are now enabled, force checking
// external exceptions when going out of mtmsr in order to execute delayed
// interrupts as soon as possible.
MOV(32, R(EAX), M(&MSR));
TEST(32, R(EAX), Imm32(0x8000));
TEST(32, M(&MSR), Imm32(0x8000));
FixupBranch eeDisabled = J_CC(CC_Z);

MOV(32, R(EAX), M((void*)&PowerPC::ppcState.Exceptions));
TEST(32, R(EAX), Imm32(EXCEPTION_EXTERNAL_INT | EXCEPTION_PERFORMANCE_MONITOR | EXCEPTION_DECREMENTER));
TEST(32, M((void*)&PowerPC::ppcState.Exceptions), Imm32(EXCEPTION_EXTERNAL_INT | EXCEPTION_PERFORMANCE_MONITOR | EXCEPTION_DECREMENTER));
FixupBranch noExceptionsPending = J_CC(CC_Z);

// Check if a CP interrupt is waiting and keep the GPU emulation in sync (issue 4336)
TEST(32, M((void *)&ProcessorInterface::m_InterruptCause), Imm32(ProcessorInterface::INT_CAUSE_CP));
FixupBranch cpInt = J_CC(CC_NZ);

MOV(32, M(&PC), Imm32(js.compilerPC + 4));
WriteExternalExceptionExit();

SetJumpTarget(eeDisabled);
SetJumpTarget(cpInt);
SetJumpTarget(noExceptionsPending);
SetJumpTarget(eeDisabled);

WriteExit(js.compilerPC + 4, 0);

js.firstFPInstructionFound = false;
Expand Down

0 comments on commit 0399959

Please sign in to comment.