Added a critical section around the external_interrupt_waiting variable, to be safe. Also, commit a file I missed in r6859.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6860 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f9f7629268
commit
e3d7e39b3e
|
@ -41,6 +41,7 @@ DSPCoreState core_state = DSPCORE_STOP;
|
|||
u16 cyclesLeft = 0;
|
||||
DSPEmitter *jit = NULL;
|
||||
Common::Event step_event;
|
||||
Common::CriticalSection ExtIntCriticalSection;
|
||||
|
||||
static bool LoadRom(const char *fname, int size_in_words, u16 *rom)
|
||||
{
|
||||
|
@ -192,9 +193,11 @@ void DSPCore_SetException(u8 level)
|
|||
}
|
||||
|
||||
// Notify that an external interrupt is pending (used by thread mode)
|
||||
void DSPCore_SetExternalInterrupt()
|
||||
void DSPCore_SetExternalInterrupt(bool val)
|
||||
{
|
||||
g_dsp.external_interrupt_waiting = true;
|
||||
ExtIntCriticalSection.Enter();
|
||||
g_dsp.external_interrupt_waiting = val;
|
||||
ExtIntCriticalSection.Leave();
|
||||
}
|
||||
|
||||
// Coming from the CPU
|
||||
|
@ -255,7 +258,7 @@ int DSPCore_RunCycles(int cycles)
|
|||
{
|
||||
DSPCore_CheckExternalInterrupt();
|
||||
DSPCore_CheckExceptions();
|
||||
g_dsp.external_interrupt_waiting = false;
|
||||
DSPCore_SetExternalInterrupt(false);
|
||||
}
|
||||
|
||||
return cyclesLeft;
|
||||
|
|
|
@ -278,7 +278,7 @@ void DSPCore_Shutdown(); // Frees all allocated memory.
|
|||
|
||||
void DSPCore_CheckExternalInterrupt();
|
||||
void DSPCore_CheckExceptions();
|
||||
void DSPCore_SetExternalInterrupt();
|
||||
void DSPCore_SetExternalInterrupt(bool val);
|
||||
|
||||
// sets a flag in the pending exception register.
|
||||
void DSPCore_SetException(u8 level);
|
||||
|
|
|
@ -156,7 +156,7 @@ int RunCyclesDebug(int cycles)
|
|||
{
|
||||
DSPCore_CheckExternalInterrupt();
|
||||
DSPCore_CheckExceptions();
|
||||
g_dsp.external_interrupt_waiting = false;
|
||||
DSPCore_SetExternalInterrupt(false);
|
||||
}
|
||||
|
||||
while (true)
|
||||
|
@ -220,7 +220,7 @@ int RunCycles(int cycles)
|
|||
{
|
||||
DSPCore_CheckExternalInterrupt();
|
||||
DSPCore_CheckExceptions();
|
||||
g_dsp.external_interrupt_waiting = false;
|
||||
DSPCore_SetExternalInterrupt(false);
|
||||
}
|
||||
|
||||
while (true)
|
||||
|
|
|
@ -320,10 +320,18 @@ u16 DSP_WriteControlRegister(u16 _uFlag)
|
|||
// Check if the CPU has set an external interrupt (CR_EXTERNAL_INT)
|
||||
// and immediately process it, if it has.
|
||||
if (_uFlag & 2)
|
||||
{
|
||||
if (!g_dspInitialize.bOnThread)
|
||||
{
|
||||
DSPCore_CheckExternalInterrupt();
|
||||
DSPCore_CheckExceptions();
|
||||
}
|
||||
else
|
||||
{
|
||||
DSPCore_SetExternalInterrupt(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return DSPInterpreter::ReadCR();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue