summaryrefslogtreecommitdiff
path: root/Source/Core/DSPCore/Src/DSPCore.cpp
diff options
context:
space:
mode:
authornakeee <nakeee@gmail.com>2009-08-17 20:11:44 +0000
committernakeee <nakeee@gmail.com>2009-08-17 20:11:44 +0000
commit9dc90df0af56182809f05b22626699474128b118 (patch)
tree21066155cc11552b197f0d1ec58a6e4b29822fa9 /Source/Core/DSPCore/Src/DSPCore.cpp
parentfea2aa344dd957cf8324898bc4beb55ecb3b33ee (diff)
DSPLLE: small cleanup
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4015 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DSPCore/Src/DSPCore.cpp')
-rw-r--r--Source/Core/DSPCore/Src/DSPCore.cpp85
1 files changed, 39 insertions, 46 deletions
diff --git a/Source/Core/DSPCore/Src/DSPCore.cpp b/Source/Core/DSPCore/Src/DSPCore.cpp
index aff0a26721..a82a39d7fa 100644
--- a/Source/Core/DSPCore/Src/DSPCore.cpp
+++ b/Source/Core/DSPCore/Src/DSPCore.cpp
@@ -154,10 +154,6 @@ void DSPCore_Reset()
void DSPCore_SetException(u8 level)
{
-#ifdef DEBUG_EXP
- NOTICE_LOG(DSPLLE, "Set exception %d", level);
-#endif
-
g_dsp.exceptions |= 1 << level;
}
@@ -165,58 +161,55 @@ void DSPCore_SetException(u8 level)
void DSPCore_CheckExternalInterrupt()
{
// check if there is an external interrupt
- if (g_dsp.cr & CR_EXTERNAL_INT) {
- if (dsp_SR_is_flag_set(SR_EXT_INT_ENABLE) && g_dsp.exception_in_progress == -1) {
-#ifdef DEBUG_EXP
- NOTICE_LOG(DSP_MAIL, "External interrupt fired");
-#endif
- // Signal the SPU about new mail
- DSPCore_SetException(EXP_INT);
-
- g_dsp.cr &= ~CR_EXTERNAL_INT;
- } else {
-#ifdef DEBUG_EXP
- ERROR_LOG(DSP_MAIL, "External interrupt failed(masked) by %d", g_dsp.exception_in_progress);
-#endif
- }
- }
+ if (! g_dsp.cr & CR_EXTERNAL_INT)
+ return;
+
+ if (! dsp_SR_is_flag_set(SR_EXT_INT_ENABLE))
+ return;
+
+ // Signal the SPU about new mail
+ DSPCore_SetException(EXP_INT);
+
+ g_dsp.cr &= ~CR_EXTERNAL_INT;
}
void DSPCore_CheckExceptions()
{
+ if (g_dsp.exceptions == 0)
+ return;
+
// it's unclear what to do when there are two exceptions are the same time
// but for sure they should not be called together therefore the
- // g_dsp.exception_in_progress_hack
- if (g_dsp.exceptions != 0) {
- if (g_dsp.exception_in_progress == -1) {
- // check exceptions should it be 0..7 or 7..0?
- for (int i = 7; i >= 0; i--) {
- // Seems exp int or reset 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 && dsp_SR_is_flag_set(SR_EXT_INT_ENABLE)) || i == EXP_RESET) {
- _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;
- break;
- } else {
+ // g_dsp.exception_in_progress
+ if (g_dsp.exception_in_progress != -1) {
#ifdef DEBUG_EXP
- ERROR_LOG(DSPLLE, "Firing exception %d failed", i);
-#endif
- }
- }
- }
- } else {
+ 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
+ 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;
+ break;
+ } else {
#ifdef DEBUG_EXP
- ERROR_LOG(DSPLLE, "Firing exception %d failed exception %d active", g_dsp.exceptions, g_dsp.exception_in_progress);
+ ERROR_LOG(DSPLLE, "Firing exception %d failed", i);
#endif
+ }
}
}
}