DSP LLE: trying to clean up exception handling. Hopefully it didn't break anything
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5381 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
fadbe78a59
commit
3fb80c52af
|
@ -121,7 +121,6 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
|
|||
|
||||
g_dsp.r[DSP_REG_SR] |= SR_INT_ENABLE;
|
||||
g_dsp.r[DSP_REG_SR] |= SR_EXT_INT_ENABLE;
|
||||
g_dsp.exception_in_progress = -1;
|
||||
|
||||
g_dsp.cr = 0x804;
|
||||
gdsp_ifx_init();
|
||||
|
@ -155,9 +154,7 @@ void DSPCore_Shutdown()
|
|||
|
||||
void DSPCore_Reset()
|
||||
{
|
||||
_assert_msg_(MASTER_LOG, g_dsp.exception_in_progress == -1, "reset while exception");
|
||||
g_dsp.pc = DSP_RESET_VECTOR;
|
||||
g_dsp.exception_in_progress = -1;
|
||||
|
||||
g_dsp.r[DSP_REG_WR0] = 0xffff;
|
||||
g_dsp.r[DSP_REG_WR1] = 0xffff;
|
||||
|
@ -193,31 +190,21 @@ void DSPCore_CheckExceptions()
|
|||
if (g_dsp.exceptions == 0)
|
||||
return;
|
||||
|
||||
// it's unclear what to do when there are two exceptions at the same time
|
||||
// but for sure they should not be called together therefore the
|
||||
// g_dsp.exception_in_progress
|
||||
if (g_dsp.exception_in_progress != -1) {
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
ERROR_LOG(DSPLLE, "Firing exception %d failed exception %d active", g_dsp.exceptions, g_dsp.exception_in_progress);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 7; i > 0; i--) {
|
||||
// Seems exp int or reset are not masked by sr_int_enable
|
||||
// Seems exp int are not masked by sr_int_enable
|
||||
if (g_dsp.exceptions & (1 << i)) {
|
||||
if (dsp_SR_is_flag_set(SR_INT_ENABLE) || (i == EXP_INT)) {
|
||||
|
||||
_assert_msg_(MASTER_LOG, g_dsp.exception_in_progress == -1, "assert %d while exception", g_dsp.exception_in_progress);
|
||||
|
||||
// store pc and sr until RTI
|
||||
dsp_reg_store_stack(DSP_STACK_C, g_dsp.pc);
|
||||
dsp_reg_store_stack(DSP_STACK_D, g_dsp.r[DSP_REG_SR]);
|
||||
|
||||
g_dsp.pc = i * 2;
|
||||
g_dsp.exceptions &= ~(1 << i);
|
||||
if (i)
|
||||
g_dsp.exception_in_progress = i;
|
||||
if (i == 7)
|
||||
g_dsp.r[DSP_REG_SR] &= ~SR_EXT_INT_ENABLE;
|
||||
else
|
||||
g_dsp.r[DSP_REG_SR] &= ~SR_INT_ENABLE;
|
||||
break;
|
||||
} else {
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
|
|
|
@ -198,7 +198,6 @@ struct SDSP
|
|||
|
||||
u8 reg_stack_ptr[4];
|
||||
u8 exceptions; // pending exceptions
|
||||
int exception_in_progress; // inside exp flag
|
||||
|
||||
// DSP hardware stacks. They're mapped to a bunch of registers, such that writes
|
||||
// to them push and reads pop.
|
||||
|
|
|
@ -66,8 +66,26 @@ void DSPEmitter::ClearIRAM() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Must go out of block if exception is detected
|
||||
void DSPEmitter::checkExceptions() {
|
||||
/*
|
||||
// check if there is an external interrupt
|
||||
if (! dsp_SR_is_flag_set(SR_EXT_INT_ENABLE))
|
||||
return;
|
||||
|
||||
if (! (g_dsp.cr & CR_EXTERNAL_INT))
|
||||
return;
|
||||
|
||||
g_dsp.cr &= ~CR_EXTERNAL_INT;
|
||||
|
||||
// Check for other exceptions
|
||||
if (dsp_SR_is_flag_set(SR_INT_ENABLE))
|
||||
return;
|
||||
|
||||
if (g_dsp.exceptions == 0)
|
||||
return;
|
||||
*/
|
||||
ABI_CallFunction((void *)&DSPCore_CheckExternalInterrupt);
|
||||
// Check for interrupts and exceptions
|
||||
TEST(8, M(&g_dsp.exceptions), Imm8(0xff));
|
||||
|
@ -75,16 +93,10 @@ void DSPEmitter::checkExceptions() {
|
|||
|
||||
ABI_CallFunction((void *)&DSPCore_CheckExceptions);
|
||||
|
||||
MOV(32, R(EAX), M(&g_dsp.exception_in_progress));
|
||||
CMP(32, R(EAX), Imm32(0));
|
||||
FixupBranch noExceptionOccurred = J_CC(CC_L);
|
||||
|
||||
// ABI_CallFunction((void *)DSPInterpreter::HandleLoop);
|
||||
ABI_RestoreStack(0);
|
||||
RET();
|
||||
|
||||
SetJumpTarget(skipCheck);
|
||||
SetJumpTarget(noExceptionOccurred);
|
||||
}
|
||||
|
||||
void DSPEmitter::WriteCallInterpreter(UDSPInstruction inst)
|
||||
|
|
|
@ -126,7 +126,6 @@ void rti(const UDSPInstruction opc)
|
|||
g_dsp.r[DSP_REG_SR] = dsp_reg_load_stack(DSP_STACK_D);
|
||||
g_dsp.pc = dsp_reg_load_stack(DSP_STACK_C);
|
||||
|
||||
g_dsp.exception_in_progress = -1;
|
||||
}
|
||||
|
||||
// HALT
|
||||
|
|
Loading…
Reference in New Issue