| 228 | // Process these tasks and loop |
| 229 | //***************************************************************************** |
| 230 | template < bool DynaRec, bool TraceEnabled > void CPU_Go() |
| 231 | { |
| 232 | DAEDALUS_PROFILE( __FUNCTION__ ); |
| 233 | |
| 234 | while (CPU_KeepRunning()) |
| 235 | { |
| 236 | // |
| 237 | // Keep executing ops as long as there's nothing to do |
| 238 | // |
| 239 | u32 stuff_to_do( gCPUState.GetStuffToDo() ); |
| 240 | while(stuff_to_do == 0) |
| 241 | { |
| 242 | CPU_EXECUTE_OP< TraceEnabled >(); |
| 243 | |
| 244 | stuff_to_do = gCPUState.GetStuffToDo(); |
| 245 | } |
| 246 | |
| 247 | if( TraceEnabled && (stuff_to_do != CPU_CHANGE_CORE) ) |
| 248 | { |
| 249 | if(gTraceRecorder.IsTraceActive()) |
| 250 | { |
| 251 | #ifdef DAEDALUS_DEBUG_DYNAREC |
| 252 | u32 start_address( gTraceRecorder.GetStartTraceAddress() ); |
| 253 | //DBGConsole_Msg( 0, "Aborting tracing of [R%08x] - StuffToDo is %08x", start_address, stuff_to_do ); |
| 254 | |
| 255 | gAbortedTraceReasons[ start_address ] = stuff_to_do; |
| 256 | #endif |
| 257 | |
| 258 | #ifdef ALLOW_TRACES_WHICH_EXCEPT |
| 259 | if(stuff_to_do == CPU_CHECK_INTERRUPTS && gCPUState.Delay == NO_DELAY ) // Note checking for exactly equal, not just that it's set |
| 260 | { |
| 261 | //DBGConsole_Msg( 0, "Adding chunk at %08x after interrupt\n", gTraceRecorder.GetStartTraceAddress() ); |
| 262 | gTraceRecorder.StopTrace( gCPUState.CurrentPC ); |
| 263 | CPU_CreateAndAddFragment(); |
| 264 | } |
| 265 | #endif |
| 266 | |
| 267 | gTraceRecorder.AbortTrace(); // Abort any traces that were terminated through an interrupt etc |
| 268 | } |
| 269 | CPU_SelectCore(); |
| 270 | } |
| 271 | |
| 272 | if (CPU_CheckStuffToDo()) |
| 273 | break; |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | #ifdef DAEDALUS_DEBUG_DYNAREC |
| 278 |
nothing calls this directly
no test coverage detected