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;
|
u16 cyclesLeft = 0;
|
||||||
DSPEmitter *jit = NULL;
|
DSPEmitter *jit = NULL;
|
||||||
Common::Event step_event;
|
Common::Event step_event;
|
||||||
|
Common::CriticalSection ExtIntCriticalSection;
|
||||||
|
|
||||||
static bool LoadRom(const char *fname, int size_in_words, u16 *rom)
|
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)
|
// 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
|
// Coming from the CPU
|
||||||
|
@ -255,7 +258,7 @@ int DSPCore_RunCycles(int cycles)
|
||||||
{
|
{
|
||||||
DSPCore_CheckExternalInterrupt();
|
DSPCore_CheckExternalInterrupt();
|
||||||
DSPCore_CheckExceptions();
|
DSPCore_CheckExceptions();
|
||||||
g_dsp.external_interrupt_waiting = false;
|
DSPCore_SetExternalInterrupt(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cyclesLeft;
|
return cyclesLeft;
|
||||||
|
|
|
@ -278,7 +278,7 @@ void DSPCore_Shutdown(); // Frees all allocated memory.
|
||||||
|
|
||||||
void DSPCore_CheckExternalInterrupt();
|
void DSPCore_CheckExternalInterrupt();
|
||||||
void DSPCore_CheckExceptions();
|
void DSPCore_CheckExceptions();
|
||||||
void DSPCore_SetExternalInterrupt();
|
void DSPCore_SetExternalInterrupt(bool val);
|
||||||
|
|
||||||
// sets a flag in the pending exception register.
|
// sets a flag in the pending exception register.
|
||||||
void DSPCore_SetException(u8 level);
|
void DSPCore_SetException(u8 level);
|
||||||
|
|
|
@ -156,7 +156,7 @@ int RunCyclesDebug(int cycles)
|
||||||
{
|
{
|
||||||
DSPCore_CheckExternalInterrupt();
|
DSPCore_CheckExternalInterrupt();
|
||||||
DSPCore_CheckExceptions();
|
DSPCore_CheckExceptions();
|
||||||
g_dsp.external_interrupt_waiting = false;
|
DSPCore_SetExternalInterrupt(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -220,7 +220,7 @@ int RunCycles(int cycles)
|
||||||
{
|
{
|
||||||
DSPCore_CheckExternalInterrupt();
|
DSPCore_CheckExternalInterrupt();
|
||||||
DSPCore_CheckExceptions();
|
DSPCore_CheckExceptions();
|
||||||
g_dsp.external_interrupt_waiting = false;
|
DSPCore_SetExternalInterrupt(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
|
|
@ -321,8 +321,16 @@ u16 DSP_WriteControlRegister(u16 _uFlag)
|
||||||
// and immediately process it, if it has.
|
// and immediately process it, if it has.
|
||||||
if (_uFlag & 2)
|
if (_uFlag & 2)
|
||||||
{
|
{
|
||||||
DSPCore_CheckExternalInterrupt();
|
if (!g_dspInitialize.bOnThread)
|
||||||
DSPCore_CheckExceptions();
|
{
|
||||||
|
DSPCore_CheckExternalInterrupt();
|
||||||
|
DSPCore_CheckExceptions();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DSPCore_SetExternalInterrupt(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DSPInterpreter::ReadCR();
|
return DSPInterpreter::ReadCR();
|
||||||
|
|
Loading…
Reference in New Issue