/[pcsx2_0.9.7]/trunk/pcsx2/R5900.h
ViewVC logotype

Diff of /trunk/pcsx2/R5900.h

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

revision 31 by william, Tue Sep 7 03:24:11 2010 UTC revision 62 by william, Tue Sep 7 11:08:22 2010 UTC
# Line 15  Line 15 
15    
16  #pragma once  #pragma once
17    
18  //////////////////////////////////////////////////////////////////////////////////////////  class BaseR5900Exception;
 #ifndef __LINUX__  
 #pragma region Recompiler Stuffs  
 #endif  
19    
20    // --------------------------------------------------------------------------------------
21    //  Recompiler Stuffs
22    // --------------------------------------------------------------------------------------
23  // This code section contains recompiler vars that are used in "shared" code. Placing  // This code section contains recompiler vars that are used in "shared" code. Placing
24  // them in iR5900.h would mean having to include that into more files than I care to  // them in iR5900.h would mean having to include that into more files than I care to
25  // right now, so we're sticking them here for now until a better solution comes along.  // right now, so we're sticking them here for now until a better solution comes along.
26    
 extern bool g_EEFreezeRegs;  
27  extern bool g_SkipBiosHack;  extern bool g_SkipBiosHack;
28  extern bool g_GameStarted;  extern bool g_GameStarted;
29    
# Line 39  namespace Exception Line 38  namespace Exception
38                  explicit ExitCpuExecute() { }                  explicit ExitCpuExecute() { }
39          };          };
40  }  }
 #ifndef __LINUX__  
 #pragma endregion  
 #endif  
41    
42  //////////////////////////////////////////////////////////////////////////////////////////  // --------------------------------------------------------------------------------------
43  // EE Bios function name tables.  //  EE Bios function name tables.
44    // --------------------------------------------------------------------------------------
45  namespace R5900 {  namespace R5900 {
46  extern const char* const bios[256];  extern const char* const bios[256];
47  }  }
# Line 53  extern s32 EEsCycle; Line 50  extern s32 EEsCycle;
50  extern u32 EEoCycle;  extern u32 EEoCycle;
51    
52  union GPR_reg {   // Declare union type GPR register  union GPR_reg {   // Declare union type GPR register
53            u128 UQ;
54            s128 SQ;
55          u64 UD[2];      //128 bits          u64 UD[2];      //128 bits
56          s64 SD[2];          s64 SD[2];
57          u32 UL[4];          u32 UL[4];
# Line 245  extern __aligned16 cpuRegisters cpuRegs; Line 244  extern __aligned16 cpuRegisters cpuRegs;
244  extern __aligned16 fpuRegisters fpuRegs;  extern __aligned16 fpuRegisters fpuRegs;
245  extern __aligned16 tlbs tlb[48];  extern __aligned16 tlbs tlb[48];
246    
247  extern u32 g_nextBranchCycle;  extern u32 g_nextEventCycle;
248  extern bool eeEventTestIsActive;  extern bool eeEventTestIsActive;
249  extern u32 s_iLastCOP0Cycle;  extern u32 s_iLastCOP0Cycle;
250  extern u32 s_iLastPERFCycle[2];  extern u32 s_iLastPERFCycle[2];
# Line 257  void intSetBranch(); Line 256  void intSetBranch();
256  void __fastcall intDoBranch(u32 target);  void __fastcall intDoBranch(u32 target);
257    
258  // modules loaded at hardcoded addresses by the kernel  // modules loaded at hardcoded addresses by the kernel
259  const u32 EEKERNEL_START = 0;  const u32 EEKERNEL_START        = 0;
260  const u32 EENULL_START = 0x81FC0;  const u32 EENULL_START          = 0x81FC0;
261  const u32 EELOAD_START = 0x82000;  const u32 EELOAD_START          = 0x82000;
262  const u32 EELOAD_SIZE = 0x20000; // overestimate for searching  const u32 EELOAD_SIZE           = 0x20000; // overestimate for searching
263    
264  void __fastcall eeGameStarting();  extern void __fastcall eeGameStarting();
265  void __fastcall eeloadReplaceOSDSYS();  extern void __fastcall eeloadReplaceOSDSYS();
266    
267  ////////////////////////////////////////////////////////////////////  // --------------------------------------------------------------------------------------
268  // R5900 Public Interface / API  //  R5900cpu
269  //  // --------------------------------------------------------------------------------------
270  // [TODO] : This is on the list to get converted to a proper C++ class.  I'm putting it  // [TODO] : This is on the list to get converted to a proper C++ class.  I'm putting it
271  // off until I get my new IOPint and IOPrec re-merged. --air  // off until I get my new IOPint and IOPrec re-merged. --air
272  //  //
# Line 282  struct R5900cpu Line 281  struct R5900cpu
281          //   Can be called from any thread.  Execute status must be suspended or stopped          //   Can be called from any thread.  Execute status must be suspended or stopped
282          //   to prevent multi-thread race conditions.          //   to prevent multi-thread race conditions.
283          //          //
284          // Notable Exception Throws:          // Exception Throws:
285          //   OutOfMemory - Not enough memory, or the memory areas required were already          //   OutOfMemory - Not enough memory, or the memory areas required were already
286          //                 reserved.          //                 reserved.
287          //          //
# Line 306  struct R5900cpu Line 305  struct R5900cpu
305          //   Can be called from any thread.  Execute status must be suspended or stopped          //   Can be called from any thread.  Execute status must be suspended or stopped
306          //   to prevent multi-thread race conditions.          //   to prevent multi-thread race conditions.
307          //          //
308          // Exception Throws:  Emulator-defined.  Common exception types to look for:          // Exception Throws:  Emulator-defined.  Common exception types to expect are
309          //   OutOfMemory, Stream Exceptions          //   OutOfMemory, Stream Exceptions
310          //          //
311          void (*Reset)();          void (*Reset)();
# Line 325  struct R5900cpu Line 324  struct R5900cpu
324          // call to return at the nearest state check (typically handled internally using          // call to return at the nearest state check (typically handled internally using
325          // either C++ exceptions or setjmp/longjmp).          // either C++ exceptions or setjmp/longjmp).
326          //          //
327          // Exception Throws:  [TODO]  (possible execution-related throws to be added)          // Exception Throws:
328            //   Throws BaseR5900Exception and all derivatives.
329            //   Throws FileNotFound or other Streaming errors (typically related to BIOS MEC/NVM)
330          //          //
331          void (*Execute)();          void (*Execute)();
332    
# Line 336  struct R5900cpu Line 337  struct R5900cpu
337          //          //
338          // Implementation note: Because of the nuances of recompiled code execution, setjmp          // Implementation note: Because of the nuances of recompiled code execution, setjmp
339          // may be used in place of thread cancellation or C++ exceptions (non-SEH exceptions          // may be used in place of thread cancellation or C++ exceptions (non-SEH exceptions
340          // cannot unwind through the recompiled code stackframes).          // cannot unwind through the recompiled code stackframes, thus longjmp must be used).
341          //          //
342          // Thread Affinity:          // Thread Affinity:
343          //   Must be called on the same thread as Execute only.          //   Must be called on the same thread as Execute.
344          //          //
345          // Exception Throws:          // Exception Throws:
346          //   May throw threading/Pthreads cancellations if the compiler supports SEH.          //   May throw Execution/Pthreads cancellations if the compiler supports SEH.
         //   ThreadTimedOut - For canceling VM execution in response to MTGS deadlock. (if the  
         //     core emulator does not support multithreaded GS then this will not be a throw  
         //     exception).  
347          //          //
348          void (*CheckExecutionState)();          void (*CheckExecutionState)();
349    
350            // Safely throws host exceptions from executing code (either recompiled or interpreted).
351            // If this function is called outside the context of the CPU's code execution, then the
352            // given exception will be re-thrown automatically.
353            //
354            // Exception Throws:
355            //   (SEH) Rethrows the given exception immediately.
356            //   (setjmp) Re-throws immediately if called from outside the context of dynamically
357            //      generated code (either non-executing contexts or interpreters).  Does not throw
358            //      otherwise.
359            //
360            void (*ThrowException)( const BaseException& ex );
361            void (*ThrowCpuException)( const BaseR5900Exception& ex );
362    
363          // Manual recompiled code cache clear; typically useful to recompilers only.  Size is          // Manual recompiled code cache clear; typically useful to recompilers only.  Size is
364          // in MIPS words (32 bits).  Dev note: this callback is nearly obsolete, and might be          // in MIPS words (32 bits).  Dev note: this callback is nearly obsolete, and might be
365          // better off replaced with some generic API callbacks from VTLB block protection.          // better off replaced with some generic API callbacks from VTLB block protection.
# Line 369  extern R5900cpu *Cpu; Line 380  extern R5900cpu *Cpu;
380  extern R5900cpu intCpu;  extern R5900cpu intCpu;
381  extern R5900cpu recCpu;  extern R5900cpu recCpu;
382    
383    enum EE_EventType
384    {
385            DMAC_VIF0       = 0,
386            DMAC_VIF1,
387            DMAC_GIF,
388            DMAC_FROM_IPU,
389            DMAC_TO_IPU,
390            DMAC_SIF0,
391            DMAC_SIF1,
392            DMAC_SIF2,
393            DMAC_FROM_SPR,
394            DMAC_TO_SPR,
395    
396            DMAC_MFIFO_VIF,
397            DMAC_MFIFO_GIF,
398    
399            // We're setting error conditions through hwDmacIrq, so these correspond to the conditions above.
400            DMAC_STALL_SIS          = 13, // SIS
401            DMAC_MFIFO_EMPTY        = 14, // MEIS
402            DMAC_BUS_ERROR  = 15      // BEIS
403    };
404    
405    extern void CPU_INT( EE_EventType n, s32 ecycle );
406    extern uint intcInterrupt();
407    extern uint dmacInterrupt();
408    
409    
410  extern void cpuInit();  extern void cpuInit();
411  extern void cpuReset();         // can throw Exception::FileNotFound.  extern void cpuReset();         // can throw Exception::FileNotFound.
412  extern void cpuException(u32 code, u32 bd);  extern void cpuException(u32 code, u32 bd);
# Line 377  extern void cpuTlbMissW(u32 addr, u32 bd Line 415  extern void cpuTlbMissW(u32 addr, u32 bd
415  extern void cpuTestHwInts();  extern void cpuTestHwInts();
416  extern void cpuClearInt(uint n);  extern void cpuClearInt(uint n);
417    
418  extern void cpuSetNextBranch( u32 startCycle, s32 delta );  extern void cpuSetNextEvent( u32 startCycle, s32 delta );
419  extern void cpuSetNextBranchDelta( s32 delta );  extern void cpuSetNextEventDelta( s32 delta );
420  extern int  cpuTestCycle( u32 startCycle, s32 delta );  extern int  cpuTestCycle( u32 startCycle, s32 delta );
421  extern void cpuSetBranch();  extern void cpuSetEvent();
422    
423  extern void _cpuBranchTest_Shared();            // for internal use by the Dynarecs and Ints inside R5900:  extern void _cpuEventTest_Shared();             // for internal use by the Dynarecs and Ints inside R5900:
424    
425  extern void cpuTestINTCInts();  extern void cpuTestINTCInts();
426  extern void cpuTestDMACInts();  extern void cpuTestDMACInts();

Legend:
Removed from v.31  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.22