2008-09-18 03:15:49 +00:00
|
|
|
class CRecompiler :
|
2010-05-25 09:15:19 +00:00
|
|
|
public CRecompilerSettings,
|
2012-09-24 01:14:02 +00:00
|
|
|
protected CGameSettings,
|
2010-06-16 07:31:47 +00:00
|
|
|
public CFunctionMap,
|
2010-05-25 09:15:19 +00:00
|
|
|
private CRecompMemory,
|
2010-06-04 06:25:07 +00:00
|
|
|
private CSystemRegisters
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum REMOVE_REASON {
|
|
|
|
Remove_InitialCode,
|
|
|
|
Remove_Cache,
|
|
|
|
Remove_ProtectedMem,
|
|
|
|
Remove_ValidateFunc,
|
|
|
|
Remove_TLB,
|
|
|
|
Remove_DMA,
|
2010-06-16 07:31:47 +00:00
|
|
|
Remove_StoreInstruc,
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
2010-06-07 02:23:58 +00:00
|
|
|
typedef void (* DelayFunc)(void);
|
|
|
|
|
2010-05-25 09:15:19 +00:00
|
|
|
public:
|
2010-05-31 00:21:08 +00:00
|
|
|
CRecompiler (CProfiling & Profile, bool & EndEmulation );
|
2010-05-25 09:15:19 +00:00
|
|
|
~CRecompiler (void);
|
|
|
|
|
|
|
|
void Run ( void );
|
2012-09-22 05:53:39 +00:00
|
|
|
void Reset ( void );
|
2010-05-25 09:15:19 +00:00
|
|
|
void ResetRecompCode ( void );
|
|
|
|
|
2010-05-30 01:54:42 +00:00
|
|
|
bool GenerateX86Code (CCodeBlock & BlockInfo, CCodeSection * Section, DWORD Test );
|
2010-05-25 09:15:19 +00:00
|
|
|
|
|
|
|
//Self modifying code methods
|
2010-06-04 06:25:07 +00:00
|
|
|
void ClearRecompCode_Virt ( DWORD VirtualAddress, int length, REMOVE_REASON Reason );
|
2010-06-22 20:36:28 +00:00
|
|
|
void ClearRecompCode_Phys ( DWORD PhysicalAddress, int length, REMOVE_REASON Reason );
|
2010-07-23 10:45:35 +00:00
|
|
|
|
|
|
|
void ResetMemoryStackPos ( void );
|
|
|
|
|
|
|
|
inline DWORD & MemoryStackPos ( void ) { return m_MemoryStack; }
|
2010-05-25 09:15:19 +00:00
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
private:
|
2010-06-04 06:25:07 +00:00
|
|
|
CCompiledFuncList m_Functions;
|
2008-09-18 03:15:49 +00:00
|
|
|
CProfiling & m_Profile;
|
|
|
|
bool & m_EndEmulation;
|
2010-07-23 10:45:35 +00:00
|
|
|
DWORD m_MemoryStack;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
//Quick access to registers
|
|
|
|
DWORD & PROGRAM_COUNTER;
|
|
|
|
|
2010-05-25 09:15:19 +00:00
|
|
|
CCompiledFunc * CompilerCode ( void );
|
|
|
|
bool Compiler4300iBlock ( CCompiledFunc * info );
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
// Compiling code
|
2010-05-25 09:15:19 +00:00
|
|
|
bool CreateSectionLinkage ( CCodeSection * Section );
|
|
|
|
bool DisplaySectionInformation (CCodeSection * Section, DWORD ID, DWORD Test);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
// Main loops for the different look up methods
|
|
|
|
void RecompilerMain_VirtualTable ( void );
|
|
|
|
void RecompilerMain_VirtualTable_validate ( void );
|
2012-09-24 22:07:51 +00:00
|
|
|
void RecompilerMain_ChangeMemory ( void );
|
|
|
|
void RecompilerMain_Lookup ( void );
|
|
|
|
void RecompilerMain_Lookup_TLB ( void );
|
|
|
|
void RecompilerMain_Lookup_validate ( void );
|
|
|
|
void RecompilerMain_Lookup_validate_TLB ( void );
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2010-05-25 09:15:19 +00:00
|
|
|
void RemoveFunction (CCompiledFunc * FunInfo, bool DelaySlot, REMOVE_REASON Reason );
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|