/[pcsx2_0.9.7]/trunk/pcsx2/R3000A.cpp
ViewVC logotype

Diff of /trunk/pcsx2/R3000A.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/pcsx2/R3000A.cpp	2010/09/07 03:24:11	31
+++ trunk/pcsx2/R3000A.cpp	2010/09/07 11:08:22	62
@@ -29,22 +29,22 @@
 u32 g_psxHasConstReg, g_psxFlushedConstReg;
 
 // Controls when branch tests are performed.
-u32 g_psxNextBranchCycle = 0;
+u32 g_iopNextEventCycle = 0;
 
 // This value is used when the IOP execution is broken to return control to the EE.
 // (which happens when the IOP throws EE-bound interrupts).  It holds the value of
-// psxCycleEE (which is set to zero to facilitate the code break), so that the unrun
+// iopCycleEE (which is set to zero to facilitate the code break), so that the unrun
 // cycles can be accounted for later.
-s32 psxBreak = 0;
+s32 iopBreak = 0;
 
 // tracks the IOP's current sync status with the EE.  When it dips below zero,
 // control is returned to the EE.
-s32 psxCycleEE = -1;
+s32 iopCycleEE = -1;
 
 // Used to signal to the EE when important actions that need IOP-attention have
 // happened (hsyncs, vsyncs, IOP exceptions, etc).  IOP runs code whenever this
 // is true, even if it's already running ahead a bit.
-bool iopBranchAction = false;
+bool iopEventAction = false;
 
 bool iopEventTestIsActive = false;
 
@@ -58,9 +58,9 @@
 	psxRegs.CP0.n.Status = 0x10900000; // COP0 enabled | BEV = 1 | TS = 1
 	psxRegs.CP0.n.PRid   = 0x0000001f; // PRevID = Revision ID, same as the IOP R3000A
 
-	psxBreak = 0;
-	psxCycleEE = -1;
-	g_psxNextBranchCycle = psxRegs.cycle + 4;
+	iopBreak = 0;
+	iopCycleEE = -1;
+	g_iopNextEventCycle = psxRegs.cycle + 4;
 
 	psxHwReset();
 
@@ -108,21 +108,21 @@
 	}*/
 }
 
-__forceinline void psxSetNextBranch( u32 startCycle, s32 delta )
+__fi void psxSetNextBranch( u32 startCycle, s32 delta )
 {
 	// typecast the conditional to signed so that things don't blow up
 	// if startCycle is greater than our next branch cycle.
 
-	if( (int)(g_psxNextBranchCycle - startCycle) > delta )
-		g_psxNextBranchCycle = startCycle + delta;
+	if( (int)(g_iopNextEventCycle - startCycle) > delta )
+		g_iopNextEventCycle = startCycle + delta;
 }
 
-__forceinline void psxSetNextBranchDelta( s32 delta )
+__fi void psxSetNextBranchDelta( s32 delta )
 {
 	psxSetNextBranch( psxRegs.cycle, delta );
 }
 
-__forceinline int psxTestCycle( u32 startCycle, s32 delta )
+__fi int psxTestCycle( u32 startCycle, s32 delta )
 {
 	// typecast the conditional to signed so that things don't explode
 	// if the startCycle is ahead of our current cpu cycle.
@@ -130,7 +130,7 @@
 	return (int)(psxRegs.cycle - startCycle) >= delta;
 }
 
-__forceinline void PSX_INT( IopEventId n, s32 ecycle )
+__fi void PSX_INT( IopEventId n, s32 ecycle )
 {
 	// Generally speaking games shouldn't throw ints that haven't been cleared yet.
 	// It's usually indicative of something amiss in our emulation, so uncomment this
@@ -151,17 +151,17 @@
 
 	psxSetNextBranchDelta( ecycle );
 
-	if( psxCycleEE < 0 )
+	if( iopCycleEE < 0 )
 	{
 		// The EE called this int, so inform it to branch as needed:
 		// fixme - this doesn't take into account EE/IOP sync (the IOP may be running
 		// ahead or behind the EE as per the EEsCycles value)
-		s32 iopDelta = (g_psxNextBranchCycle-psxRegs.cycle)*8;
-		cpuSetNextBranchDelta( iopDelta );
+		s32 iopDelta = (g_iopNextEventCycle-psxRegs.cycle)*8;
+		cpuSetNextEventDelta( iopDelta );
 	}
 }
 
-static __forceinline void IopTestEvent( IopEventId n, void (*callback)() )
+static __fi void IopTestEvent( IopEventId n, void (*callback)() )
 {
 	if( !(psxRegs.interrupt & (1 << n)) ) return;
 
@@ -174,7 +174,7 @@
 		psxSetNextBranch( psxRegs.sCycle[n], psxRegs.eCycle[n] );
 }
 
-static __forceinline void sifHackInterrupt()
+static __fi void sifHackInterrupt()
 {
 	// No reason -- just that sometimes the SIF fell asleep, and this wakes it up.
 
@@ -186,7 +186,7 @@
 	//PSX_INT( IopEvt_SIFhack, 128 );
 }
 
-static __forceinline void _psxTestInterrupts()
+static __fi void _psxTestInterrupts()
 {
 	IopTestEvent(IopEvt_SIF0,		sif0Interrupt);	// SIF0
 	IopTestEvent(IopEvt_SIF1,		sif1Interrupt);	// SIF1
@@ -195,10 +195,6 @@
 #endif
 	IopTestEvent(IopEvt_CdvdRead,	cdvdReadInterrupt);
 
-#if IOP_ENABLE_SIF_HACK
-	IopTestEvent(IopEvt_SIFhack,	sifHackInterrupt);
-#endif
-
 	// Profile-guided Optimization (sorta)
 	// The following ints are rarely called.  Encasing them in a conditional
 	// as follows helps speed up most games.
@@ -215,18 +211,18 @@
 	}
 }
 
-__releaseinline void psxBranchTest()
+__ri void iopEventTest()
 {
 	if( psxTestCycle( psxNextsCounter, psxNextCounter ) )
 	{
 		psxRcntUpdate();
-		iopBranchAction = true;
+		iopEventAction = true;
 	}
 	else
 	{
 	// start the next branch at the next counter event by default
 	// the interrupt code below will assign nearer branches if needed.
-		g_psxNextBranchCycle = psxNextsCounter+psxNextCounter;
+		g_iopNextEventCycle = psxNextsCounter+psxNextCounter;
 	}
 
 
@@ -243,27 +239,13 @@
 		{
 			PSXCPU_LOG("Interrupt: %x  %x", psxHu32(0x1070), psxHu32(0x1074));
 			psxException(0, 0);
-			iopBranchAction = true;
+			iopEventAction = true;
 
 			// No need to execute the SIFhack after cpuExceptions, since these by nature break SIF's
 			// thread sleep hangs and allow the IOP to "come back to life."
 			psxRegs.interrupt &= ~IopEvt_SIFhack;
 		}
 	}
-
-	if( IOP_ENABLE_SIF_HACK && !iopBranchAction && !(psxRegs.interrupt & IopEvt_SIFhack) )
-	{
-		// Safeguard: since we're not executing an exception vector, we should schedule a SIF wakeup
-		// just in case.  (and don't reschedule it if it's already scheduled, since that would just
-		// delay the previously scheduled one, and we don't want that)
-
-		// (TODO: The endless loop in question is a branch instruction that branches to itself endlessly,
-		//  waiting for SIF to wake it up via any cpuException.  We could check for that instruction
-		//  location and only schedule a SIF fix when it's detected...  But for now this is easy and gives
-		//  us good control over testing parameters...)
-
-		PSX_INT( IopEvt_SIFhack, 96 );
-	}
 }
 
 void iopTestIntc()
@@ -276,9 +258,9 @@
 		// An iop exception has occurred while the EE is running code.
 		// Inform the EE to branch so the IOP can handle it promptly:
 
-		cpuSetNextBranchDelta( 16 );
-		iopBranchAction = true;
-		//Console.Error( "** IOP Needs an EE EventText, kthx **  %d", psxCycleEE );
+		cpuSetNextEventDelta( 16 );
+		iopEventAction = true;
+		//Console.Error( "** IOP Needs an EE EventText, kthx **  %d", iopCycleEE );
 
 		// Note: No need to set the iop's branch delta here, since the EE
 		// will run an IOP branch test regardless.

 

  ViewVC Help
Powered by ViewVC 1.1.22