2008-09-18 03:15:49 +00:00
|
|
|
class CRecompiler :
|
2010-05-25 09:15:19 +00:00
|
|
|
public CRecompilerSettings,
|
|
|
|
private CRecompMemory,
|
|
|
|
private CFunctionMap
|
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-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 );
|
|
|
|
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
|
|
|
|
bool ClearRecompCode_Virt ( DWORD VirtualAddress, int length, REMOVE_REASON Reason );
|
|
|
|
bool ClearRecompCode_Phys ( DWORD PhysicalAddress, int length, REMOVE_REASON Reason );
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
private:
|
|
|
|
CProfiling & m_Profile;
|
|
|
|
bool & m_EndEmulation;
|
|
|
|
|
|
|
|
//Quick access to registers
|
|
|
|
DWORD & PROGRAM_COUNTER;
|
2008-11-14 20:51:06 +00:00
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
//Functions
|
|
|
|
CDelaySlotFunctionMap m_FunctionsDelaySlot;
|
2010-05-25 09:15:19 +00:00
|
|
|
//CFunctionMap m_Functions;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2010-05-25 09:15:19 +00:00
|
|
|
CCompiledFunc * CompilerCode ( void );
|
|
|
|
CCompiledFunc * CompileDelaySlot ( DWORD PC );
|
|
|
|
bool Compiler4300iBlock ( CCompiledFunc * info );
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
// Compiling code
|
2010-05-30 01:54:42 +00:00
|
|
|
bool AnalyseBlock ( CCodeBlock & BlockInfo );
|
2010-05-25 09:15:19 +00:00
|
|
|
bool CreateSectionLinkage ( CCodeSection * Section );
|
2010-05-30 01:54:42 +00:00
|
|
|
void CompileExitCode ( CCodeBlock & BlockInfo );
|
2010-05-25 09:15:19 +00:00
|
|
|
void DetermineLoop ( CCodeSection * Section, DWORD Test, DWORD Test2, DWORD TestID);
|
|
|
|
bool DisplaySectionInformation (CCodeSection * Section, DWORD ID, DWORD Test);
|
|
|
|
bool FixConstants ( CCodeSection * Section, DWORD Test );
|
|
|
|
bool InheritParentInfo ( CCodeSection * Section );
|
|
|
|
void InheritConstants ( CCodeSection * Section );
|
|
|
|
// bool IsAllParentLoops ( CCodeSection * Section, CCodeSection * Parent, bool IgnoreIfCompiled, DWORD Test );
|
|
|
|
bool FillSectionInfo ( CCodeSection * Section, STEP_TYPE StartStepType );
|
|
|
|
void SyncRegState ( CCodeSection * Section, CRegInfo * SyncTo );
|
|
|
|
CCodeSection * ExistingSection( CCodeSection * StartSection, DWORD Addr, 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 );
|
|
|
|
void RecompilerMain_ChangeMemory ( void );
|
|
|
|
void RecompilerMain_Lookup ( void );
|
|
|
|
|
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
|
|
|
};
|