Core: Get the recompiler to be use globals less
This commit is contained in:
parent
5ea06d958e
commit
51c9867e76
|
@ -1,7 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Recompiler/Recompiler.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
#ifndef _WIN32
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <Project64-core\N64System\SystemGlobals.h>
|
||||
#include <Project64-core\N64System\N64Rom.h>
|
||||
#include <Project64-core\N64System\N64System.h>
|
||||
#include <Project64-core\N64System\Recompiler\RecompilerCodeLog.h>
|
||||
#include <Project64-core\N64System\Mips\Disk.h>
|
||||
#include <Project64-core\Debugger.h>
|
||||
#include <Project64-core\ExceptionHandler.h>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "N64System.h"
|
||||
#include <Project64-core/3rdParty/zip.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/Mips/Mempak.h>
|
||||
#include <Project64-core/N64System/Mips/Transferpak.h>
|
||||
|
@ -2279,10 +2278,9 @@ bool CN64System::LoadState(const char * FileName)
|
|||
}
|
||||
m_CPU_Usage.ResetTimers();
|
||||
m_FPS.Reset(true);
|
||||
if (bRecordRecompilerAsm())
|
||||
if (bRecordRecompilerAsm() && m_Recomp)
|
||||
{
|
||||
Stop_Recompiler_Log();
|
||||
Start_Recompiler_Log();
|
||||
m_Recomp->ResetLog();
|
||||
}
|
||||
|
||||
#ifdef TEST_SP_TRACKING
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include <string.h>
|
||||
#include <Project64-core/N64System/Recompiler/CodeBlock.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||
#include <Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h>
|
||||
#include <Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
|
@ -31,7 +30,7 @@ CCodeBlock::CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter, uint8_t * Compi
|
|||
}
|
||||
#endif
|
||||
#if defined(__i386__) || defined(_M_IX86)
|
||||
m_RecompilerOps = new CX86RecompilerOps(MMU);
|
||||
m_RecompilerOps = new CX86RecompilerOps(MMU, *this);
|
||||
#elif defined(__arm__) || defined(_M_ARM)
|
||||
m_RecompilerOps = new CArmRecompilerOps(MMU);
|
||||
#endif
|
||||
|
@ -40,7 +39,7 @@ CCodeBlock::CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter, uint8_t * Compi
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
CCodeSection * baseSection = new CCodeSection(this, VAddrEnter, 0, false);
|
||||
CCodeSection * baseSection = new CCodeSection(*this, VAddrEnter, 0, false);
|
||||
if (baseSection == nullptr)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
|
@ -53,7 +52,7 @@ CCodeBlock::CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter, uint8_t * Compi
|
|||
baseSection->m_Cont.FallThrough = true;
|
||||
baseSection->m_Cont.RegSet = baseSection->m_RegEnter;
|
||||
|
||||
m_EnterSection = new CCodeSection(this, VAddrEnter, 1, true);
|
||||
m_EnterSection = new CCodeSection(*this, VAddrEnter, 1, true);
|
||||
if (m_EnterSection == nullptr)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
|
@ -127,7 +126,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
|
|||
|
||||
if (Section == nullptr)
|
||||
{
|
||||
Section = new CCodeSection(this, TargetPC, (uint32_t)m_Sections.size(), LinkAllowed);
|
||||
Section = new CCodeSection(*this, TargetPC, (uint32_t)m_Sections.size(), LinkAllowed);
|
||||
if (Section == nullptr)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
|
@ -160,7 +159,7 @@ bool CCodeBlock::SetSection(CCodeSection * & Section, CCodeSection * CurrentSect
|
|||
}
|
||||
if (SplitSection->m_EndPC >= TargetPC)
|
||||
{
|
||||
CPU_Message("%s: Split Section: %d with section: %d", __FUNCTION__, SplitSection->m_SectionID, Section->m_SectionID);
|
||||
Log("%s: Split Section: %d with section: %d", __FUNCTION__, SplitSection->m_SectionID, Section->m_SectionID);
|
||||
CCodeSection * BaseSection = Section;
|
||||
BaseSection->m_EndPC = SplitSection->m_EndPC;
|
||||
BaseSection->SetJumpAddress(SplitSection->m_Jump.JumpPC, SplitSection->m_Jump.TargetPC, SplitSection->m_Jump.PermLoop);
|
||||
|
@ -192,7 +191,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
{
|
||||
CCodeSection * CurrentSection = EnterSection;
|
||||
|
||||
CPU_Message("Section %d", CurrentSection->m_SectionID);
|
||||
Log("Section %d", CurrentSection->m_SectionID);
|
||||
for (uint32_t TestPC = EnterSection->m_EnterPC, EndPC = ((EnterSection->m_EnterPC + 0x1000) & 0xFFFFF000); TestPC <= EndPC; TestPC += 4)
|
||||
{
|
||||
if (TestPC != EndPC)
|
||||
|
@ -213,7 +212,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
CurrentSection->m_EndPC = TestPC - 4;
|
||||
CurrentSection = itr->second;
|
||||
|
||||
CPU_Message("Section %d", CurrentSection->m_SectionID);
|
||||
Log("Section %d", CurrentSection->m_SectionID);
|
||||
if (EnterSection != m_EnterSection)
|
||||
{
|
||||
if (CurrentSection->m_JumpSection != nullptr ||
|
||||
|
@ -258,7 +257,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
|
||||
if (EndBlock)
|
||||
{
|
||||
CPU_Message("%s: End Block", __FUNCTION__);
|
||||
Log("%s: End Block", __FUNCTION__);
|
||||
CurrentSection->m_EndSection = true;
|
||||
// Find other sections that need compiling
|
||||
break;
|
||||
|
@ -266,7 +265,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
|
||||
if (ContinuePC != (uint32_t)-1)
|
||||
{
|
||||
CPU_Message("%s: SetContinueAddress TestPC = %X ContinuePC = %X", __FUNCTION__, TestPC, ContinuePC);
|
||||
Log("%s: SetContinueAddress TestPC = %X ContinuePC = %X", __FUNCTION__, TestPC, ContinuePC);
|
||||
CurrentSection->SetContinueAddress(TestPC, ContinuePC);
|
||||
if (!SetSection(CurrentSection->m_ContinueSection, CurrentSection, ContinuePC, true, TestPC))
|
||||
{
|
||||
|
@ -276,7 +275,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
|
||||
if (LikelyBranch)
|
||||
{
|
||||
CPU_Message("%s: SetJumpAddress TestPC = %X Target = %X", __FUNCTION__, TestPC, TestPC + 4);
|
||||
Log("%s: SetJumpAddress TestPC = %X Target = %X", __FUNCTION__, TestPC, TestPC + 4);
|
||||
CurrentSection->SetJumpAddress(TestPC, TestPC + 4, false);
|
||||
if (SetSection(CurrentSection->m_JumpSection, CurrentSection, TestPC + 4, false, TestPC))
|
||||
{
|
||||
|
@ -299,7 +298,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
JumpSection->m_EndPC = TestPC + 4;
|
||||
if (BranchEndBlock)
|
||||
{
|
||||
CPU_Message("%s: Jump End Block", __FUNCTION__);
|
||||
Log("%s: Jump End Block", __FUNCTION__);
|
||||
JumpSection->m_EndSection = true;
|
||||
TargetPC = (uint32_t)-1;
|
||||
}
|
||||
|
@ -317,7 +316,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
}
|
||||
else if (TargetPC != ((uint32_t)-1))
|
||||
{
|
||||
CPU_Message("%s: SetJumpAddress TestPC = %X Target = %X", __FUNCTION__, TestPC, TargetPC);
|
||||
Log("%s: SetJumpAddress TestPC = %X Target = %X", __FUNCTION__, TestPC, TargetPC);
|
||||
CurrentSection->SetJumpAddress(TestPC, TargetPC, PermLoop);
|
||||
if (PermLoop || !SetSection(CurrentSection->m_JumpSection, CurrentSection, TargetPC, true, TestPC))
|
||||
{
|
||||
|
@ -359,7 +358,7 @@ bool CCodeBlock::CreateBlockLinkage(CCodeSection * EnterSection)
|
|||
break;
|
||||
}
|
||||
TestPC = CurrentSection->m_EnterPC;
|
||||
CPU_Message("a. Section %d", CurrentSection->m_SectionID);
|
||||
Log("a. Section %d", CurrentSection->m_SectionID);
|
||||
TestPC -= 4;
|
||||
}
|
||||
|
||||
|
@ -441,7 +440,7 @@ bool CCodeBlock::AnalyzeInstruction(uint32_t PC, uint32_t & TargetPC, uint32_t &
|
|||
|
||||
#ifdef _DEBUG
|
||||
R4300iInstruction Instruction(PC, Command.Value);
|
||||
CPU_Message(" 0x%08X %s %s", PC, Instruction.Name(), Instruction.Param());
|
||||
Log(" 0x%08X %s %s", PC, Instruction.Name(), Instruction.Param());
|
||||
#endif
|
||||
switch (Command.op)
|
||||
{
|
||||
|
@ -776,11 +775,11 @@ bool CCodeBlock::AnalyzeInstruction(uint32_t PC, uint32_t & TargetPC, uint32_t &
|
|||
|
||||
bool CCodeBlock::Compile()
|
||||
{
|
||||
CPU_Message("====== Code block ======");
|
||||
CPU_Message("Native entry point: %X", CompiledLocation());
|
||||
CPU_Message("Start of block: %X", VAddrEnter());
|
||||
CPU_Message("Number of sections: %d", NoOfSections());
|
||||
CPU_Message("====== Recompiled code ======");
|
||||
Log("====== Code block ======");
|
||||
Log("Native entry point: %X", CompiledLocation());
|
||||
Log("Start of block: %X", VAddrEnter());
|
||||
Log("Number of sections: %d", NoOfSections());
|
||||
Log("====== Recompiled code ======");
|
||||
|
||||
m_RecompilerOps->EnterCodeBlock();
|
||||
if (g_System->bLinkBlocks())
|
||||
|
@ -817,3 +816,27 @@ uint32_t CCodeBlock::NextTest()
|
|||
m_Test += 1;
|
||||
return next_test;
|
||||
}
|
||||
|
||||
void CCodeBlock::Log(_Printf_format_string_ const char * Text, ...)
|
||||
{
|
||||
if (!CDebugSettings::bRecordRecompilerAsm())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, Text);
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
size_t nlen = _vscprintf(Text, args) + 1;
|
||||
char * buffer = (char*)alloca(nlen * sizeof(char));
|
||||
buffer[nlen - 1] = 0;
|
||||
if (buffer != nullptr)
|
||||
{
|
||||
vsprintf(buffer, Text, args);
|
||||
m_CodeLog += buffer;
|
||||
m_CodeLog += "\n";
|
||||
}
|
||||
#pragma warning(pop)
|
||||
va_end(args);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ public:
|
|||
const CCodeSection & EnterSection() const { return *m_EnterSection; }
|
||||
const MD5Digest & Hash() const { return m_Hash; }
|
||||
CRecompilerOps *& RecompilerOps() { return m_RecompilerOps; }
|
||||
const std::string & CodeLog() const { return m_CodeLog; }
|
||||
|
||||
void SetVAddrFirst(uint32_t VAddr) { m_VAddrFirst = VAddr; }
|
||||
void SetVAddrLast(uint32_t VAddr) { m_VAddrLast = VAddr; }
|
||||
|
||||
|
@ -33,6 +35,8 @@ public:
|
|||
|
||||
uint32_t NextTest();
|
||||
|
||||
void Log(_Printf_format_string_ const char * Text, ...);
|
||||
|
||||
private:
|
||||
CCodeBlock();
|
||||
CCodeBlock(const CCodeBlock&);
|
||||
|
@ -64,4 +68,5 @@ private:
|
|||
uint64_t m_MemContents[2];
|
||||
uint64_t * m_MemLocation[2];
|
||||
CRecompilerOps * m_RecompilerOps;
|
||||
std::string m_CodeLog;
|
||||
};
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <Project64-core/N64System/Mips/R4300iInstruction.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||
#include <Project64-core/N64System/Recompiler/CodeBlock.h>
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
#include <Project64-core/N64System/Interpreter/InterpreterCPU.h>
|
||||
|
@ -13,8 +12,8 @@
|
|||
#include <Project64-core/ExceptionHandler.h>
|
||||
#include <Project64-core/Debugger.h>
|
||||
|
||||
CCodeSection::CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID, bool LinkAllowed) :
|
||||
m_BlockInfo(CodeBlock),
|
||||
CCodeSection::CCodeSection(CCodeBlock & CodeBlock, uint32_t EnterPC, uint32_t ID, bool LinkAllowed) :
|
||||
m_CodeBlock(CodeBlock),
|
||||
m_SectionID(ID),
|
||||
m_EnterPC(EnterPC),
|
||||
m_EndPC((uint32_t)-1),
|
||||
|
@ -27,9 +26,12 @@ CCodeSection::CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID
|
|||
m_CompiledLocation(nullptr),
|
||||
m_InLoop(false),
|
||||
m_DelaySlot(false),
|
||||
m_RecompilerOps(CodeBlock->RecompilerOps())
|
||||
m_RecompilerOps(CodeBlock.RecompilerOps()),
|
||||
m_RegEnter(CodeBlock),
|
||||
m_Jump(CodeBlock),
|
||||
m_Cont(CodeBlock)
|
||||
{
|
||||
CPU_Message("%s: ID %d EnterPC 0x%08X", __FUNCTION__, ID, EnterPC);
|
||||
m_CodeBlock.Log("%s: ID %d EnterPC 0x%08X", __FUNCTION__, ID, EnterPC);
|
||||
m_RecompilerOps->SetCurrentSection(this);
|
||||
}
|
||||
|
||||
|
@ -121,13 +123,13 @@ void CCodeSection::GenerateSectionLinkage()
|
|||
{
|
||||
if (JumpInfo[i]->PermLoop)
|
||||
{
|
||||
CPU_Message("PermLoop *** 1");
|
||||
m_CodeBlock.Log("PermLoop *** 1");
|
||||
m_RecompilerOps->CompileInPermLoop(JumpInfo[i]->RegSet, JumpInfo[i]->TargetPC);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RecompilerOps->UpdateCounters(JumpInfo[i]->RegSet, true, true);
|
||||
CPU_Message("CompileSystemCheck 5");
|
||||
m_CodeBlock.Log("CompileSystemCheck 5");
|
||||
m_RecompilerOps->CompileSystemCheck(JumpInfo[i]->TargetPC, JumpInfo[i]->RegSet);
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +157,7 @@ void CCodeSection::GenerateSectionLinkage()
|
|||
if (Parent->m_InLoop) { continue; }
|
||||
if (JumpInfo[i]->PermLoop)
|
||||
{
|
||||
CPU_Message("PermLoop *** 2");
|
||||
m_CodeBlock.Log("PermLoop *** 2");
|
||||
m_RecompilerOps->CompileInPermLoop(JumpInfo[i]->RegSet, JumpInfo[i]->TargetPC);
|
||||
}
|
||||
if (JumpInfo[i]->FallThrough)
|
||||
|
@ -173,30 +175,30 @@ void CCodeSection::GenerateSectionLinkage()
|
|||
if (JumpInfo[i]->TargetPC < m_RecompilerOps->GetCurrentPC())
|
||||
{
|
||||
m_RecompilerOps->UpdateCounters(JumpInfo[i]->RegSet, true, true);
|
||||
CPU_Message("CompileSystemCheck 7");
|
||||
m_CodeBlock.Log("CompileSystemCheck 7");
|
||||
m_RecompilerOps->CompileSystemCheck(JumpInfo[i]->TargetPC, JumpInfo[i]->RegSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CPU_Message("====== End of Section %d ======", m_SectionID);
|
||||
m_CodeBlock.Log("====== End of Section %d ======", m_SectionID);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (JumpInfo[i]->FallThrough && (TargetSection[i] == nullptr || !TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest())))
|
||||
if (JumpInfo[i]->FallThrough && (TargetSection[i] == nullptr || !TargetSection[i]->GenerateNativeCode(m_CodeBlock.NextTest())))
|
||||
{
|
||||
JumpInfo[i]->FallThrough = false;
|
||||
m_RecompilerOps->JumpToUnknown(JumpInfo[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//CPU_Message("Section %d",m_SectionID);
|
||||
//CodeLog("Section %d",m_SectionID);
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (JumpInfo[i]->LinkLocation == nullptr) { continue; }
|
||||
if (TargetSection[i] == nullptr)
|
||||
{
|
||||
CPU_Message("ExitBlock (from %d):", m_SectionID);
|
||||
m_CodeBlock.Log("ExitBlock (from %d):", m_SectionID);
|
||||
m_RecompilerOps->LinkJump(*JumpInfo[i], (uint32_t)-1);
|
||||
m_RecompilerOps->CompileExit(JumpInfo[i]->JumpPC, JumpInfo[i]->TargetPC, JumpInfo[i]->RegSet, JumpInfo[i]->ExitReason);
|
||||
continue;
|
||||
|
@ -207,13 +209,13 @@ void CCodeSection::GenerateSectionLinkage()
|
|||
}
|
||||
if (TargetSection[i]->m_CompiledLocation == nullptr)
|
||||
{
|
||||
TargetSection[i]->GenerateNativeCode(m_BlockInfo->NextTest());
|
||||
TargetSection[i]->GenerateNativeCode(m_CodeBlock.NextTest());
|
||||
}
|
||||
else
|
||||
{
|
||||
stdstr_f Label("Section_%d (from %d):", TargetSection[i]->m_SectionID, m_SectionID);
|
||||
|
||||
CPU_Message(Label.c_str());
|
||||
m_CodeBlock.Log(Label.c_str());
|
||||
m_RecompilerOps->LinkJump(*JumpInfo[i], (uint32_t)-1);
|
||||
m_RecompilerOps->SetRegWorkingSet(JumpInfo[i]->RegSet);
|
||||
if (JumpInfo[i]->TargetPC <= JumpInfo[i]->JumpPC)
|
||||
|
@ -221,12 +223,12 @@ void CCodeSection::GenerateSectionLinkage()
|
|||
m_RecompilerOps->UpdateCounters(m_RecompilerOps->GetRegWorkingSet(), true, true);
|
||||
if (JumpInfo[i]->PermLoop)
|
||||
{
|
||||
CPU_Message("PermLoop *** 3");
|
||||
m_CodeBlock.Log("PermLoop *** 3");
|
||||
m_RecompilerOps->CompileInPermLoop(m_RecompilerOps->GetRegWorkingSet(), JumpInfo[i]->TargetPC);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPU_Message("CompileSystemCheck 9");
|
||||
m_CodeBlock.Log("CompileSystemCheck 9");
|
||||
m_RecompilerOps->CompileSystemCheck(JumpInfo[i]->TargetPC, m_RecompilerOps->GetRegWorkingSet());
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +251,7 @@ void CCodeSection::SetJumpAddress(uint32_t JumpPC, uint32_t TargetPC, bool PermL
|
|||
{
|
||||
m_Jump.JumpPC = JumpPC;
|
||||
m_Jump.TargetPC = TargetPC;
|
||||
m_Jump.BranchLabel.Format("0x%08X", TargetPC);
|
||||
m_Jump.BranchLabel = stdstr_f("0x%08X", TargetPC);
|
||||
m_Jump.PermLoop = PermLoop;
|
||||
}
|
||||
|
||||
|
@ -257,7 +259,7 @@ void CCodeSection::SetContinueAddress(uint32_t JumpPC, uint32_t TargetPC)
|
|||
{
|
||||
m_Cont.JumpPC = JumpPC;
|
||||
m_Cont.TargetPC = TargetPC;
|
||||
m_Cont.BranchLabel.Format("0x%08X", TargetPC);
|
||||
m_Cont.BranchLabel = stdstr_f("0x%08X", TargetPC);
|
||||
}
|
||||
|
||||
bool CCodeSection::ParentContinue()
|
||||
|
@ -268,7 +270,7 @@ bool CCodeSection::ParentContinue()
|
|||
{
|
||||
CCodeSection * Parent = *iter;
|
||||
if (Parent->m_CompiledLocation != nullptr) { continue; }
|
||||
if (IsAllParentLoops(Parent, true, m_BlockInfo->NextTest())) { continue; }
|
||||
if (IsAllParentLoops(Parent, true, m_CodeBlock.NextTest())) { continue; }
|
||||
return false;
|
||||
}
|
||||
m_RecompilerOps->SetCurrentSection(this);
|
||||
|
@ -303,9 +305,9 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
|
|||
m_RecompilerOps->SetCurrentPC(m_EnterPC);
|
||||
m_RecompilerOps->SetNextStepType(m_DelaySlot ? PIPELINE_STAGE_JUMP : PIPELINE_STAGE_NORMAL);
|
||||
|
||||
if (m_RecompilerOps->GetCurrentPC() < m_BlockInfo->VAddrFirst())
|
||||
if (m_RecompilerOps->GetCurrentPC() < m_CodeBlock.VAddrFirst())
|
||||
{
|
||||
m_BlockInfo->SetVAddrFirst(m_RecompilerOps->GetCurrentPC());
|
||||
m_CodeBlock.SetVAddrFirst(m_RecompilerOps->GetCurrentPC());
|
||||
}
|
||||
|
||||
uint32_t ContinueSectionPC = m_ContinueSection ? m_ContinueSection->m_EnterPC : (uint32_t)-1;
|
||||
|
@ -313,9 +315,9 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
|
|||
R4300iInstruction Instruction(m_RecompilerOps->GetCurrentPC(), Opcode.Value);
|
||||
do
|
||||
{
|
||||
if (m_RecompilerOps->GetCurrentPC() > m_BlockInfo->VAddrLast())
|
||||
if (m_RecompilerOps->GetCurrentPC() > m_CodeBlock.VAddrLast())
|
||||
{
|
||||
m_BlockInfo->SetVAddrLast(m_RecompilerOps->GetCurrentPC());
|
||||
m_CodeBlock.SetVAddrLast(m_RecompilerOps->GetCurrentPC());
|
||||
}
|
||||
|
||||
if (isDebugging() && HaveExecutionBP() && Instruction.HasDelaySlot() && g_Debugger->ExecutionBP(m_RecompilerOps->GetCurrentPC() + 4))
|
||||
|
@ -636,7 +638,7 @@ bool CCodeSection::GenerateNativeCode(uint32_t Test)
|
|||
// Do nothing, the block will end
|
||||
break;
|
||||
default:
|
||||
CPU_Message("m_RecompilerOps->GetNextStepType() = %d", m_RecompilerOps->GetNextStepType());
|
||||
m_CodeBlock.Log("m_RecompilerOps->GetNextStepType() = %d", m_RecompilerOps->GetNextStepType());
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
@ -790,11 +792,11 @@ void CCodeSection::DetermineLoop(uint32_t Test, uint32_t Test2, uint32_t TestID)
|
|||
m_Test = Test;
|
||||
if (m_ContinueSection != nullptr)
|
||||
{
|
||||
m_ContinueSection->DetermineLoop(Test, m_BlockInfo->NextTest(), m_ContinueSection->m_SectionID);
|
||||
m_ContinueSection->DetermineLoop(Test, m_CodeBlock.NextTest(), m_ContinueSection->m_SectionID);
|
||||
}
|
||||
if (m_JumpSection != nullptr)
|
||||
{
|
||||
m_JumpSection->DetermineLoop(Test, m_BlockInfo->NextTest(), m_JumpSection->m_SectionID);
|
||||
m_JumpSection->DetermineLoop(Test, m_CodeBlock.NextTest(), m_JumpSection->m_SectionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -856,7 +858,7 @@ bool CCodeSection::SectionAccessible(uint32_t SectionId, uint32_t Test)
|
|||
|
||||
void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
|
||||
{
|
||||
CPU_Message("%s: Section %d Parent: %d ContinueSection = %s", __FUNCTION__, m_SectionID, Parent->m_SectionID, ContinueSection ? "Yes" : "No");
|
||||
m_CodeBlock.Log("%s: Section %d Parent: %d ContinueSection = %s", __FUNCTION__, m_SectionID, Parent->m_SectionID, ContinueSection ? "Yes" : "No");
|
||||
if (Parent->m_ContinueSection == this && Parent->m_JumpSection == this)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
|
@ -889,7 +891,7 @@ void CCodeSection::UnlinkParent(CCodeSection * Parent, bool ContinueSection)
|
|||
bool bRemove = false;
|
||||
if (m_ParentSection.size() > 0)
|
||||
{
|
||||
if (!m_BlockInfo->SectionAccessible(m_SectionID))
|
||||
if (!m_CodeBlock.SectionAccessible(m_SectionID))
|
||||
{
|
||||
for (SECTION_LIST::iterator iter = m_ParentSection.begin(); iter != m_ParentSection.end(); iter++)
|
||||
{
|
||||
|
@ -975,13 +977,13 @@ void CCodeSection::DisplaySectionInformation()
|
|||
return;
|
||||
}
|
||||
|
||||
CPU_Message("====== Section %d ======", m_SectionID);
|
||||
CPU_Message("Start PC: 0x%X", m_EnterPC);
|
||||
m_CodeBlock.Log("====== Section %d ======", m_SectionID);
|
||||
m_CodeBlock.Log("Start PC: 0x%X", m_EnterPC);
|
||||
if (g_System->bLinkBlocks())
|
||||
{
|
||||
CPU_Message("End PC: 0x%X", m_EndPC);
|
||||
m_CodeBlock.Log("End PC: 0x%X", m_EndPC);
|
||||
}
|
||||
CPU_Message("CompiledLocation: 0x%X", m_CompiledLocation);
|
||||
m_CodeBlock.Log("CompiledLocation: 0x%X", m_CompiledLocation);
|
||||
if (g_System->bLinkBlocks() && !m_ParentSection.empty())
|
||||
{
|
||||
stdstr ParentList;
|
||||
|
@ -994,32 +996,32 @@ void CCodeSection::DisplaySectionInformation()
|
|||
}
|
||||
ParentList += stdstr_f("%d", Parent->m_SectionID);
|
||||
}
|
||||
CPU_Message("Number of parents: %d (%s)", m_ParentSection.size(), ParentList.c_str());
|
||||
m_CodeBlock.Log("Number of parents: %d (%s)", m_ParentSection.size(), ParentList.c_str());
|
||||
}
|
||||
|
||||
if (g_System->bLinkBlocks())
|
||||
{
|
||||
CPU_Message("Jump address: 0x%08X", m_Jump.JumpPC);
|
||||
CPU_Message("Jump target address: 0x%08X", m_Jump.TargetPC);
|
||||
m_CodeBlock.Log("Jump address: 0x%08X", m_Jump.JumpPC);
|
||||
m_CodeBlock.Log("Jump target address: 0x%08X", m_Jump.TargetPC);
|
||||
if (m_JumpSection != nullptr)
|
||||
{
|
||||
CPU_Message("Jump section: %d", m_JumpSection->m_SectionID);
|
||||
m_CodeBlock.Log("Jump section: %d", m_JumpSection->m_SectionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPU_Message("Jump section: None");
|
||||
m_CodeBlock.Log("Jump section: None");
|
||||
}
|
||||
CPU_Message("Continue address: 0x%08X", m_Cont.JumpPC);
|
||||
CPU_Message("Continue target address: 0x%08X", m_Cont.TargetPC);
|
||||
m_CodeBlock.Log("Continue address: 0x%08X", m_Cont.JumpPC);
|
||||
m_CodeBlock.Log("Continue target address: 0x%08X", m_Cont.TargetPC);
|
||||
if (m_ContinueSection != nullptr)
|
||||
{
|
||||
CPU_Message("Continue section: %d", m_ContinueSection->m_SectionID);
|
||||
m_CodeBlock.Log("Continue section: %d", m_ContinueSection->m_SectionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPU_Message("Continue section: None");
|
||||
m_CodeBlock.Log("Continue section: None");
|
||||
}
|
||||
CPU_Message("In loop: %s", m_InLoop ? "Yes" : "No");
|
||||
m_CodeBlock.Log("In loop: %s", m_InLoop ? "Yes" : "No");
|
||||
}
|
||||
CPU_Message("=======================");
|
||||
m_CodeBlock.Log("=======================");
|
||||
}
|
|
@ -11,7 +11,7 @@ class CCodeSection :
|
|||
public:
|
||||
typedef std::list<CCodeSection *> SECTION_LIST;
|
||||
|
||||
CCodeSection(CCodeBlock * CodeBlock, uint32_t EnterPC, uint32_t ID, bool LinkAllowed);
|
||||
CCodeSection(CCodeBlock & CodeBlock, uint32_t EnterPC, uint32_t ID, bool LinkAllowed);
|
||||
~CCodeSection();
|
||||
|
||||
void SetDelaySlot();
|
||||
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
// Block connection info
|
||||
SECTION_LIST m_ParentSection;
|
||||
CCodeBlock * const m_BlockInfo;
|
||||
CCodeBlock & m_CodeBlock;
|
||||
const uint32_t m_SectionID;
|
||||
const uint32_t m_EnterPC;
|
||||
uint32_t m_EndPC;
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#include "stdafx.h"
|
||||
#include <Project64-core\N64System\Recompiler\ExitInfo.h>
|
||||
|
||||
CExitInfo::CExitInfo(CCodeBlock & CodeBlock) :
|
||||
ID(0),
|
||||
TargetPC(0),
|
||||
JumpLoc(nullptr),
|
||||
ExitRegSet(CodeBlock)
|
||||
{
|
||||
}
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
struct CExitInfo
|
||||
{
|
||||
CExitInfo(CCodeBlock & CodeBlock);
|
||||
|
||||
enum EXIT_REASON
|
||||
{
|
||||
Normal = 0,
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
struct CJumpInfo
|
||||
{
|
||||
typedef CExitInfo::EXIT_REASON EXIT_REASON;
|
||||
CJumpInfo();
|
||||
CJumpInfo(CCodeBlock & CodeBlock);
|
||||
|
||||
uint32_t TargetPC;
|
||||
uint32_t JumpPC;
|
||||
stdstr BranchLabel;
|
||||
std::string BranchLabel;
|
||||
uint32_t * LinkLocation;
|
||||
uint32_t * LinkLocation2;
|
||||
bool FallThrough;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
#include <Project64-core/N64System/Recompiler/CodeBlock.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Mips/R4300iInstruction.h>
|
||||
|
@ -13,12 +12,13 @@
|
|||
#define CHECKED_BUILD 1
|
||||
#endif
|
||||
|
||||
LoopAnalysis::LoopAnalysis(CCodeBlock * CodeBlock, CCodeSection * Section) :
|
||||
LoopAnalysis::LoopAnalysis(CCodeBlock & CodeBlock, CCodeSection * Section) :
|
||||
m_EnterSection(Section),
|
||||
m_BlockInfo(CodeBlock),
|
||||
m_CodeBlock(CodeBlock),
|
||||
m_PC((uint32_t)-1),
|
||||
m_PipelineStage(PIPELINE_STAGE_NORMAL),
|
||||
m_Test(m_BlockInfo->NextTest())
|
||||
m_Test(CodeBlock.NextTest()),
|
||||
m_Reg(CodeBlock)
|
||||
{
|
||||
memset(&m_Command, 0, sizeof(m_Command));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ bool LoopAnalysis::SetupRegisterForLoop()
|
|||
{
|
||||
return false;
|
||||
}
|
||||
CPU_Message("%s: Section ID: %d Test: %X", __FUNCTION__, m_EnterSection->m_SectionID, m_Test);
|
||||
m_CodeBlock.Log("%s: Section ID: %d Test: %X", __FUNCTION__, m_EnterSection->m_SectionID, m_Test);
|
||||
if (!CheckLoopRegisterUsage(m_EnterSection))
|
||||
{
|
||||
return false;
|
||||
|
@ -71,18 +71,18 @@ bool LoopAnalysis::SetupEnterSection(CCodeSection * Section, bool & bChanged, bo
|
|||
bSkipedSection = false;
|
||||
if (Section->m_ParentSection.empty()) { g_Notify->BreakPoint(__FILE__, __LINE__); return true; }
|
||||
|
||||
CPU_Message("%s: Block EnterPC: %X Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, m_BlockInfo->VAddrEnter(), Section->m_SectionID, m_Test, Section->m_Test, Section->m_CompiledLocation);
|
||||
m_CodeBlock.Log("%s: Block EnterPC: %X Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, m_CodeBlock.VAddrEnter(), Section->m_SectionID, m_Test, Section->m_Test, Section->m_CompiledLocation);
|
||||
|
||||
bool bFirstParent = true;
|
||||
CRegInfo RegEnter;
|
||||
CRegInfo RegEnter(m_CodeBlock);
|
||||
for (CCodeSection::SECTION_LIST::iterator iter = Section->m_ParentSection.begin(); iter != Section->m_ParentSection.end(); iter++)
|
||||
{
|
||||
CCodeSection * Parent = *iter;
|
||||
|
||||
CPU_Message("%s: Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
|
||||
m_CodeBlock.Log("%s: Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
|
||||
if (Parent->m_Test != m_Test && (m_EnterSection != Section || Parent->m_CompiledLocation == nullptr) && Parent->m_InLoop)
|
||||
{
|
||||
CPU_Message("%s: Ignore Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
|
||||
m_CodeBlock.Log("%s: Ignore Parent Section ID %d Test: %X Section Test: %X CompiledLocation: %X", __FUNCTION__, Parent->m_SectionID, m_Test, Parent->m_Test, Parent->m_CompiledLocation);
|
||||
bSkipedSection = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
if (Section == nullptr) { return true; }
|
||||
if (!Section->m_InLoop) { return true; }
|
||||
|
||||
CPU_Message("%s: Section %d Block PC: 0x%X", __FUNCTION__, Section->m_SectionID, m_BlockInfo->VAddrEnter());
|
||||
m_CodeBlock.Log("%s: Section %d Block PC: 0x%X", __FUNCTION__, Section->m_SectionID, m_CodeBlock.VAddrEnter());
|
||||
|
||||
bool bChanged = false, bSkipedSection = false;
|
||||
if (Section == m_EnterSection && Section->m_Test == m_Test)
|
||||
|
@ -157,7 +157,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
return true;
|
||||
}
|
||||
|
||||
CPU_Message("%s: Set Section %d test to %X from %X", __FUNCTION__, Section->m_SectionID, m_Test, Section->m_Test);
|
||||
m_CodeBlock.Log("%s: Set Section %d test to %X from %X", __FUNCTION__, Section->m_SectionID, m_Test, Section->m_Test);
|
||||
Section->m_Test = m_Test;
|
||||
m_PC = Section->m_EnterPC;
|
||||
|
||||
|
@ -166,7 +166,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
|
||||
m_PipelineStage = PIPELINE_STAGE_NORMAL;
|
||||
uint32_t ContinueSectionPC = Section->m_ContinueSection ? Section->m_ContinueSection->m_EnterPC : (uint32_t)-1;
|
||||
CPU_Message("ContinueSectionPC = %08X", ContinueSectionPC);
|
||||
m_CodeBlock.Log("ContinueSectionPC = %08X", ContinueSectionPC);
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
CPU_Message(" %08X: %s", m_PC, R4300iInstruction(m_PC, m_Command.Value).NameAndParam().c_str());
|
||||
m_CodeBlock.Log(" %08X: %s", m_PC, R4300iInstruction(m_PC, m_Command.Value).NameAndParam().c_str());
|
||||
switch (m_Command.op)
|
||||
{
|
||||
case R4300i_SPECIAL:
|
||||
|
@ -651,7 +651,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
|
|||
g_Notify->DisplayError(stdstr_f("Unhandled R4300i opcode in FillSectionInfo 1\n%s\n%X", R4300iInstruction(m_PC, m_Command.Value).NameAndParam().c_str(), m_Command.Value).c_str());
|
||||
}
|
||||
|
||||
CPU_Message(" %s state: %X value: %X", CRegName::GPR[5], m_Reg.GetMipsRegState(5), m_Reg.GetMipsRegLo(5));
|
||||
m_CodeBlock.Log(" %s state: %X value: %X", CRegName::GPR[5], m_Reg.GetMipsRegState(5), m_Reg.GetMipsRegLo(5));
|
||||
|
||||
if (Section->m_DelaySlot)
|
||||
{
|
||||
|
@ -722,13 +722,13 @@ bool LoopAnalysis::SyncRegState(CRegInfo & RegSet, const CRegInfo& SyncReg)
|
|||
{
|
||||
if (RegSet.GetMipsRegState(x) != SyncReg.GetMipsRegState(x))
|
||||
{
|
||||
CPU_Message("%s: Clear state %s RegEnter State: %X Jump Reg State: %X", __FUNCTION__, CRegName::GPR[x], RegSet.GetMipsRegState(x), SyncReg.GetMipsRegState(x));
|
||||
m_CodeBlock.Log("%s: Clear state %s RegEnter State: %X Jump Reg State: %X", __FUNCTION__, CRegName::GPR[x], RegSet.GetMipsRegState(x), SyncReg.GetMipsRegState(x));
|
||||
RegSet.SetMipsRegState(x, CRegInfo::STATE_MODIFIED);
|
||||
bChanged = true;
|
||||
}
|
||||
else if (RegSet.IsConst(x) && RegSet.Is32Bit(x) && RegSet.GetMipsRegLo(x) != SyncReg.GetMipsRegLo(x))
|
||||
{
|
||||
CPU_Message("%s: Clear state %s RegEnter State: %X Jump Reg State: %X", __FUNCTION__, CRegName::GPR[x], RegSet.GetMipsRegState(x), SyncReg.GetMipsRegState(x));
|
||||
m_CodeBlock.Log("%s: Clear state %s RegEnter State: %X Jump Reg State: %X", __FUNCTION__, CRegName::GPR[x], RegSet.GetMipsRegState(x), SyncReg.GetMipsRegState(x));
|
||||
RegSet.SetMipsRegState(x, CRegInfo::STATE_MODIFIED);
|
||||
bChanged = true;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class CCodeBlock;
|
|||
class LoopAnalysis
|
||||
{
|
||||
public:
|
||||
LoopAnalysis(CCodeBlock * CodeBlock, CCodeSection * Section);
|
||||
LoopAnalysis(CCodeBlock & CodeBlock, CCodeSection * Section);
|
||||
~LoopAnalysis();
|
||||
|
||||
bool SetupRegisterForLoop();
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
RegisterMap m_ContinueRegisters;
|
||||
RegisterMap m_JumpRegisters;
|
||||
CCodeSection * m_EnterSection;
|
||||
CCodeBlock * m_BlockInfo;
|
||||
CCodeBlock & m_CodeBlock;
|
||||
uint32_t m_PC;
|
||||
CRegInfo m_Reg;
|
||||
PIPELINE_STAGE m_PipelineStage;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/Recompiler/Recompiler.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
#include <Project64-core/N64System/Interpreter/InterpreterCPU.h>
|
||||
#include <Project64-core/ExceptionHandler.h>
|
||||
|
@ -11,7 +10,8 @@ CRecompiler::CRecompiler(CMipsMemoryVM & MMU, CRegisters & Registers, bool & End
|
|||
m_Registers(Registers),
|
||||
m_EndEmulation(EndEmulation),
|
||||
m_MemoryStack(0),
|
||||
PROGRAM_COUNTER(Registers.m_PROGRAM_COUNTER)
|
||||
PROGRAM_COUNTER(Registers.m_PROGRAM_COUNTER),
|
||||
m_LogFile(nullptr)
|
||||
{
|
||||
CFunctionMap::AllocateMemory();
|
||||
ResetMemoryStackPos();
|
||||
|
@ -20,16 +20,13 @@ CRecompiler::CRecompiler(CMipsMemoryVM & MMU, CRegisters & Registers, bool & End
|
|||
CRecompiler::~CRecompiler()
|
||||
{
|
||||
ResetRecompCode(false);
|
||||
StopLog();
|
||||
}
|
||||
|
||||
void CRecompiler::Run()
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceDebug, "Start");
|
||||
|
||||
if (bRecordRecompilerAsm())
|
||||
{
|
||||
Start_Recompiler_Log();
|
||||
}
|
||||
StartLog();
|
||||
|
||||
if (!CRecompMemory::AllocateMemory())
|
||||
{
|
||||
|
@ -387,6 +384,8 @@ CCompiledFunc * CRecompiler::CompileCode()
|
|||
ShowMemUsed();
|
||||
}
|
||||
|
||||
LogCodeBlock(CodeBlock);
|
||||
|
||||
CCompiledFunc * Func = new CCompiledFunc(CodeBlock);
|
||||
std::pair<CCompiledFuncList::iterator, bool> ret = m_Functions.insert(CCompiledFuncList::value_type(Func->EnterPC(), Func));
|
||||
if (ret.second == false)
|
||||
|
@ -511,6 +510,12 @@ void CRecompiler::ClearRecompCode_Virt(uint32_t Address, int length, REMOVE_REAS
|
|||
}
|
||||
}
|
||||
|
||||
void CRecompiler::ResetLog()
|
||||
{
|
||||
StopLog();
|
||||
StartLog();
|
||||
}
|
||||
|
||||
void CRecompiler::ResetMemoryStackPos()
|
||||
{
|
||||
#if defined(__aarch64__) || defined(__amd64__)
|
||||
|
@ -556,3 +561,48 @@ void CRecompiler::ResetFunctionTimes()
|
|||
{
|
||||
m_BlockProfile.clear();
|
||||
}
|
||||
|
||||
void CRecompiler::StartLog()
|
||||
{
|
||||
if (!bRecordRecompilerAsm())
|
||||
{
|
||||
return;
|
||||
}
|
||||
CPath LogFileName(g_Settings->LoadStringVal(Directory_Log).c_str(), "CPUoutput.log");
|
||||
if (m_LogFile != nullptr)
|
||||
{
|
||||
StopLog();
|
||||
}
|
||||
m_LogFile = new CLog();
|
||||
if (m_LogFile)
|
||||
{
|
||||
if (m_LogFile->Open(LogFileName))
|
||||
{
|
||||
m_LogFile->SetMaxFileSize(300 * CLog::MB);
|
||||
}
|
||||
else
|
||||
{
|
||||
StopLog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRecompiler::StopLog(void)
|
||||
{
|
||||
if (m_LogFile != nullptr)
|
||||
{
|
||||
delete m_LogFile;
|
||||
m_LogFile = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CRecompiler::LogCodeBlock(const CCodeBlock & CodeBlock)
|
||||
{
|
||||
if (!bRecordRecompilerAsm() || m_LogFile == nullptr || CodeBlock.CodeLog().empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_LogFile->Log(CodeBlock.CodeLog().c_str());
|
||||
m_LogFile->Log("\r\n");
|
||||
m_LogFile->Flush();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <Project64-core/Settings/RecompilerSettings.h>
|
||||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
|
||||
class CLog;
|
||||
|
||||
class CRecompiler :
|
||||
protected CDebugSettings,
|
||||
public CRecompilerSettings,
|
||||
|
@ -44,6 +46,7 @@ public:
|
|||
void ClearRecompCode_Virt(uint32_t VirtualAddress, int32_t length, REMOVE_REASON Reason);
|
||||
void ClearRecompCode_Phys(uint32_t PhysicalAddress, int32_t length, REMOVE_REASON Reason);
|
||||
|
||||
void ResetLog();
|
||||
void ResetMemoryStackPos();
|
||||
void ResetFunctionTimes();
|
||||
void DumpFunctionTimes();
|
||||
|
@ -71,6 +74,10 @@ private:
|
|||
void RecompilerMain_Lookup();
|
||||
void RecompilerMain_Lookup_validate();
|
||||
|
||||
void StartLog();
|
||||
void StopLog();
|
||||
void LogCodeBlock(const CCodeBlock & CodeBlock);
|
||||
|
||||
CCompiledFuncList m_Functions;
|
||||
CMipsMemoryVM & m_MMU;
|
||||
CRegisters & m_Registers;
|
||||
|
@ -78,4 +85,5 @@ private:
|
|||
uint32_t m_MemoryStack;
|
||||
FUNCTION_PROFILE m_BlockProfile;
|
||||
uint32_t & PROGRAM_COUNTER;
|
||||
CLog * m_LogFile;
|
||||
};
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "RecompilerCodeLog.h"
|
||||
#include <Common/path.h>
|
||||
#include <Common/Platform.h>
|
||||
|
||||
// vsprintf()
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
static CLog * g_CPULogFile = nullptr;
|
||||
|
||||
void Recompiler_Log_Message(const char * strFormat, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, strFormat);
|
||||
size_t nlen = _vscprintf(strFormat, args) + 1;
|
||||
char * buffer = (char *)alloca((nlen + 3) * sizeof(char));
|
||||
if (buffer != nullptr)
|
||||
{
|
||||
if (nlen > 0)
|
||||
{
|
||||
vsnprintf(buffer, nlen, strFormat, args);
|
||||
buffer[nlen - 1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
strcat(buffer, "\r\n");
|
||||
g_CPULogFile->Log(buffer);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void Start_Recompiler_Log (void)
|
||||
{
|
||||
CPath LogFileName(g_Settings->LoadStringVal(Directory_Log).c_str(), "CPUoutput.log");
|
||||
if (g_CPULogFile != nullptr)
|
||||
{
|
||||
Stop_Recompiler_Log();
|
||||
}
|
||||
g_CPULogFile = new CLog();
|
||||
if (g_CPULogFile)
|
||||
{
|
||||
if (g_CPULogFile->Open(LogFileName))
|
||||
{
|
||||
g_CPULogFile->SetMaxFileSize(300 * CLog::MB);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete g_CPULogFile;
|
||||
g_CPULogFile = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Stop_Recompiler_Log (void)
|
||||
{
|
||||
if (g_CPULogFile != nullptr)
|
||||
{
|
||||
delete g_CPULogFile;
|
||||
g_CPULogFile = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Flush_Recompiler_Log(void)
|
||||
{
|
||||
if (g_CPULogFile != nullptr)
|
||||
{
|
||||
g_CPULogFile->Flush();
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#pragma once
|
||||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
|
||||
#define CPU_Message(Message,... ) if (CDebugSettings::bRecordRecompilerAsm()) { Recompiler_Log_Message(Message,## __VA_ARGS__); }
|
||||
|
||||
void Recompiler_Log_Message (const char * Message, ...);
|
||||
void Start_Recompiler_Log (void);
|
||||
void Stop_Recompiler_Log(void);
|
||||
void Flush_Recompiler_Log(void);
|
|
@ -2,7 +2,8 @@
|
|||
#include "SectionInfo.h"
|
||||
#include "JumpInfo.h"
|
||||
|
||||
CJumpInfo::CJumpInfo()
|
||||
CJumpInfo::CJumpInfo(CCodeBlock & CodeBlock) :
|
||||
RegSet(CodeBlock)
|
||||
{
|
||||
TargetPC = (uint32_t)-1;
|
||||
JumpPC = (uint32_t)-1;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,7 @@ class CX86RecompilerOps :
|
|||
private CGameSettings
|
||||
{
|
||||
public:
|
||||
CX86RecompilerOps(CMipsMemoryVM & MMU);
|
||||
CX86RecompilerOps(CMipsMemoryVM & MMU, CCodeBlock & CodeBlock);
|
||||
~CX86RecompilerOps();
|
||||
|
||||
// Trap functions
|
||||
|
@ -216,7 +216,7 @@ public:
|
|||
void CompileCop1Test();
|
||||
void CompileInPermLoop(CRegInfo & RegSet, uint32_t ProgramCounter);
|
||||
void SyncRegState(const CRegInfo & SyncTo);
|
||||
bool SetupRegisterForLoop(CCodeBlock * BlockInfo, const CRegInfo & RegSet);
|
||||
bool SetupRegisterForLoop(CCodeBlock & BlockInfo, const CRegInfo & RegSet);
|
||||
CRegInfo & GetRegWorkingSet(void);
|
||||
void SetRegWorkingSet(const CRegInfo & RegInfo);
|
||||
bool InheritParentInfo();
|
||||
|
@ -236,7 +236,7 @@ public:
|
|||
void CompileReadTLBMiss(uint32_t VirtualAddress, x86Reg LookUpReg);
|
||||
void CompileReadTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
||||
void CompileWriteTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
||||
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
|
||||
void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
|
||||
void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false, bool UpdateTimer = true);
|
||||
void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
||||
void CompileExecuteBP(void);
|
||||
|
@ -247,111 +247,51 @@ public:
|
|||
// Helper functions
|
||||
typedef CRegInfo::REG_STATE REG_STATE;
|
||||
|
||||
static REG_STATE GetMipsRegState(int32_t Reg) { return m_RegWorkingSet.GetMipsRegState(Reg); }
|
||||
static uint64_t GetMipsReg(int32_t Reg) { return m_RegWorkingSet.GetMipsReg(Reg); }
|
||||
static int64_t GetMipsReg_S(int32_t Reg) { return m_RegWorkingSet.GetMipsReg_S(Reg); }
|
||||
static uint32_t GetMipsRegLo(int32_t Reg) { return m_RegWorkingSet.GetMipsRegLo(Reg); }
|
||||
static int32_t GetMipsRegLo_S(int32_t Reg) { return m_RegWorkingSet.GetMipsRegLo_S(Reg); }
|
||||
static uint32_t GetMipsRegHi(int32_t Reg) { return m_RegWorkingSet.GetMipsRegHi(Reg); }
|
||||
static int32_t GetMipsRegHi_S(int32_t Reg) { return m_RegWorkingSet.GetMipsRegHi_S(Reg); }
|
||||
static CX86Ops::x86Reg GetMipsRegMapLo(int32_t Reg) { return m_RegWorkingSet.GetMipsRegMapLo(Reg); }
|
||||
static CX86Ops::x86Reg GetMipsRegMapHi(int32_t Reg) { return m_RegWorkingSet.GetMipsRegMapHi(Reg); }
|
||||
REG_STATE GetMipsRegState(int32_t Reg) { return m_RegWorkingSet.GetMipsRegState(Reg); }
|
||||
uint64_t GetMipsReg(int32_t Reg) { return m_RegWorkingSet.GetMipsReg(Reg); }
|
||||
int64_t GetMipsReg_S(int32_t Reg) { return m_RegWorkingSet.GetMipsReg_S(Reg); }
|
||||
uint32_t GetMipsRegLo(int32_t Reg) { return m_RegWorkingSet.GetMipsRegLo(Reg); }
|
||||
int32_t GetMipsRegLo_S(int32_t Reg) { return m_RegWorkingSet.GetMipsRegLo_S(Reg); }
|
||||
uint32_t GetMipsRegHi(int32_t Reg) { return m_RegWorkingSet.GetMipsRegHi(Reg); }
|
||||
int32_t GetMipsRegHi_S(int32_t Reg) { return m_RegWorkingSet.GetMipsRegHi_S(Reg); }
|
||||
CX86Ops::x86Reg GetMipsRegMapLo(int32_t Reg) { return m_RegWorkingSet.GetMipsRegMapLo(Reg); }
|
||||
CX86Ops::x86Reg GetMipsRegMapHi(int32_t Reg) { return m_RegWorkingSet.GetMipsRegMapHi(Reg); }
|
||||
|
||||
static bool IsKnown(int32_t Reg) { return m_RegWorkingSet.IsKnown(Reg); }
|
||||
static bool IsUnknown(int32_t Reg) { return m_RegWorkingSet.IsUnknown(Reg); }
|
||||
static bool IsMapped(int32_t Reg) { return m_RegWorkingSet.IsMapped(Reg); }
|
||||
static bool IsConst(int32_t Reg) { return m_RegWorkingSet.IsConst(Reg); }
|
||||
static bool IsSigned(int32_t Reg) { return m_RegWorkingSet.IsSigned(Reg); }
|
||||
static bool IsUnsigned(int32_t Reg) { return m_RegWorkingSet.IsUnsigned(Reg); }
|
||||
static bool Is32Bit(int32_t Reg) { return m_RegWorkingSet.Is32Bit(Reg); }
|
||||
static bool Is64Bit(int32_t Reg) { return m_RegWorkingSet.Is64Bit(Reg); }
|
||||
static bool Is32BitMapped(int32_t Reg) { return m_RegWorkingSet.Is32BitMapped(Reg); }
|
||||
static bool Is64BitMapped(int32_t Reg) { return m_RegWorkingSet.Is64BitMapped(Reg); }
|
||||
bool IsKnown(int32_t Reg) { return m_RegWorkingSet.IsKnown(Reg); }
|
||||
bool IsUnknown(int32_t Reg) { return m_RegWorkingSet.IsUnknown(Reg); }
|
||||
bool IsMapped(int32_t Reg) { return m_RegWorkingSet.IsMapped(Reg); }
|
||||
bool IsConst(int32_t Reg) { return m_RegWorkingSet.IsConst(Reg); }
|
||||
bool IsSigned(int32_t Reg) { return m_RegWorkingSet.IsSigned(Reg); }
|
||||
bool IsUnsigned(int32_t Reg) { return m_RegWorkingSet.IsUnsigned(Reg); }
|
||||
bool Is32Bit(int32_t Reg) { return m_RegWorkingSet.Is32Bit(Reg); }
|
||||
bool Is64Bit(int32_t Reg) { return m_RegWorkingSet.Is64Bit(Reg); }
|
||||
bool Is32BitMapped(int32_t Reg) { return m_RegWorkingSet.Is32BitMapped(Reg); }
|
||||
bool Is64BitMapped(int32_t Reg) { return m_RegWorkingSet.Is64BitMapped(Reg); }
|
||||
|
||||
static void FixRoundModel(CRegInfo::FPU_ROUND RoundMethod)
|
||||
{
|
||||
m_RegWorkingSet.FixRoundModel(RoundMethod);
|
||||
}
|
||||
static void ChangeFPURegFormat(int32_t Reg, CRegInfo::FPU_STATE OldFormat, CRegInfo::FPU_STATE NewFormat, CRegInfo::FPU_ROUND RoundingModel)
|
||||
{
|
||||
m_RegWorkingSet.ChangeFPURegFormat(Reg, OldFormat, NewFormat, RoundingModel);
|
||||
}
|
||||
static void Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, CRegInfo::FPU_STATE Format)
|
||||
{
|
||||
m_RegWorkingSet.Load_FPR_ToTop(Reg, RegToLoad, Format);
|
||||
}
|
||||
static bool RegInStack(int32_t Reg, CRegInfo::FPU_STATE Format)
|
||||
{
|
||||
return m_RegWorkingSet.RegInStack(Reg, Format);
|
||||
}
|
||||
static x86FpuValues StackPosition(int32_t Reg)
|
||||
{
|
||||
return m_RegWorkingSet.StackPosition(Reg);
|
||||
}
|
||||
static void UnMap_AllFPRs()
|
||||
{
|
||||
m_RegWorkingSet.UnMap_AllFPRs();
|
||||
}
|
||||
static void UnMap_FPR(uint32_t Reg, bool WriteBackValue)
|
||||
{
|
||||
m_RegWorkingSet.UnMap_FPR(Reg, WriteBackValue);
|
||||
}
|
||||
void FixRoundModel(CRegInfo::FPU_ROUND RoundMethod) { m_RegWorkingSet.FixRoundModel(RoundMethod); }
|
||||
void ChangeFPURegFormat(int32_t Reg, CRegInfo::FPU_STATE OldFormat, CRegInfo::FPU_STATE NewFormat, CRegInfo::FPU_ROUND RoundingModel) { m_RegWorkingSet.ChangeFPURegFormat(Reg, OldFormat, NewFormat, RoundingModel); }
|
||||
void Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, CRegInfo::FPU_STATE Format) { m_RegWorkingSet.Load_FPR_ToTop(Reg, RegToLoad, Format); }
|
||||
bool RegInStack(int32_t Reg, CRegInfo::FPU_STATE Format) { return m_RegWorkingSet.RegInStack(Reg, Format); }
|
||||
x86FpuValues StackPosition(int32_t Reg) { return m_RegWorkingSet.StackPosition(Reg); }
|
||||
void UnMap_AllFPRs() { m_RegWorkingSet.UnMap_AllFPRs(); }
|
||||
void UnMap_FPR(uint32_t Reg, bool WriteBackValue) { m_RegWorkingSet.UnMap_FPR(Reg, WriteBackValue); }
|
||||
|
||||
static x86Reg FreeX86Reg()
|
||||
{
|
||||
return m_RegWorkingSet.FreeX86Reg();
|
||||
}
|
||||
static x86Reg Free8BitX86Reg()
|
||||
{
|
||||
return m_RegWorkingSet.Free8BitX86Reg();
|
||||
}
|
||||
static void Map_GPR_32bit(int32_t Reg, bool SignValue, int32_t MipsRegToLoad)
|
||||
{
|
||||
m_RegWorkingSet.Map_GPR_32bit(Reg, SignValue, MipsRegToLoad);
|
||||
}
|
||||
static void Map_GPR_64bit(int32_t Reg, int32_t MipsRegToLoad)
|
||||
{
|
||||
m_RegWorkingSet.Map_GPR_64bit(Reg, MipsRegToLoad);
|
||||
}
|
||||
static x86Reg Get_MemoryStack()
|
||||
{
|
||||
return m_RegWorkingSet.Get_MemoryStack();
|
||||
}
|
||||
static x86Reg Map_MemoryStack(x86Reg Reg, bool bMapRegister, bool LoadValue = true)
|
||||
{
|
||||
return m_RegWorkingSet.Map_MemoryStack(Reg, bMapRegister, LoadValue);
|
||||
}
|
||||
static x86Reg Map_TempReg(x86Reg Reg, int32_t MipsReg, bool LoadHiWord)
|
||||
{
|
||||
return m_RegWorkingSet.Map_TempReg(Reg, MipsReg, LoadHiWord);
|
||||
}
|
||||
static void ProtectGPR(uint32_t Reg)
|
||||
{
|
||||
m_RegWorkingSet.ProtectGPR(Reg);
|
||||
}
|
||||
static void UnProtectGPR(uint32_t Reg)
|
||||
{
|
||||
m_RegWorkingSet.UnProtectGPR(Reg);
|
||||
}
|
||||
static void ResetX86Protection()
|
||||
{
|
||||
m_RegWorkingSet.ResetX86Protection();
|
||||
}
|
||||
static x86Reg UnMap_TempReg()
|
||||
{
|
||||
return m_RegWorkingSet.UnMap_TempReg();
|
||||
}
|
||||
static void UnMap_GPR(uint32_t Reg, bool WriteBackValue)
|
||||
{
|
||||
m_RegWorkingSet.UnMap_GPR(Reg, WriteBackValue);
|
||||
}
|
||||
static bool UnMap_X86reg(x86Reg Reg)
|
||||
{
|
||||
return m_RegWorkingSet.UnMap_X86reg(Reg);
|
||||
}
|
||||
x86Reg FreeX86Reg() { return m_RegWorkingSet.FreeX86Reg(); }
|
||||
x86Reg Free8BitX86Reg() { return m_RegWorkingSet.Free8BitX86Reg(); }
|
||||
void Map_GPR_32bit(int32_t Reg, bool SignValue, int32_t MipsRegToLoad) { m_RegWorkingSet.Map_GPR_32bit(Reg, SignValue, MipsRegToLoad); }
|
||||
void Map_GPR_64bit(int32_t Reg, int32_t MipsRegToLoad) { m_RegWorkingSet.Map_GPR_64bit(Reg, MipsRegToLoad); }
|
||||
x86Reg Get_MemoryStack() { return m_RegWorkingSet.Get_MemoryStack(); }
|
||||
x86Reg Map_MemoryStack(x86Reg Reg, bool bMapRegister, bool LoadValue = true) { return m_RegWorkingSet.Map_MemoryStack(Reg, bMapRegister, LoadValue); }
|
||||
x86Reg Map_TempReg(x86Reg Reg, int32_t MipsReg, bool LoadHiWord) { return m_RegWorkingSet.Map_TempReg(Reg, MipsReg, LoadHiWord); }
|
||||
void ProtectGPR(uint32_t Reg) { m_RegWorkingSet.ProtectGPR(Reg); }
|
||||
void UnProtectGPR(uint32_t Reg) { m_RegWorkingSet.UnProtectGPR(Reg); }
|
||||
void ResetX86Protection() { m_RegWorkingSet.ResetX86Protection(); }
|
||||
x86Reg UnMap_TempReg() { return m_RegWorkingSet.UnMap_TempReg(); }
|
||||
void UnMap_GPR(uint32_t Reg, bool WriteBackValue) { m_RegWorkingSet.UnMap_GPR(Reg, WriteBackValue); }
|
||||
bool UnMap_X86reg(x86Reg Reg) { return m_RegWorkingSet.UnMap_X86reg(Reg); }
|
||||
|
||||
public:
|
||||
static uint32_t CompilePC() { return m_CompilePC; }
|
||||
uint32_t CompilePC() { return m_CompilePC; }
|
||||
|
||||
private:
|
||||
CX86RecompilerOps(const CX86RecompilerOps&);
|
||||
|
@ -361,9 +301,9 @@ private:
|
|||
void CompileLoadMemoryValue(CX86Ops::x86Reg AddressReg, CX86Ops::x86Reg ValueReg, CX86Ops::x86Reg ValueRegHi, uint8_t ValueSize, bool SignExtend);
|
||||
void CompileStoreMemoryValue(CX86Ops::x86Reg AddressReg, CX86Ops::x86Reg ValueReg, CX86Ops::x86Reg ValueRegHi, uint64_t Value, uint8_t ValueSize);
|
||||
|
||||
void SB_Const(uint8_t Value, uint32_t Addr);
|
||||
void SB_Const(uint32_t Value, uint32_t Addr);
|
||||
void SB_Register(CX86Ops::x86Reg Reg, uint32_t Addr);
|
||||
void SH_Const(uint16_t Value, uint32_t Addr);
|
||||
void SH_Const(uint32_t Value, uint32_t Addr);
|
||||
void SH_Register(CX86Ops::x86Reg Reg, uint32_t Addr);
|
||||
void SW_Const(uint32_t Value, uint32_t Addr);
|
||||
void SW_Register(CX86Ops::x86Reg Reg, uint32_t Addr);
|
||||
|
@ -372,18 +312,21 @@ private:
|
|||
void LW_KnownAddress(x86Reg Reg, uint32_t VAddr);
|
||||
void LW(bool ResultSigned, bool bRecordLLBit);
|
||||
void SW(bool bCheckLLbit);
|
||||
void CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, bool CompileNow, void(*x86Jmp)(const char * Label, uint32_t Value));
|
||||
void CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason, bool CompileNow, void(CX86Ops::*x86Jmp)(const char * Label, uint32_t Value));
|
||||
void ResetMemoryStack();
|
||||
|
||||
EXIT_LIST m_ExitInfo;
|
||||
CMipsMemoryVM & m_MMU;
|
||||
static PIPELINE_STAGE m_PipelineStage;
|
||||
static uint32_t m_CompilePC;
|
||||
static R4300iOpcode m_Opcode;
|
||||
static CX86RegInfo m_RegWorkingSet;
|
||||
static uint32_t m_BranchCompare;
|
||||
static CCodeSection * m_Section;
|
||||
CCodeBlock & m_CodeBlock;
|
||||
PIPELINE_STAGE m_PipelineStage;
|
||||
uint32_t m_CompilePC;
|
||||
R4300iOpcode m_Opcode;
|
||||
CX86RegInfo m_RegWorkingSet;
|
||||
CCodeSection * m_Section;
|
||||
CRegInfo m_RegBeforeDelay;
|
||||
bool m_EffectDelaySlot;
|
||||
static uint32_t m_TempValue32;
|
||||
static uint32_t m_BranchCompare;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
#include <Project64-core/N64System/Recompiler/Recompiler.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerCodeLog.h>
|
||||
#include <Project64-core/N64System/Recompiler/x86/x86RegInfo.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -15,7 +14,9 @@ uint32_t CX86RegInfo::m_fpuControl = 0;
|
|||
|
||||
const char *Format_Name[] = { "Unknown", "dword", "qword", "float", "double" };
|
||||
|
||||
CX86RegInfo::CX86RegInfo() :
|
||||
CX86RegInfo::CX86RegInfo(CCodeBlock & CodeBlock) :
|
||||
CX86Ops(CodeBlock),
|
||||
m_CodeBlock(CodeBlock),
|
||||
m_Stack_TopPos(0),
|
||||
m_InBeforeCallDirect(false)
|
||||
{
|
||||
|
@ -39,7 +40,9 @@ CX86RegInfo::CX86RegInfo() :
|
|||
}
|
||||
}
|
||||
|
||||
CX86RegInfo::CX86RegInfo(const CX86RegInfo& rhs)
|
||||
CX86RegInfo::CX86RegInfo(const CX86RegInfo& rhs) :
|
||||
CX86Ops(rhs),
|
||||
m_CodeBlock(rhs.m_CodeBlock)
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
|
@ -140,7 +143,7 @@ void CX86RegInfo::FixRoundModel(FPU_ROUND RoundMethod)
|
|||
{
|
||||
return;
|
||||
}
|
||||
CPU_Message(" FixRoundModel: CurrentRoundingModel: %s targetRoundModel: %s", RoundingModelName(GetRoundingModel()), RoundingModelName(RoundMethod));
|
||||
m_CodeBlock.Log(" FixRoundModel: CurrentRoundingModel: %s targetRoundModel: %s", RoundingModelName(GetRoundingModel()), RoundingModelName(RoundMethod));
|
||||
|
||||
m_fpuControl = 0;
|
||||
fpuStoreControl(&m_fpuControl, "m_fpuControl");
|
||||
|
@ -205,7 +208,7 @@ void CX86RegInfo::ChangeFPURegFormat(int32_t Reg, FPU_STATE OldFormat, FPU_STATE
|
|||
}
|
||||
else
|
||||
{
|
||||
CPU_Message(" regcache: Changed format of ST(%d) from %s to %s", (i - StackTopPos() + 8) & 7, Format_Name[OldFormat], Format_Name[NewFormat]);
|
||||
m_CodeBlock.Log(" regcache: Changed format of ST(%d) from %s to %s", (i - StackTopPos() + 8) & 7, Format_Name[OldFormat], Format_Name[NewFormat]);
|
||||
}
|
||||
FpuRoundingModel(i) = RoundingModel;
|
||||
m_x86fpu_State[i] = NewFormat;
|
||||
|
@ -225,7 +228,7 @@ void CX86RegInfo::Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, FPU_STATE Forma
|
|||
{
|
||||
FixRoundModel(RoundDefault);
|
||||
}
|
||||
CPU_Message("CurrentRoundingModel: %s FpuRoundingModel(StackTopPos()): %s", RoundingModelName(GetRoundingModel()), RoundingModelName(FpuRoundingModel(StackTopPos())));
|
||||
m_CodeBlock.Log("CurrentRoundingModel: %s FpuRoundingModel(StackTopPos()): %s", RoundingModelName(GetRoundingModel()), RoundingModelName(FpuRoundingModel(StackTopPos())));
|
||||
int32_t i;
|
||||
|
||||
if (RegToLoad < 0) { g_Notify->DisplayError("Load_FPR_ToTop\nRegToLoad < 0 ???"); return; }
|
||||
|
@ -305,7 +308,7 @@ void CX86RegInfo::Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, FPU_STATE Forma
|
|||
if (m_x86fpu_MappedTo[(StackTopPos() - 1) & 7] != RegToLoad)
|
||||
{
|
||||
UnMap_FPR(m_x86fpu_MappedTo[(StackTopPos() - 1) & 7], true);
|
||||
CPU_Message(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
m_CodeBlock.Log(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
fpuLoadReg(&StackTopPos(), StackPosition(RegToLoad));
|
||||
FpuRoundingModel(StackTopPos()) = RoundDefault;
|
||||
m_x86fpu_MappedTo[StackTopPos()] = Reg;
|
||||
|
@ -340,8 +343,8 @@ void CX86RegInfo::Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, FPU_STATE Forma
|
|||
m_x86fpu_MappedTo[RegPos] = m_x86fpu_MappedTo[StackTopPos()];
|
||||
m_x86fpu_State[RegPos] = m_x86fpu_State[StackTopPos()];
|
||||
m_x86fpu_StateChanged[RegPos] = m_x86fpu_StateChanged[StackTopPos()];
|
||||
CPU_Message(" regcache: allocate ST(%d) to %s", StackPos, CRegName::FPR[m_x86fpu_MappedTo[RegPos]]);
|
||||
CPU_Message(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
m_CodeBlock.Log(" regcache: allocate ST(%d) to %s", StackPos, CRegName::FPR[m_x86fpu_MappedTo[RegPos]]);
|
||||
m_CodeBlock.Log(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
|
||||
fpuExchange(StackPos);
|
||||
|
||||
|
@ -365,7 +368,7 @@ void CX86RegInfo::Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, FPU_STATE Forma
|
|||
i = 8;
|
||||
}
|
||||
}
|
||||
CPU_Message(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
m_CodeBlock.Log(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
TempReg = Map_TempReg(x86_Any, -1, false);
|
||||
switch (Format)
|
||||
{
|
||||
|
@ -536,7 +539,7 @@ CX86Ops::x86Reg CX86RegInfo::UnMap_8BitTempReg()
|
|||
{
|
||||
if (GetX86Protected((x86Reg)count) == false)
|
||||
{
|
||||
CPU_Message(" regcache: unallocate %s from temp storage", x86_Name((x86Reg)count));
|
||||
m_CodeBlock.Log(" regcache: unallocate %s from temp storage", x86_Name((x86Reg)count));
|
||||
SetX86Mapped((x86Reg)count, CX86RegInfo::NotMapped);
|
||||
return (x86Reg)count;
|
||||
}
|
||||
|
@ -585,7 +588,7 @@ CX86RegInfo::x86Reg CX86RegInfo::Map_MemoryStack(x86Reg Reg, bool bMapRegister,
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
SetX86Mapped(Reg, CX86RegInfo::Stack_Mapped);
|
||||
CPU_Message(" regcache: allocate %s as Memory Stack", x86_Name(Reg));
|
||||
m_CodeBlock.Log(" regcache: allocate %s as Memory Stack", x86_Name(Reg));
|
||||
if (LoadValue)
|
||||
{
|
||||
MoveVariableToX86reg(&g_Recompiler->MemoryStackPos(), "MemoryStack", Reg);
|
||||
|
@ -597,7 +600,7 @@ CX86RegInfo::x86Reg CX86RegInfo::Map_MemoryStack(x86Reg Reg, bool bMapRegister,
|
|||
UnMap_X86reg(Reg);
|
||||
if (CurrentMap != x86_Unknown)
|
||||
{
|
||||
CPU_Message(" regcache: change allocation of memory stack from %s to %s", x86_Name(CurrentMap), x86_Name(Reg));
|
||||
m_CodeBlock.Log(" regcache: change allocation of memory stack from %s to %s", x86_Name(CurrentMap), x86_Name(Reg));
|
||||
SetX86Mapped(Reg, CX86RegInfo::Stack_Mapped);
|
||||
SetX86Mapped(CurrentMap, CX86RegInfo::NotMapped);
|
||||
MoveX86RegToX86Reg(CurrentMap, Reg);
|
||||
|
@ -605,7 +608,7 @@ CX86RegInfo::x86Reg CX86RegInfo::Map_MemoryStack(x86Reg Reg, bool bMapRegister,
|
|||
else
|
||||
{
|
||||
SetX86Mapped(Reg, CX86RegInfo::Stack_Mapped);
|
||||
CPU_Message(" regcache: allocate %s as memory stack", x86_Name(Reg));
|
||||
m_CodeBlock.Log(" regcache: allocate %s as memory stack", x86_Name(Reg));
|
||||
if (LoadValue)
|
||||
{
|
||||
MoveVariableToX86reg(&g_Recompiler->MemoryStackPos(), "MemoryStack", Reg);
|
||||
|
@ -634,13 +637,13 @@ void CX86RegInfo::Map_GPR_32bit(int32_t MipsReg, bool SignValue, int32_t MipsReg
|
|||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
CPU_Message(" regcache: allocate %s to %s", x86_Name(Reg), CRegName::GPR[MipsReg]);
|
||||
m_CodeBlock.Log(" regcache: allocate %s to %s", x86_Name(Reg), CRegName::GPR[MipsReg]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Is64Bit(MipsReg))
|
||||
{
|
||||
CPU_Message(" regcache: unallocate %s from high 32-bit of %s", x86_Name(GetMipsRegMapHi(MipsReg)), CRegName::GPR_Hi[MipsReg]);
|
||||
m_CodeBlock.Log(" regcache: unallocate %s from high 32-bit of %s", x86_Name(GetMipsRegMapHi(MipsReg)), CRegName::GPR_Hi[MipsReg]);
|
||||
SetX86MapOrder(GetMipsRegMapHi(MipsReg), 0);
|
||||
SetX86Mapped(GetMipsRegMapHi(MipsReg), NotMapped);
|
||||
SetX86Protected(GetMipsRegMapHi(MipsReg), false);
|
||||
|
@ -712,8 +715,8 @@ void CX86RegInfo::Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad)
|
|||
if (x86lo < 0) { g_Notify->DisplayError("Map_GPR_64bit\n\nOut of registers"); return; }
|
||||
SetX86Protected(x86lo, true);
|
||||
|
||||
CPU_Message(" regcache: allocate %s to hi word of %s", x86_Name(x86Hi), CRegName::GPR[MipsReg]);
|
||||
CPU_Message(" regcache: allocate %s to low word of %s", x86_Name(x86lo), CRegName::GPR[MipsReg]);
|
||||
m_CodeBlock.Log(" regcache: allocate %s to hi word of %s", x86_Name(x86Hi), CRegName::GPR[MipsReg]);
|
||||
m_CodeBlock.Log(" regcache: allocate %s to low word of %s", x86_Name(x86lo), CRegName::GPR[MipsReg]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -729,7 +732,7 @@ void CX86RegInfo::Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad)
|
|||
}
|
||||
SetX86Protected(x86Hi, true);
|
||||
|
||||
CPU_Message(" regcache: allocate %s to hi word of %s", x86_Name(x86Hi), CRegName::GPR[MipsReg]);
|
||||
m_CodeBlock.Log(" regcache: allocate %s to hi word of %s", x86_Name(x86Hi), CRegName::GPR[MipsReg]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -784,7 +787,7 @@ void CX86RegInfo::Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad)
|
|||
}
|
||||
else
|
||||
{
|
||||
CPU_Message("Map_GPR_64bit 11");
|
||||
m_CodeBlock.Log("Map_GPR_64bit 11");
|
||||
if (Is32Bit(MipsRegToLoad))
|
||||
{
|
||||
if (IsSigned(MipsRegToLoad))
|
||||
|
@ -883,7 +886,7 @@ CX86Ops::x86Reg CX86RegInfo::Map_TempReg(CX86Ops::x86Reg Reg, int32_t MipsReg, b
|
|||
UnMap_GPR(count, true);
|
||||
break;
|
||||
}
|
||||
CPU_Message(" regcache: change allocation of %s from %s to %s", CRegName::GPR[count], x86_Name(Reg), x86_Name(NewReg));
|
||||
m_CodeBlock.Log(" regcache: change allocation of %s from %s to %s", CRegName::GPR[count], x86_Name(Reg), x86_Name(NewReg));
|
||||
SetX86Mapped(NewReg, GPR_Mapped);
|
||||
SetX86MapOrder(NewReg, GetX86MapOrder(Reg));
|
||||
SetMipsRegMapLo(count, NewReg);
|
||||
|
@ -901,7 +904,7 @@ CX86Ops::x86Reg CX86RegInfo::Map_TempReg(CX86Ops::x86Reg Reg, int32_t MipsReg, b
|
|||
UnMap_GPR(count, true);
|
||||
break;
|
||||
}
|
||||
CPU_Message(" regcache: change allocation of %s from %s to %s", CRegName::GPR_Hi[count], x86_Name(Reg), x86_Name(NewReg));
|
||||
m_CodeBlock.Log(" regcache: change allocation of %s from %s to %s", CRegName::GPR_Hi[count], x86_Name(Reg), x86_Name(NewReg));
|
||||
SetX86Mapped(NewReg, GPR_Mapped);
|
||||
SetX86MapOrder(NewReg, GetX86MapOrder(Reg));
|
||||
SetMipsRegMapHi(count, NewReg);
|
||||
|
@ -918,7 +921,7 @@ CX86Ops::x86Reg CX86RegInfo::Map_TempReg(CX86Ops::x86Reg Reg, int32_t MipsReg, b
|
|||
{
|
||||
UnMap_X86reg(Reg);
|
||||
}
|
||||
CPU_Message(" regcache: allocate %s as temp storage", x86_Name(Reg));
|
||||
m_CodeBlock.Log(" regcache: allocate %s as temp storage", x86_Name(Reg));
|
||||
|
||||
if (MipsReg >= 0)
|
||||
{
|
||||
|
@ -1066,7 +1069,7 @@ void CX86RegInfo::UnMap_FPR(int32_t Reg, bool WriteBackValue)
|
|||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if (m_x86fpu_MappedTo[i] != Reg) { continue; }
|
||||
CPU_Message(" regcache: unallocate %s from ST(%d)", CRegName::FPR[Reg], (i - StackTopPos() + 8) & 7);
|
||||
m_CodeBlock.Log(" regcache: unallocate %s from ST(%d)", CRegName::FPR[Reg], (i - StackTopPos() + 8) & 7);
|
||||
if (WriteBackValue)
|
||||
{
|
||||
int32_t RegPos;
|
||||
|
@ -1157,7 +1160,7 @@ void CX86RegInfo::UnMap_GPR(uint32_t Reg, bool WriteBackValue)
|
|||
}
|
||||
|
||||
if (IsUnknown(Reg)) { return; }
|
||||
//CPU_Message("UnMap_GPR: State: %X\tReg: %s\tWriteBack: %s",State,CRegName::GPR[Reg],WriteBackValue?"true":"false");
|
||||
//m_CodeBlock.Log("UnMap_GPR: State: %X\tReg: %s\tWriteBack: %s",State,CRegName::GPR[Reg],WriteBackValue?"true":"false");
|
||||
if (IsConst(Reg))
|
||||
{
|
||||
if (!WriteBackValue)
|
||||
|
@ -1186,11 +1189,11 @@ void CX86RegInfo::UnMap_GPR(uint32_t Reg, bool WriteBackValue)
|
|||
}
|
||||
if (Is64Bit(Reg))
|
||||
{
|
||||
CPU_Message(" regcache: unallocate %s from %s", x86_Name(GetMipsRegMapHi(Reg)), CRegName::GPR_Hi[Reg]);
|
||||
m_CodeBlock.Log(" regcache: unallocate %s from %s", x86_Name(GetMipsRegMapHi(Reg)), CRegName::GPR_Hi[Reg]);
|
||||
SetX86Mapped(GetMipsRegMapHi(Reg), NotMapped);
|
||||
SetX86Protected(GetMipsRegMapHi(Reg), false);
|
||||
}
|
||||
CPU_Message(" regcache: unallocate %s from %s", x86_Name(GetMipsRegMapLo(Reg)), CRegName::GPR_Lo[Reg]);
|
||||
m_CodeBlock.Log(" regcache: unallocate %s from %s", x86_Name(GetMipsRegMapLo(Reg)), CRegName::GPR_Lo[Reg]);
|
||||
SetX86Mapped(GetMipsRegMapLo(Reg), NotMapped);
|
||||
SetX86Protected(GetMipsRegMapLo(Reg), false);
|
||||
if (!WriteBackValue)
|
||||
|
@ -1241,7 +1244,7 @@ CX86Ops::x86Reg CX86RegInfo::UnMap_TempReg()
|
|||
{
|
||||
if (GetX86Mapped(Reg) == Temp_Mapped)
|
||||
{
|
||||
CPU_Message(" regcache: unallocate %s from temp storage", x86_Name(Reg));
|
||||
m_CodeBlock.Log(" regcache: unallocate %s from temp storage", x86_Name(Reg));
|
||||
}
|
||||
SetX86Mapped(Reg, NotMapped);
|
||||
}
|
||||
|
@ -1292,14 +1295,14 @@ bool CX86RegInfo::UnMap_X86reg(CX86Ops::x86Reg Reg)
|
|||
{
|
||||
if (!GetX86Protected(Reg))
|
||||
{
|
||||
CPU_Message(" regcache: unallocate %s from temp storage", x86_Name(Reg));
|
||||
m_CodeBlock.Log(" regcache: unallocate %s from temp storage", x86_Name(Reg));
|
||||
SetX86Mapped(Reg, NotMapped);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (GetX86Mapped(Reg) == CX86RegInfo::Stack_Mapped)
|
||||
{
|
||||
CPU_Message(" regcache: unallocate %s from memory stack", x86_Name(Reg));
|
||||
m_CodeBlock.Log(" regcache: unallocate %s from memory stack", x86_Name(Reg));
|
||||
MoveX86regToVariable(Reg, &(g_Recompiler->MemoryStackPos()), "MemoryStack");
|
||||
SetX86Mapped(Reg, NotMapped);
|
||||
return true;
|
||||
|
@ -1448,7 +1451,7 @@ void CX86RegInfo::WriteBackRegisters()
|
|||
SetMipsRegState(count, CX86RegInfo::STATE_UNKNOWN);
|
||||
break;
|
||||
default:
|
||||
CPU_Message("%s: Unknown State: %d reg %d (%s)", __FUNCTION__, GetMipsRegState(count), count, CRegName::GPR[count]);
|
||||
m_CodeBlock.Log("%s: Unknown State: %d reg %d (%s)", __FUNCTION__, GetMipsRegState(count), count, CRegName::GPR[count]);
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
};
|
||||
|
||||
public:
|
||||
CX86RegInfo();
|
||||
CX86RegInfo(CCodeBlock & CodeBlock);
|
||||
CX86RegInfo(const CX86RegInfo&);
|
||||
~CX86RegInfo();
|
||||
|
||||
|
@ -90,6 +90,9 @@ public:
|
|||
FPU_ROUND & FpuRoundingModel(int32_t Reg) { return m_x86fpu_RoundingModel[Reg]; }
|
||||
|
||||
private:
|
||||
CX86RegInfo();
|
||||
|
||||
CCodeBlock & m_CodeBlock;
|
||||
x86Reg UnMap_8BitTempReg();
|
||||
|
||||
// r4k
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#if defined(__i386__) || defined(_M_IX86)
|
||||
|
||||
class CCodeBlock;
|
||||
|
||||
class CX86Ops
|
||||
{
|
||||
public:
|
||||
|
@ -49,250 +51,258 @@ public:
|
|||
static const char * x86_HalfName(x86Reg Reg);
|
||||
static const char * fpu_Name(x86FpuValues Reg);
|
||||
|
||||
protected:
|
||||
public:
|
||||
CX86Ops(CCodeBlock & CodeBlock);
|
||||
|
||||
// Logging functions
|
||||
static void WriteX86Comment(const char * Comment);
|
||||
static void WriteX86Label(const char * Label);
|
||||
void WriteX86Comment(const char * Comment);
|
||||
void WriteX86Label(const char * Label);
|
||||
|
||||
static void AdcX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void AdcConstToVariable(void *Variable, const char * VariableName, uint8_t Constant);
|
||||
static void AdcConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void AdcVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void AdcX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void AddConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||
static void AddConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void AddVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void AddX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void AddX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void AndConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||
static void AndConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void AndVariableToX86Reg(void * Variable, const char * VariableName, x86Reg Reg);
|
||||
static void AndVariableDispToX86Reg(void * Variable, const char * VariableName, x86Reg Reg, x86Reg AddrReg, Multipler Multiply);
|
||||
static void AndX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void X86HardBreakPoint();
|
||||
static void X86BreakPoint(const char * FileName, int32_t LineNumber);
|
||||
static void Call_Direct(void * FunctAddress, const char * FunctName);
|
||||
static void Call_Indirect(void * FunctAddress, const char * FunctName);
|
||||
static void CompConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void CompConstToX86reg(x86Reg Reg, uint32_t Const);
|
||||
static void CompConstToX86regPointer(x86Reg Reg, uint32_t Const);
|
||||
static void CompX86regToVariable(x86Reg Reg, void * Variable, const char * VariableName);
|
||||
static void CompVariableToX86reg(x86Reg Reg, void * Variable, const char * VariableName);
|
||||
static void CompX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void DecX86reg(x86Reg Reg);
|
||||
static void DivX86reg(x86Reg reg);
|
||||
static void idivX86reg(x86Reg reg);
|
||||
static void imulX86reg(x86Reg reg);
|
||||
static void IncX86reg(x86Reg Reg);
|
||||
static void JaeLabel8(const char * Label, uint8_t Value);
|
||||
static void JaeLabel32(const char * Label, uint32_t Value);
|
||||
static void JaLabel8(const char * Label, uint8_t Value);
|
||||
static void JaLabel32(const char * Label, uint32_t Value);
|
||||
static void JbLabel8(const char * Label, uint8_t Value);
|
||||
static void JbLabel32(const char * Label, uint32_t Value);
|
||||
static void JecxzLabel8(const char * Label, uint8_t Value);
|
||||
static void JeLabel8(const char * Label, uint8_t Value);
|
||||
static void JeLabel32(const char * Label, uint32_t Value);
|
||||
static void JgeLabel32(const char * Label, uint32_t Value);
|
||||
static void JgLabel8(const char * Label, uint8_t Value);
|
||||
static void JgLabel32(const char * Label, uint32_t Value);
|
||||
static void JleLabel8(const char * Label, uint8_t Value);
|
||||
static void JleLabel32(const char * Label, uint32_t Value);
|
||||
static void JlLabel8(const char * Label, uint8_t Value);
|
||||
static void JlLabel32(const char * Label, uint32_t Value);
|
||||
static void JmpDirectReg(x86Reg reg);
|
||||
static void JmpIndirectLabel32(const char * Label, uint32_t location);
|
||||
static void JmpIndirectReg(x86Reg reg);
|
||||
static void JmpLabel8(const char * Label, uint8_t Value);
|
||||
static void JmpLabel32(const char * Label, uint32_t Value);
|
||||
static void JneLabel8(const char * Label, uint8_t Value);
|
||||
static void JneLabel32(const char * Label, uint32_t Value);
|
||||
static void JnsLabel8(const char * Label, uint8_t Value);
|
||||
static void JnsLabel32(const char * Label, uint32_t Value);
|
||||
static void JnzLabel8(const char * Label, uint8_t Value);
|
||||
static void JnzLabel32(const char * Label, uint32_t Value);
|
||||
static void JsLabel32(const char * Label, uint32_t Value);
|
||||
static void JzLabel8(const char * Label, uint8_t Value);
|
||||
static void JzLabel32(const char * Label, uint32_t Value);
|
||||
static void LeaRegReg(x86Reg RegDest, x86Reg RegSrc, uint32_t Const, Multipler multiplier);
|
||||
static void LeaRegReg2(x86Reg RegDest, x86Reg RegSrc, x86Reg RegSrc2, Multipler multiplier);
|
||||
static void LeaSourceAndOffset(x86Reg x86DestReg, x86Reg x86SourceReg, int32_t offset);
|
||||
static void MoveConstByteToN64Mem(uint8_t Const, x86Reg AddrReg);
|
||||
static void MoveConstHalfToN64Mem(uint16_t Const, x86Reg AddrReg);
|
||||
static void MoveConstByteToVariable(uint8_t Const, void * Variable, const char * VariableName);
|
||||
static void MoveConstByteToX86regPointer(uint8_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName);
|
||||
static void MoveConstHalfToX86regPointer(uint16_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveConstToMemoryDisp(uint32_t Const, x86Reg AddrReg, uint32_t Disp);
|
||||
static void MoveConstToN64Mem(uint32_t Const, x86Reg AddrReg);
|
||||
static void MoveConstToN64MemDisp(uint32_t Const, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void MoveConstToX86Pointer(uint32_t Const, x86Reg X86Pointer);
|
||||
static void MoveConstToX86reg(uint32_t Const, x86Reg reg);
|
||||
static void MoveConstToX86regPointer(uint32_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveN64MemDispToX86reg(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveN64MemToX86reg(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveSxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveSxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MoveSxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MoveVariableDispToX86Reg(void * Variable, const char * VariableName, x86Reg Reg, x86Reg AddrReg, int32_t Multiplier);
|
||||
static void MoveVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MoveVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MoveVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MoveX86PointerToX86reg(x86Reg reg, x86Reg X86Pointer);
|
||||
static void MoveX86PointerToX86regDisp(x86Reg reg, x86Reg X86Pointer, uint8_t Disp);
|
||||
static void MoveX86regByteToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regByteToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86regByteToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveX86regHalfToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regHalfToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86regHalfToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveX86regPointerToX86regDisp8(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg, uint8_t offset);
|
||||
static void MoveX86regToMemory(x86Reg reg, x86Reg AddrReg, uint32_t Disp);
|
||||
static void MoveX86regToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regToN64MemDisp(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||
static void MoveX86regToX86Pointer(x86Reg reg, x86Reg X86Pointer);
|
||||
static void MoveX86regToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveZxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveZxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveZxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveZxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveZxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MoveZxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MulX86reg(x86Reg reg);
|
||||
static void NotX86Reg(x86Reg Reg);
|
||||
static void OrConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void OrConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||
static void OrVariableToX86Reg(void * Variable, const char * VariableName, x86Reg Reg);
|
||||
static void OrX86RegToVariable(void * Variable, const char * VariableName, x86Reg Reg);
|
||||
static void OrX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void Push(x86Reg reg);
|
||||
static void Pushad();
|
||||
static void PushImm32(uint32_t Value);
|
||||
static void PushImm32(const char * String, uint32_t Value);
|
||||
static void Pop(x86Reg reg);
|
||||
static void Popad();
|
||||
static void Ret();
|
||||
static void Seta(x86Reg reg);
|
||||
static void Setae(x86Reg reg);
|
||||
static void SetaVariable(void * Variable, const char * VariableName);
|
||||
static void Setb(x86Reg reg);
|
||||
static void SetbVariable(void * Variable, const char * VariableName);
|
||||
static void Setg(x86Reg reg);
|
||||
static void SetgVariable(void * Variable, const char * VariableName);
|
||||
static void Setl(x86Reg reg);
|
||||
static void SetlVariable(void * Variable, const char * VariableName);
|
||||
static void Setz(x86Reg reg);
|
||||
static void Setnz(x86Reg reg);
|
||||
static void ShiftLeftDouble(x86Reg Destination, x86Reg Source);
|
||||
static void ShiftLeftDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||
static void ShiftLeftSign(x86Reg reg);
|
||||
static void ShiftLeftSignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void ShiftRightDouble(x86Reg Destination, x86Reg Source);
|
||||
static void ShiftRightDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||
static void ShiftRightSign(x86Reg reg);
|
||||
static void ShiftRightSignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void ShiftRightUnsign(x86Reg reg);
|
||||
static void ShiftRightUnsignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void SbbConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void SbbVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void SbbX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void SubConstFromVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void SubConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void SubVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void SubX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void TestConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||
static void TestVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void TestX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void TestX86ByteRegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void XorConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void XorX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||
static void XorVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
||||
void AdcX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void AdcConstToVariable(void *Variable, const char * VariableName, uint8_t Constant);
|
||||
void AdcConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
void AdcVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void AdcX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void AddConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||
void AddConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
void AddVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void AddX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void AddX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void AndConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||
void AndConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
void AndVariableToX86Reg(void * Variable, const char * VariableName, x86Reg Reg);
|
||||
void AndVariableDispToX86Reg(void * Variable, const char * VariableName, x86Reg Reg, x86Reg AddrReg, Multipler Multiply);
|
||||
void AndX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void X86HardBreakPoint();
|
||||
void X86BreakPoint(const char * FileName, int32_t LineNumber);
|
||||
void Call_Direct(void * FunctAddress, const char * FunctName);
|
||||
void Call_Indirect(void * FunctAddress, const char * FunctName);
|
||||
void CompConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
void CompConstToX86reg(x86Reg Reg, uint32_t Const);
|
||||
void CompConstToX86regPointer(x86Reg Reg, uint32_t Const);
|
||||
void CompX86regToVariable(x86Reg Reg, void * Variable, const char * VariableName);
|
||||
void CompVariableToX86reg(x86Reg Reg, void * Variable, const char * VariableName);
|
||||
void CompX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void DecX86reg(x86Reg Reg);
|
||||
void DivX86reg(x86Reg reg);
|
||||
void idivX86reg(x86Reg reg);
|
||||
void imulX86reg(x86Reg reg);
|
||||
void IncX86reg(x86Reg Reg);
|
||||
void JaeLabel8(const char * Label, uint8_t Value);
|
||||
void JaeLabel32(const char * Label, uint32_t Value);
|
||||
void JaLabel8(const char * Label, uint8_t Value);
|
||||
void JaLabel32(const char * Label, uint32_t Value);
|
||||
void JbLabel8(const char * Label, uint8_t Value);
|
||||
void JbLabel32(const char * Label, uint32_t Value);
|
||||
void JecxzLabel8(const char * Label, uint8_t Value);
|
||||
void JeLabel8(const char * Label, uint8_t Value);
|
||||
void JeLabel32(const char * Label, uint32_t Value);
|
||||
void JgeLabel32(const char * Label, uint32_t Value);
|
||||
void JgLabel8(const char * Label, uint8_t Value);
|
||||
void JgLabel32(const char * Label, uint32_t Value);
|
||||
void JleLabel8(const char * Label, uint8_t Value);
|
||||
void JleLabel32(const char * Label, uint32_t Value);
|
||||
void JlLabel8(const char * Label, uint8_t Value);
|
||||
void JlLabel32(const char * Label, uint32_t Value);
|
||||
void JmpDirectReg(x86Reg reg);
|
||||
void JmpIndirectLabel32(const char * Label, uint32_t location);
|
||||
void JmpIndirectReg(x86Reg reg);
|
||||
void JmpLabel8(const char * Label, uint8_t Value);
|
||||
void JmpLabel32(const char * Label, uint32_t Value);
|
||||
void JneLabel8(const char * Label, uint8_t Value);
|
||||
void JneLabel32(const char * Label, uint32_t Value);
|
||||
void JnsLabel8(const char * Label, uint8_t Value);
|
||||
void JnsLabel32(const char * Label, uint32_t Value);
|
||||
void JnzLabel8(const char * Label, uint8_t Value);
|
||||
void JnzLabel32(const char * Label, uint32_t Value);
|
||||
void JsLabel32(const char * Label, uint32_t Value);
|
||||
void JzLabel8(const char * Label, uint8_t Value);
|
||||
void JzLabel32(const char * Label, uint32_t Value);
|
||||
void LeaRegReg(x86Reg RegDest, x86Reg RegSrc, uint32_t Const, Multipler multiplier);
|
||||
void LeaRegReg2(x86Reg RegDest, x86Reg RegSrc, x86Reg RegSrc2, Multipler multiplier);
|
||||
void LeaSourceAndOffset(x86Reg x86DestReg, x86Reg x86SourceReg, int32_t offset);
|
||||
void MoveConstByteToN64Mem(uint8_t Const, x86Reg AddrReg);
|
||||
void MoveConstHalfToN64Mem(uint16_t Const, x86Reg AddrReg);
|
||||
void MoveConstByteToVariable(uint8_t Const, void * Variable, const char * VariableName);
|
||||
void MoveConstByteToX86regPointer(uint8_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
void MoveConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName);
|
||||
void MoveConstHalfToX86regPointer(uint16_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
void MoveConstToMemoryDisp(uint32_t Const, x86Reg AddrReg, uint32_t Disp);
|
||||
void MoveConstToN64Mem(uint32_t Const, x86Reg AddrReg);
|
||||
void MoveConstToN64MemDisp(uint32_t Const, x86Reg AddrReg, uint8_t Disp);
|
||||
void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
void MoveConstToX86Pointer(uint32_t Const, x86Reg X86Pointer);
|
||||
void MoveConstToX86reg(uint32_t Const, x86Reg reg);
|
||||
void MoveConstToX86regPointer(uint32_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
void MoveN64MemDispToX86reg(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||
void MoveN64MemToX86reg(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveSxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
void MoveSxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
void MoveSxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveSxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveSxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||
void MoveSxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||
void MoveVariableDispToX86Reg(void * Variable, const char * VariableName, x86Reg Reg, x86Reg AddrReg, int32_t Multiplier);
|
||||
void MoveVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
||||
void MoveVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||
void MoveVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||
void MoveX86PointerToX86reg(x86Reg reg, x86Reg X86Pointer);
|
||||
void MoveX86PointerToX86regDisp(x86Reg reg, x86Reg X86Pointer, uint8_t Disp);
|
||||
void MoveX86regByteToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveX86regByteToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void MoveX86regByteToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
void MoveX86regHalfToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveX86regHalfToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void MoveX86regHalfToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
void MoveX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
void MoveX86regPointerToX86regDisp8(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg, uint8_t offset);
|
||||
void MoveX86regToMemory(x86Reg reg, x86Reg AddrReg, uint32_t Disp);
|
||||
void MoveX86regToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveX86regToN64MemDisp(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||
void MoveX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void MoveX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||
void MoveX86regToX86Pointer(x86Reg reg, x86Reg X86Pointer);
|
||||
void MoveX86regToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
void MoveZxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
void MoveZxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
void MoveZxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveZxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
void MoveZxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||
void MoveZxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||
void MulX86reg(x86Reg reg);
|
||||
void NotX86Reg(x86Reg Reg);
|
||||
void OrConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
void OrConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||
void OrVariableToX86Reg(void * Variable, const char * VariableName, x86Reg Reg);
|
||||
void OrX86RegToVariable(void * Variable, const char * VariableName, x86Reg Reg);
|
||||
void OrX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void Push(x86Reg reg);
|
||||
void Pushad();
|
||||
void PushImm32(uint32_t Value);
|
||||
void PushImm32(const char * String, uint32_t Value);
|
||||
void Pop(x86Reg reg);
|
||||
void Popad();
|
||||
void Ret();
|
||||
void Seta(x86Reg reg);
|
||||
void Setae(x86Reg reg);
|
||||
void SetaVariable(void * Variable, const char * VariableName);
|
||||
void Setb(x86Reg reg);
|
||||
void SetbVariable(void * Variable, const char * VariableName);
|
||||
void Setg(x86Reg reg);
|
||||
void SetgVariable(void * Variable, const char * VariableName);
|
||||
void Setl(x86Reg reg);
|
||||
void SetlVariable(void * Variable, const char * VariableName);
|
||||
void Setz(x86Reg reg);
|
||||
void Setnz(x86Reg reg);
|
||||
void ShiftLeftDouble(x86Reg Destination, x86Reg Source);
|
||||
void ShiftLeftDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||
void ShiftLeftSign(x86Reg reg);
|
||||
void ShiftLeftSignImmed(x86Reg reg, uint8_t Immediate);
|
||||
void ShiftRightDouble(x86Reg Destination, x86Reg Source);
|
||||
void ShiftRightDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||
void ShiftRightSign(x86Reg reg);
|
||||
void ShiftRightSignImmed(x86Reg reg, uint8_t Immediate);
|
||||
void ShiftRightUnsign(x86Reg reg);
|
||||
void ShiftRightUnsignImmed(x86Reg reg, uint8_t Immediate);
|
||||
void SbbConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||
void SbbVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void SbbX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void SubConstFromVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
void SubConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||
void SubVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
void SubX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void TestConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||
void TestVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
void TestX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void TestX86ByteRegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
void XorConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
void XorX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||
void XorVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
||||
|
||||
static void fpuAbs();
|
||||
static void fpuAddDword(void * Variable, const char * VariableName);
|
||||
static void fpuAddDwordRegPointer(x86Reg x86Pointer);
|
||||
static void fpuAddQword(void * Variable, const char * VariableName);
|
||||
static void fpuAddQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuAddReg(x86FpuValues reg);
|
||||
static void fpuAddRegPop(int32_t * StackPos, x86FpuValues reg);
|
||||
static void fpuComDword(void * Variable, const char * VariableName, bool Pop);
|
||||
static void fpuComDwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||
static void fpuComQword(void * Variable, const char * VariableName, bool Pop);
|
||||
static void fpuComQwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||
static void fpuComReg(x86FpuValues reg, bool Pop);
|
||||
static void fpuDivDword(void * Variable, const char * VariableName);
|
||||
static void fpuDivDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuDivQword(void * Variable, const char * VariableName);
|
||||
static void fpuDivQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuDivReg(x86FpuValues Reg);
|
||||
static void fpuDivRegPop(x86FpuValues reg);
|
||||
static void fpuExchange(x86FpuValues Reg);
|
||||
static void fpuFree(x86FpuValues Reg);
|
||||
static void fpuDecStack(int32_t * StackPos);
|
||||
static void fpuIncStack(int32_t * StackPos);
|
||||
static void fpuLoadControl(void * Variable, const char * VariableName);
|
||||
static void fpuLoadDword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
static void fpuLoadDwordFromX86Reg(int32_t * StackPos, x86Reg reg);
|
||||
static void fpuLoadDwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||
static void fpuLoadInt32bFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||
static void fpuLoadIntegerDword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
static void fpuLoadIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
static void fpuLoadIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
static void fpuLoadQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadQwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||
static void fpuLoadReg(int32_t * StackPos, x86FpuValues Reg);
|
||||
static void fpuMulDword(void * Variable, const char * VariableName);
|
||||
static void fpuMulDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuMulQword(void * Variable, const char * VariableName);
|
||||
static void fpuMulQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuMulReg(x86FpuValues reg);
|
||||
static void fpuMulRegPop(x86FpuValues reg);
|
||||
static void fpuNeg();
|
||||
static void fpuRound();
|
||||
static void fpuSqrt();
|
||||
static void fpuStoreControl(void * Variable, const char * VariableName);
|
||||
static void fpuStoreDword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||
static void fpuStoreDwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
static void fpuStoreDwordToN64Mem(int32_t * StackPos, x86Reg reg, bool Pop);
|
||||
static void fpuStoreIntegerDword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||
static void fpuStoreIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
static void fpuStoreIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||
static void fpuStoreIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
static void fpuStoreQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
static void fpuStoreStatus();
|
||||
static void fpuSubDword(void * Variable, const char * VariableName);
|
||||
static void fpuSubDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuSubDwordReverse(void * Variable, const char * VariableName);
|
||||
static void fpuSubQword(void * Variable, const char * VariableName);
|
||||
static void fpuSubQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuSubQwordReverse(void * Variable, const char * VariableName);
|
||||
static void fpuSubReg(x86FpuValues reg);
|
||||
static void fpuSubRegPop(x86FpuValues reg);
|
||||
void fpuAbs();
|
||||
void fpuAddDword(void * Variable, const char * VariableName);
|
||||
void fpuAddDwordRegPointer(x86Reg x86Pointer);
|
||||
void fpuAddQword(void * Variable, const char * VariableName);
|
||||
void fpuAddQwordRegPointer(x86Reg X86Pointer);
|
||||
void fpuAddReg(x86FpuValues reg);
|
||||
void fpuAddRegPop(int32_t * StackPos, x86FpuValues reg);
|
||||
void fpuComDword(void * Variable, const char * VariableName, bool Pop);
|
||||
void fpuComDwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||
void fpuComQword(void * Variable, const char * VariableName, bool Pop);
|
||||
void fpuComQwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||
void fpuComReg(x86FpuValues reg, bool Pop);
|
||||
void fpuDivDword(void * Variable, const char * VariableName);
|
||||
void fpuDivDwordRegPointer(x86Reg X86Pointer);
|
||||
void fpuDivQword(void * Variable, const char * VariableName);
|
||||
void fpuDivQwordRegPointer(x86Reg X86Pointer);
|
||||
void fpuDivReg(x86FpuValues Reg);
|
||||
void fpuDivRegPop(x86FpuValues reg);
|
||||
void fpuExchange(x86FpuValues Reg);
|
||||
void fpuFree(x86FpuValues Reg);
|
||||
void fpuDecStack(int32_t * StackPos);
|
||||
void fpuIncStack(int32_t * StackPos);
|
||||
void fpuLoadControl(void * Variable, const char * VariableName);
|
||||
void fpuLoadDword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
void fpuLoadDwordFromX86Reg(int32_t * StackPos, x86Reg reg);
|
||||
void fpuLoadDwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||
void fpuLoadInt32bFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||
void fpuLoadIntegerDword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
void fpuLoadIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
void fpuLoadIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
void fpuLoadIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
void fpuLoadQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
void fpuLoadQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
void fpuLoadQwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||
void fpuLoadReg(int32_t * StackPos, x86FpuValues Reg);
|
||||
void fpuMulDword(void * Variable, const char * VariableName);
|
||||
void fpuMulDwordRegPointer(x86Reg X86Pointer);
|
||||
void fpuMulQword(void * Variable, const char * VariableName);
|
||||
void fpuMulQwordRegPointer(x86Reg X86Pointer);
|
||||
void fpuMulReg(x86FpuValues reg);
|
||||
void fpuMulRegPop(x86FpuValues reg);
|
||||
void fpuNeg();
|
||||
void fpuRound();
|
||||
void fpuSqrt();
|
||||
void fpuStoreControl(void * Variable, const char * VariableName);
|
||||
void fpuStoreDword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||
void fpuStoreDwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
void fpuStoreDwordToN64Mem(int32_t * StackPos, x86Reg reg, bool Pop);
|
||||
void fpuStoreIntegerDword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||
void fpuStoreIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
void fpuStoreIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||
void fpuStoreIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
void fpuStoreQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
void fpuStoreStatus();
|
||||
void fpuSubDword(void * Variable, const char * VariableName);
|
||||
void fpuSubDwordRegPointer(x86Reg X86Pointer);
|
||||
void fpuSubDwordReverse(void * Variable, const char * VariableName);
|
||||
void fpuSubQword(void * Variable, const char * VariableName);
|
||||
void fpuSubQwordRegPointer(x86Reg X86Pointer);
|
||||
void fpuSubQwordReverse(void * Variable, const char * VariableName);
|
||||
void fpuSubReg(x86FpuValues reg);
|
||||
void fpuSubRegPop(x86FpuValues reg);
|
||||
|
||||
static bool Is8BitReg(x86Reg Reg);
|
||||
static uint8_t CalcMultiplyCode(Multipler Multiply);
|
||||
|
||||
static void * GetAddressOf(int32_t value, ...);
|
||||
static void SetJump32(uint32_t * Loc, uint32_t * JumpLoc);
|
||||
static void SetJump8(uint8_t * Loc, uint8_t * JumpLoc);
|
||||
void * GetAddressOf(int32_t value, ...);
|
||||
void SetJump32(uint32_t * Loc, uint32_t * JumpLoc);
|
||||
void SetJump8(uint8_t * Loc, uint8_t * JumpLoc);
|
||||
|
||||
private:
|
||||
CX86Ops(void);
|
||||
|
||||
void CodeLog(_Printf_format_string_ const char * Text, ...);
|
||||
|
||||
static void BreakPointNotification(const char * FileName, int32_t LineNumber);
|
||||
static char m_fpupop[2][2];
|
||||
static void AddCode8(uint8_t value);
|
||||
static void AddCode16(uint16_t value);
|
||||
static void AddCode32(uint32_t value);
|
||||
void AddCode8(uint8_t value);
|
||||
void AddCode16(uint16_t value);
|
||||
void AddCode32(uint32_t value);
|
||||
|
||||
CCodeBlock & m_CodeBlock;
|
||||
};
|
||||
|
||||
#define AddressOf(Addr) CX86Ops::GetAddressOf(5,(Addr))
|
||||
|
|
|
@ -93,11 +93,11 @@
|
|||
<ClCompile Include="N64System\Recompiler\Arm\ArmRegInfo.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\CodeBlock.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\CodeSection.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\ExitInfo.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\FunctionInfo.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\FunctionMap.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\LoopAnalysis.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\Recompiler.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\RecompilerCodeLog.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\RecompilerMemory.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\RegBase.cpp" />
|
||||
<ClCompile Include="N64System\Recompiler\SectionInfo.cpp" />
|
||||
|
@ -221,7 +221,6 @@
|
|||
<ClInclude Include="N64System\Recompiler\JumpInfo.h" />
|
||||
<ClInclude Include="N64System\Recompiler\LoopAnalysis.h" />
|
||||
<ClInclude Include="N64System\Recompiler\Recompiler.h" />
|
||||
<ClInclude Include="N64System\Recompiler\RecompilerCodeLog.h" />
|
||||
<ClInclude Include="N64System\Recompiler\RecompilerMemory.h" />
|
||||
<ClInclude Include="N64System\Recompiler\RecompilerOps.h" />
|
||||
<ClInclude Include="N64System\Recompiler\RegBase.h" />
|
||||
|
|
|
@ -303,9 +303,6 @@
|
|||
<ClCompile Include="RomList\RomList.cpp">
|
||||
<Filter>Source Files\Rom List</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Recompiler\RecompilerCodeLog.cpp">
|
||||
<Filter>Source Files\N64 System\Recompiler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Recompiler\x86\x86RecompilerOps.cpp">
|
||||
<Filter>Source Files\N64 System\Recompiler\x86</Filter>
|
||||
</ClCompile>
|
||||
|
@ -408,6 +405,9 @@
|
|||
<ClCompile Include="N64System\MemoryHandler\ISViewerHandler.cpp">
|
||||
<Filter>Source Files\N64 System\MemoryHandler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Recompiler\ExitInfo.cpp">
|
||||
<Filter>Source Files\N64 System\Recompiler</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
|
@ -662,9 +662,6 @@
|
|||
<ClInclude Include="RomList\RomList.h">
|
||||
<Filter>Header Files\Rom List</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Recompiler\RecompilerCodeLog.h">
|
||||
<Filter>Header Files\N64 System\Recompiler</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Recompiler\x86\x86RecompilerOps.h">
|
||||
<Filter>Header Files\N64 System\Recompiler\x86</Filter>
|
||||
</ClInclude>
|
||||
|
|
Loading…
Reference in New Issue