From 514bf93bf901a74d90f75d40a2b68b95f447538b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 1 Apr 2013 23:54:19 -0700 Subject: [PATCH] Don't trigger an interrupt when cb = -1. --- GPU/GPUCommon.cpp | 31 ++++++++++++++++--------------- GPU/GPUInterface.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 15 deletions(-) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 09c9f14b4..8071a87d9 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -1,3 +1,4 @@ +#include #include "base/timeutil.h" #include "GeDisasm.h" #include "GPUCommon.h" @@ -50,8 +51,9 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head) dl.pc = listpc & 0xFFFFFFF; dl.stall = stall & 0xFFFFFFF; dl.status = PSP_GE_LIST_QUEUED; - dl.subIntrBase = subIntrBase; + dl.subIntrBase = std::max(subIntrBase, -1); dl.stackptr = 0; + dl.signal = PSP_GE_SIGNAL_NONE; if(head) dlQueue.push_front(dl); else @@ -247,15 +249,11 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) { break; case GE_CMD_SIGNAL: - { - // Processed in GE_END. Has data. - currentList->subIntrToken = data & 0xFFFF; - } + // Processed in GE_END. break; case GE_CMD_FINISH: currentList->subIntrToken = data & 0xFFFF; - // TODO: Should this run while interrupts are suspended? if (interruptsEnabled_) __GeTriggerInterrupt(currentList->id, currentList->pc, currentList->subIntrBase, currentList->subIntrToken); break; @@ -269,32 +267,35 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) { int behaviour = (prev >> 16) & 0xFF; int signal = prev & 0xFFFF; int enddata = data & 0xFFFF; - // We should probably defer to sceGe here, no sense in implementing this stuff in every GPU + currentList->subIntrToken = signal; + switch (behaviour) { - case 1: // Signal with Wait + case PSP_GE_SIGNAL_HANDLER_SUSPEND: ERROR_LOG(G3D, "Signal with Wait UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); break; - case 2: + case PSP_GE_SIGNAL_HANDLER_CONTINUE: ERROR_LOG(G3D, "Signal without wait. signal/end: %04x %04x", signal, enddata); break; - case 3: + case PSP_GE_SIGNAL_HANDLER_PAUSE: ERROR_LOG(G3D, "Signal with Pause UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); break; - case 0x10: + case PSP_GE_SIGNAL_SYNC: + ERROR_LOG(G3D, "Signal with Sync UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); + break; + case PSP_GE_SIGNAL_JUMP: ERROR_LOG(G3D, "Signal with Jump UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); break; - case 0x11: + case PSP_GE_SIGNAL_CALL: ERROR_LOG(G3D, "Signal with Call UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); break; - case 0x12: + case PSP_GE_SIGNAL_RET: ERROR_LOG(G3D, "Signal with Return UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); break; default: ERROR_LOG(G3D, "UNKNOWN Signal UNIMPLEMENTED %i ! signal/end: %04x %04x", behaviour, signal, enddata); break; } - // TODO: Should this run while interrupts are suspended? - if (interruptsEnabled_) + if (currentList->subIntrBase >= 0 && interruptsEnabled_) __GeTriggerInterrupt(currentList->id, currentList->pc, currentList->subIntrBase, currentList->subIntrToken); } break; diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index ad5fbf64c..e4c3f2197 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -33,6 +33,43 @@ enum DisplayListStatus PSP_GE_LIST_CANCEL_DONE = 5, // canceled? }; +enum SignalBehavior +{ + PSP_GE_SIGNAL_NONE = 0x00, + PSP_GE_SIGNAL_HANDLER_SUSPEND = 0x01, + PSP_GE_SIGNAL_HANDLER_CONTINUE = 0x02, + PSP_GE_SIGNAL_HANDLER_PAUSE = 0x03, + PSP_GE_SIGNAL_SYNC = 0x08, + PSP_GE_SIGNAL_JUMP = 0x10, + PSP_GE_SIGNAL_CALL = 0x11, + PSP_GE_SIGNAL_RET = 0x12, + PSP_GE_SIGNAL_RJUMP = 0x13, + PSP_GE_SIGNAL_RCALL = 0x14, + PSP_GE_SIGNAL_OJUMP = 0x15, + PSP_GE_SIGNAL_OCALL = 0x16, + + PSP_GE_SIGNAL_RTBP0 = 0x20, + PSP_GE_SIGNAL_RTBP1 = 0x21, + PSP_GE_SIGNAL_RTBP2 = 0x22, + PSP_GE_SIGNAL_RTBP3 = 0x23, + PSP_GE_SIGNAL_RTBP4 = 0x24, + PSP_GE_SIGNAL_RTBP5 = 0x25, + PSP_GE_SIGNAL_RTBP6 = 0x26, + PSP_GE_SIGNAL_RTBP7 = 0x27, + PSP_GE_SIGNAL_OTBP0 = 0x28, + PSP_GE_SIGNAL_OTBP1 = 0x29, + PSP_GE_SIGNAL_OTBP2 = 0x2A, + PSP_GE_SIGNAL_OTBP3 = 0x2B, + PSP_GE_SIGNAL_OTBP4 = 0x2C, + PSP_GE_SIGNAL_OTBP5 = 0x2D, + PSP_GE_SIGNAL_OTBP6 = 0x2E, + PSP_GE_SIGNAL_OTBP7 = 0x2F, + PSP_GE_SIGNAL_RCBP = 0x30, + PSP_GE_SIGNAL_OCBP = 0x38, + PSP_GE_SIGNAL_BREAK1 = 0xF0, + PSP_GE_SIGNAL_BREAK2 = 0xFF, +}; + // Used for debug struct FramebufferInfo @@ -52,6 +89,7 @@ struct DisplayList u32 pc; u32 stall; DisplayListStatus status; + SignalBehavior signal; int subIntrBase; u16 subIntrToken; u32 stack[32];