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:
skidau 2011-01-16 11:13:23 +00:00
parent f9f7629268
commit e3d7e39b3e
4 changed files with 19 additions and 8 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -321,8 +321,16 @@ u16 DSP_WriteControlRegister(u16 _uFlag)
// and immediately process it, if it has.
if (_uFlag & 2)
{
DSPCore_CheckExternalInterrupt();
DSPCore_CheckExceptions();
if (!g_dspInitialize.bOnThread)
{
DSPCore_CheckExternalInterrupt();
DSPCore_CheckExceptions();
}
else
{
DSPCore_SetExternalInterrupt(true);
}
}
return DSPInterpreter::ReadCR();