2008-09-18 03:15:49 +00:00
|
|
|
class CRecompiler :
|
|
|
|
public CRecompilerSettings
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum REMOVE_REASON {
|
|
|
|
Remove_InitialCode,
|
|
|
|
Remove_Cache,
|
|
|
|
Remove_ProtectedMem,
|
|
|
|
Remove_ValidateFunc,
|
|
|
|
Remove_TLB,
|
|
|
|
Remove_DMA,
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2008-11-14 20:51:06 +00:00
|
|
|
bool const m_SyncSystem;
|
2008-09-18 03:15:49 +00:00
|
|
|
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;
|
|
|
|
CFunctionMap m_Functions;
|
|
|
|
|
|
|
|
FUNCTION_INFO * CompilerCode ( void );
|
|
|
|
FUNCTION_INFO * CompileDelaySlot ( DWORD PC );
|
|
|
|
bool Compiler4300iBlock ( FUNCTION_INFO * info );
|
|
|
|
|
|
|
|
// Compiling code
|
|
|
|
bool AnalyseBlock ( CBlockInfo & BlockInfo );
|
|
|
|
bool CreateSectionLinkage ( CBlockSection * Section );
|
|
|
|
void CompileExitCode ( CBlockInfo & BlockInfo );
|
|
|
|
void DetermineLoop ( CBlockSection * Section, DWORD Test, DWORD Test2, DWORD TestID);
|
|
|
|
bool DisplaySectionInformation (CBlockSection * Section, DWORD ID, DWORD Test);
|
|
|
|
bool FixConstants ( CBlockSection * Section, DWORD Test );
|
|
|
|
bool InheritParentInfo ( CBlockSection * Section );
|
|
|
|
void InheritConstants ( CBlockSection * Section );
|
|
|
|
// bool IsAllParentLoops ( CBlockSection * Section, CBlockSection * Parent, bool IgnoreIfCompiled, DWORD Test );
|
|
|
|
bool FillSectionInfo ( CBlockSection * Section, STEP_TYPE StartStepType );
|
|
|
|
void SyncRegState ( CBlockSection * Section, CRegInfo * SyncTo );
|
|
|
|
CBlockSection * ExistingSection( CBlockSection * StartSection, DWORD Addr, DWORD Test);
|
|
|
|
|
|
|
|
// 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 );
|
|
|
|
|
|
|
|
void RemoveFunction (FUNCTION_INFO * FunInfo, bool DelaySlot, REMOVE_REASON Reason );
|
|
|
|
|
|
|
|
public:
|
2010-05-22 04:47:15 +00:00
|
|
|
CRecompiler (CProfiling & Profile, bool & EndEmulation, bool SyncSystem);
|
2008-09-18 03:15:49 +00:00
|
|
|
~CRecompiler (void);
|
|
|
|
|
|
|
|
void Run ( void );
|
|
|
|
void ResetRecompCode ( void );
|
|
|
|
|
|
|
|
void CompileSystemCheck (DWORD TargetPC, CRegInfo &RegSet);
|
|
|
|
void UpdateCounters ( DWORD * Cycles, DWORD * RandomMod, BOOL CheckTimer);
|
|
|
|
void CompileExit ( CBlockSection * Section, DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegSet, CExitInfo::EXIT_REASON reason, int CompileNow, void (*x86Jmp)(char * Label, DWORD Value));
|
|
|
|
bool GenerateX86Code (CBlockInfo & BlockInfo, CBlockSection * Section, DWORD Test );
|
2008-11-14 20:51:06 +00:00
|
|
|
void GenerateSectionLinkage (CBlockSection * Section);
|
2008-09-18 03:15:49 +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 );
|
|
|
|
|
|
|
|
};
|