[Project64] Make sure the x86 recompiler code is used just on x86

This commit is contained in:
zilmar 2016-07-07 06:14:12 +10:00
parent 21c0518c4d
commit f09fcc47cd
23 changed files with 232 additions and 79 deletions

View File

@ -44,15 +44,16 @@ LOCAL_SRC_FILES := \
$(SRCDIR)/N64System/Recompiler/x86/x86RecompilerOps.cpp \ $(SRCDIR)/N64System/Recompiler/x86/x86RecompilerOps.cpp \
$(SRCDIR)/N64System/Recompiler/x86/x86ops.cpp \ $(SRCDIR)/N64System/Recompiler/x86/x86ops.cpp \
$(SRCDIR)/N64System/Recompiler/x86/x86RegInfo.cpp \ $(SRCDIR)/N64System/Recompiler/x86/x86RegInfo.cpp \
$(SRCDIR)/N64System/Recompiler/LoopAnalysis.cpp \
$(SRCDIR)/N64System/Recompiler/CodeBlock.cpp \ $(SRCDIR)/N64System/Recompiler/CodeBlock.cpp \
$(SRCDIR)/N64System/Recompiler/CodeSection.cpp \
$(SRCDIR)/N64System/Recompiler/SectionInfo.cpp \ $(SRCDIR)/N64System/Recompiler/SectionInfo.cpp \
$(SRCDIR)/N64System/Recompiler/FunctionInfo.cpp \ $(SRCDIR)/N64System/Recompiler/FunctionInfo.cpp \
$(SRCDIR)/N64System/Recompiler/FunctionMapClass.cpp \ $(SRCDIR)/N64System/Recompiler/FunctionMapClass.cpp \
$(SRCDIR)/N64System/Recompiler/LoopAnalysis.cpp \
$(SRCDIR)/N64System/Recompiler/RecompilerClass.cpp \ $(SRCDIR)/N64System/Recompiler/RecompilerClass.cpp \
$(SRCDIR)/N64System/Recompiler/RecompilerCodeLog.cpp \ $(SRCDIR)/N64System/Recompiler/RecompilerCodeLog.cpp \
$(SRCDIR)/N64System/Recompiler/RecompilerMemory.cpp \ $(SRCDIR)/N64System/Recompiler/RecompilerMemory.cpp \
$(SRCDIR)/N64System/Recompiler/CodeSection.cpp \ $(SRCDIR)/N64System/Recompiler/RegBase.cpp \
$(SRCDIR)/N64System/CheatClass.cpp \ $(SRCDIR)/N64System/CheatClass.cpp \
$(SRCDIR)/N64System/FramePerSecondClass.cpp \ $(SRCDIR)/N64System/FramePerSecondClass.cpp \
$(SRCDIR)/N64System/N64Class.cpp \ $(SRCDIR)/N64System/N64Class.cpp \

View File

@ -38,7 +38,9 @@
* GPR bits[63..0] b1b2b3b4 b5b6b7b8 * GPR bits[63..0] b1b2b3b4 b5b6b7b8
*/ */
#if defined(__i386__) || defined(_M_IX86)
class CX86RecompilerOps; class CX86RecompilerOps;
#endif
class CMipsMemoryVM : class CMipsMemoryVM :
public CTransVaddr, public CTransVaddr,
@ -112,7 +114,9 @@ private:
CMipsMemoryVM(const CMipsMemoryVM&); // Disable copy constructor CMipsMemoryVM(const CMipsMemoryVM&); // Disable copy constructor
CMipsMemoryVM& operator=(const CMipsMemoryVM&); // Disable assignment CMipsMemoryVM& operator=(const CMipsMemoryVM&); // Disable assignment
#if defined(__i386__) || defined(_M_IX86)
friend CX86RecompilerOps; friend CX86RecompilerOps;
#endif
static void RdramChanged(CMipsMemoryVM * _this); static void RdramChanged(CMipsMemoryVM * _this);
static void ChangeSpStatus(); static void ChangeSpStatus();

View File

@ -0,0 +1,23 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
#if defined(__arm__) || defined(_M_ARM)
#include <Project64-core/N64System/Recompiler/RegBase.h>
class CArmRegInfo :
public CRegBase
{
public:
bool operator==(const CArmRegInfo& right) const;
};
#endif

View File

@ -0,0 +1 @@
#include "../stdafx.h"

View File

@ -29,10 +29,9 @@ m_EnterSection(NULL),
m_RecompilerOps(NULL), m_RecompilerOps(NULL),
m_Test(1) m_Test(1)
{ {
memset(m_MemContents, 0, sizeof(m_MemContents)); #if defined(__i386__) || defined(_M_IX86)
memset(m_MemLocation, 0, sizeof(m_MemLocation));
m_RecompilerOps = new CX86RecompilerOps; m_RecompilerOps = new CX86RecompilerOps;
#endif
if (m_RecompilerOps == NULL) if (m_RecompilerOps == NULL)
{ {
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
@ -86,7 +85,9 @@ CCodeBlock::~CCodeBlock()
if (m_RecompilerOps != NULL) if (m_RecompilerOps != NULL)
{ {
#if defined(__i386__) || defined(_M_IX86)
delete (CX86RecompilerOps *)m_RecompilerOps; delete (CX86RecompilerOps *)m_RecompilerOps;
#endif
m_RecompilerOps = NULL; m_RecompilerOps = NULL;
} }
} }

View File

@ -16,7 +16,7 @@
class CCodeBlock class CCodeBlock
{ {
public: public:
CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation ); CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation);
~CCodeBlock(); ~CCodeBlock();
bool Compile(); bool Compile();
@ -25,7 +25,7 @@ public:
uint32_t VAddrFirst() const { return m_VAddrFirst; } uint32_t VAddrFirst() const { return m_VAddrFirst; }
uint32_t VAddrLast() const { return m_VAddrLast; } uint32_t VAddrLast() const { return m_VAddrLast; }
uint8_t * CompiledLocation() const { return m_CompiledLocation; } uint8_t * CompiledLocation() const { return m_CompiledLocation; }
int32_t NoOfSections() const { return m_Sections.size() - 1;} int32_t NoOfSections() const { return (int32_t)m_Sections.size() - 1; }
const CCodeSection & EnterSection() const { return *m_EnterSection; } const CCodeSection & EnterSection() const { return *m_EnterSection; }
const MD5Digest & Hash() const { return m_Hash; } const MD5Digest & Hash() const { return m_Hash; }
CRecompilerOps *& RecompilerOps() { return m_RecompilerOps; } CRecompilerOps *& RecompilerOps() { return m_RecompilerOps; }
@ -47,19 +47,19 @@ private:
bool AnalyseBlock(); bool AnalyseBlock();
bool CreateBlockLinkage ( CCodeSection * EnterSection ); bool CreateBlockLinkage(CCodeSection * EnterSection);
void DetermineLoops (); void DetermineLoops();
void LogSectionInfo (); void LogSectionInfo();
bool SetSection ( CCodeSection * & Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC ); bool SetSection(CCodeSection * & Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC);
bool AnalyzeInstruction ( uint32_t PC, uint32_t & TargetPC, uint32_t & ContinuePC, bool & LikelyBranch, bool & IncludeDelaySlot, bool AnalyzeInstruction(uint32_t PC, uint32_t & TargetPC, uint32_t & ContinuePC, bool & LikelyBranch, bool & IncludeDelaySlot,
bool & EndBlock, bool & PermLoop ); bool & EndBlock, bool & PermLoop);
uint32_t m_VAddrEnter; uint32_t m_VAddrEnter;
uint32_t m_VAddrFirst; // the address of the first opcode in the block uint32_t m_VAddrFirst; // the address of the first opcode in the block
uint32_t m_VAddrLast; // the address of the first opcode in the block uint32_t m_VAddrLast; // the address of the first opcode in the block
uint8_t* m_CompiledLocation; // What address is this compiled at uint8_t* m_CompiledLocation; // What address is this compiled at
typedef std::map<uint32_t,CCodeSection *> SectionMap; typedef std::map<uint32_t, CCodeSection *> SectionMap;
typedef std::list<CCodeSection *> SectionList; typedef std::list<CCodeSection *> SectionList;
SectionMap m_SectionMap; SectionMap m_SectionMap;

View File

@ -11,6 +11,7 @@
#pragma once #pragma once
#include <Project64-core/N64System/Recompiler/RegInfo.h> #include <Project64-core/N64System/Recompiler/RegInfo.h>
#include <Project64-core/N64System/N64Types.h>
struct CExitInfo struct CExitInfo
{ {

View File

@ -188,7 +188,6 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section)
return false; return false;
} }
CPU_Message(" %08X: %s", m_PC, R4300iOpcodeName(m_Command.Hex, m_PC)); CPU_Message(" %08X: %s", m_PC, R4300iOpcodeName(m_Command.Hex, m_PC));
CPU_Message(" %s state: %X value: %X", CRegName::GPR[3], m_Reg.GetMipsRegState(3), m_Reg.GetMipsRegLo(3));
switch (m_Command.op) switch (m_Command.op)
{ {
case R4300i_SPECIAL: case R4300i_SPECIAL:

View File

@ -12,6 +12,7 @@
#include <Project64-core/N64System/Recompiler/RegInfo.h> #include <Project64-core/N64System/Recompiler/RegInfo.h>
#include <Project64-core/N64System/Mips/OpCode.h> #include <Project64-core/N64System/Mips/OpCode.h>
#include <Project64-core/N64System/N64Types.h>
class CCodeSection; class CCodeSection;
class CCodeBlock; class CCodeBlock;

View File

@ -9,10 +9,13 @@
* * * *
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <Project64-core/Settings/RecompilerSettings.h>
#include <Project64-core/N64System/Mips/RegisterClass.h>
#include <Project64-core/N64System/Recompiler/FunctionMapClass.h> #include <Project64-core/N64System/Recompiler/FunctionMapClass.h>
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h> #include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
#include <Project64-core/N64System/ProfilingClass.h> #include <Project64-core/N64System/ProfilingClass.h>
#include <Project64-core/Settings/RecompilerSettings.h>
#include <Project64-core/Settings/DebugSettings.h>
class CRecompiler : class CRecompiler :
protected CDebugSettings, protected CDebugSettings,

View File

@ -0,0 +1,23 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#include "stdafx.h"
#include <Project64-core/N64System/Recompiler/RegBase.h>
CRegBase::CRegBase() :
m_CycleCount(0)
{
m_MIPS_RegState[0] = STATE_CONST_32_SIGN;
for (int32_t i = 1; i < 32; i++)
{
m_MIPS_RegState[i] = STATE_UNKNOWN;
m_MIPS_RegVal[i].DW = 0;
}
}

View File

@ -0,0 +1,76 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
#include <Project64-core/N64System/N64Types.h>
class CRegBase
{
public:
CRegBase();
//enums
enum REG_STATE
{
STATE_UNKNOWN = 0x00,
STATE_KNOWN_VALUE = 0x01,
STATE_X86_MAPPED = 0x02,
STATE_SIGN = 0x04,
STATE_32BIT = 0x08,
STATE_MODIFIED = 0x10,
STATE_MAPPED_64 = (STATE_KNOWN_VALUE | STATE_X86_MAPPED), // = 3
STATE_MAPPED_32_ZERO = (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT), // = 11
STATE_MAPPED_32_SIGN = (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT | STATE_SIGN), // = 15
STATE_CONST_32_ZERO = (STATE_KNOWN_VALUE | STATE_32BIT), // = 9
STATE_CONST_32_SIGN = (STATE_KNOWN_VALUE | STATE_32BIT | STATE_SIGN), // = 13
STATE_CONST_64 = (STATE_KNOWN_VALUE), // = 1
};
void SetMipsRegState(int32_t GetMipsReg, REG_STATE State) { m_MIPS_RegState[GetMipsReg] = State; }
REG_STATE GetMipsRegState(int32_t Reg) const { return m_MIPS_RegState[Reg]; }
bool IsKnown(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_KNOWN_VALUE) != 0); }
bool IsUnknown(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_KNOWN_VALUE) == 0); }
bool IsModified(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_MODIFIED) != 0); }
bool IsMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_X86_MAPPED)); }
bool IsConst(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_X86_MAPPED)) == STATE_KNOWN_VALUE); }
bool IsSigned(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_SIGN)) == (STATE_KNOWN_VALUE | STATE_SIGN)); }
bool IsUnsigned(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_SIGN)) == STATE_KNOWN_VALUE); }
bool Is32Bit(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT)) == (STATE_KNOWN_VALUE | STATE_32BIT)); }
bool Is64Bit(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT)) == STATE_KNOWN_VALUE); }
bool Is32BitMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)); }
bool Is64BitMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_X86_MAPPED)); }
uint64_t GetMipsReg(int32_t Reg) const { return m_MIPS_RegVal[Reg].UDW; }
int64_t GetMipsReg_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].DW; }
uint32_t GetMipsRegLo(int32_t Reg) const { return m_MIPS_RegVal[Reg].UW[0]; }
int32_t GetMipsRegLo_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].W[0]; }
uint32_t GetMipsRegHi(int32_t Reg) const { return m_MIPS_RegVal[Reg].UW[1]; }
int32_t GetMipsRegHi_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].W[1]; }
void SetMipsRegLo(int32_t Reg, uint32_t Value) { m_MIPS_RegVal[Reg].UW[0] = Value; }
void SetMipsRegHi(int32_t Reg, uint32_t Value) { m_MIPS_RegVal[Reg].UW[1] = Value; }
void SetMipsReg(int32_t Reg, uint64_t Value) { m_MIPS_RegVal[Reg].UDW = Value; }
void SetMipsReg_S(int32_t Reg, int64_t Value) { m_MIPS_RegVal[Reg].DW = Value; }
void SetBlockCycleCount(uint32_t CyleCount) { m_CycleCount = CyleCount; }
uint32_t GetBlockCycleCount() const { return m_CycleCount; }
protected:
REG_STATE m_MIPS_RegState[32];
MIPS_DWORD m_MIPS_RegVal[32];
uint32_t m_CycleCount;
};

View File

@ -10,6 +10,21 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#if defined(__i386__) || defined(_M_IX86)
#include <Project64-core/N64System/Recompiler/x86/x86RegInfo.h> #include <Project64-core/N64System/Recompiler/x86/x86RegInfo.h>
typedef CX86RegInfo CRegInfo; typedef CX86RegInfo CRegInfo;
#elif defined(__amd64__) || defined(_M_X64)
#include <Project64-core/N64System/Recompiler/x64-86/x64RegInfo.h>
typedef CX64RegInfo CRegInfo;
#elif defined(__arm__) || defined(_M_ARM)
#include <Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h>
typedef CArmRegInfo CRegInfo;
#endif

View File

@ -0,0 +1 @@
#include "../stdafx.h"

View File

@ -0,0 +1,23 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
#if defined(__amd64__) || defined(_M_X64)
#include <Project64-core/N64System/Recompiler/RegBase.h>
class CX64RegInfo :
public CRegBase
{
public:
bool operator==(const CX64RegInfo& right) const;
};
#endif

View File

@ -9,6 +9,9 @@
* * * *
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#if defined(__i386__) || defined(_M_IX86)
#include <Project64-core/N64System/SystemGlobals.h> #include <Project64-core/N64System/SystemGlobals.h>
#include <Project64-core/N64System/Mips/Disk.h> #include <Project64-core/N64System/Mips/Disk.h>
#include <Project64-core/N64System/Mips/OpcodeName.h> #include <Project64-core/N64System/Mips/OpcodeName.h>
@ -11425,4 +11428,6 @@ void CX86RecompilerOps::ResetMemoryStack()
AddConstToX86Reg(Reg, (uint32_t)g_MMU->Rdram()); AddConstToX86Reg(Reg, (uint32_t)g_MMU->Rdram());
} }
MoveX86regToVariable(Reg, &(g_Recompiler->MemoryStackPos()), "MemoryStack"); MoveX86regToVariable(Reg, &(g_Recompiler->MemoryStackPos()), "MemoryStack");
} }
#endif

View File

@ -9,6 +9,7 @@
* * * *
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#if defined(__i386__) || defined(_M_IX86)
#include <Project64-core/N64System/Mips/RegisterClass.h> #include <Project64-core/N64System/Mips/RegisterClass.h>
#include <Project64-core/N64System/Mips/OpCode.h> #include <Project64-core/N64System/Mips/OpCode.h>
@ -371,3 +372,5 @@ private:
static CCodeSection * m_Section; static CCodeSection * m_Section;
static uint32_t m_TempValue; static uint32_t m_TempValue;
}; };
#endif

View File

@ -9,6 +9,8 @@
* * * *
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#if defined(__i386__) || defined(_M_IX86)
#include <Project64-core/N64System/SystemGlobals.h> #include <Project64-core/N64System/SystemGlobals.h>
#include <Project64-core/N64System/N64Class.h> #include <Project64-core/N64System/N64Class.h>
#include <Project64-core/N64System/Recompiler/RecompilerClass.h> #include <Project64-core/N64System/Recompiler/RecompilerClass.h>
@ -24,20 +26,16 @@ uint32_t CX86RegInfo::m_fpuControl = 0;
const char *Format_Name[] = { "Unknown", "dword", "qword", "float", "double" }; const char *Format_Name[] = { "Unknown", "dword", "qword", "float", "double" };
CX86RegInfo::CX86RegInfo() : CX86RegInfo::CX86RegInfo() :
m_CycleCount(0),
m_Stack_TopPos(0), m_Stack_TopPos(0),
m_Fpu_Used(false), m_Fpu_Used(false),
m_RoundingModel(RoundUnknown) m_RoundingModel(RoundUnknown)
{ {
m_MIPS_RegState[0] = STATE_CONST_32_SIGN;
m_MIPS_RegVal[0].DW = 0; m_MIPS_RegVal[0].DW = 0;
m_RegMapLo[0] = x86_Unknown; m_RegMapLo[0] = x86_Unknown;
m_RegMapHi[0] = x86_Unknown; m_RegMapHi[0] = x86_Unknown;
for (int32_t i = 1; i < 32; i++) for (int32_t i = 1; i < 32; i++)
{ {
m_MIPS_RegState[i] = STATE_UNKNOWN;
m_MIPS_RegVal[i].DW = 0;
m_RegMapLo[i] = x86_Unknown; m_RegMapLo[i] = x86_Unknown;
m_RegMapHi[i] = x86_Unknown; m_RegMapHi[i] = x86_Unknown;
} }
@ -1485,4 +1483,6 @@ const char * CX86RegInfo::RoundingModelName(FPU_ROUND RoundType)
case RoundUp: return "RoundUp"; case RoundUp: return "RoundUp";
} }
return "** Invalid **"; return "** Invalid **";
} }
#endif

View File

@ -9,35 +9,21 @@
* * * *
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <Project64-core/Settings/DebugSettings.h>
#include <Project64-core/N64System/Mips/RegisterClass.h> #if defined(__i386__) || defined(_M_IX86)
#include <Project64-core/N64System/Recompiler/RegBase.h>
#include <Project64-core/N64System/Recompiler/x86/x86ops.h> #include <Project64-core/N64System/Recompiler/x86/x86ops.h>
#include <Project64-core/N64System/Mips/RegisterClass.h>
#include <Project64-core/Settings/DebugSettings.h>
class CX86RegInfo : class CX86RegInfo :
public CRegBase,
private CDebugSettings, private CDebugSettings,
private CX86Ops, private CX86Ops,
private CSystemRegisters private CSystemRegisters
{ {
public: public:
//enums //enums
enum REG_STATE
{
STATE_UNKNOWN = 0x00,
STATE_KNOWN_VALUE = 0x01,
STATE_X86_MAPPED = 0x02,
STATE_SIGN = 0x04,
STATE_32BIT = 0x08,
STATE_MODIFIED = 0x10,
STATE_MAPPED_64 = (STATE_KNOWN_VALUE | STATE_X86_MAPPED), // = 3
STATE_MAPPED_32_ZERO = (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT), // = 11
STATE_MAPPED_32_SIGN = (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT | STATE_SIGN), // = 15
STATE_CONST_32_ZERO = (STATE_KNOWN_VALUE | STATE_32BIT), // = 9
STATE_CONST_32_SIGN = (STATE_KNOWN_VALUE | STATE_32BIT | STATE_SIGN), // = 13
STATE_CONST_64 = (STATE_KNOWN_VALUE), // = 1
};
enum REG_MAPPED enum REG_MAPPED
{ {
NotMapped = 0, NotMapped = 0,
@ -104,29 +90,6 @@ public:
bool UnMap_X86reg(x86Reg Reg); bool UnMap_X86reg(x86Reg Reg);
void WriteBackRegisters(); void WriteBackRegisters();
bool IsKnown(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_KNOWN_VALUE) != 0); }
bool IsUnknown(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_KNOWN_VALUE) == 0); }
bool IsModified(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_MODIFIED) != 0); }
bool IsMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_X86_MAPPED)); }
bool IsConst(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_X86_MAPPED)) == STATE_KNOWN_VALUE); }
bool IsSigned(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_SIGN)) == (STATE_KNOWN_VALUE | STATE_SIGN)); }
bool IsUnsigned(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_SIGN)) == STATE_KNOWN_VALUE); }
bool Is32Bit(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT)) == (STATE_KNOWN_VALUE | STATE_32BIT)); }
bool Is64Bit(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT)) == STATE_KNOWN_VALUE); }
bool Is32BitMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)); }
bool Is64BitMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_X86_MAPPED)); }
REG_STATE GetMipsRegState(int32_t Reg) const { return m_MIPS_RegState[Reg]; }
uint64_t GetMipsReg(int32_t Reg) const { return m_MIPS_RegVal[Reg].UDW; }
int64_t GetMipsReg_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].DW; }
uint32_t GetMipsRegLo(int32_t Reg) const { return m_MIPS_RegVal[Reg].UW[0]; }
int32_t GetMipsRegLo_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].W[0]; }
uint32_t GetMipsRegHi(int32_t Reg) const { return m_MIPS_RegVal[Reg].UW[1]; }
int32_t GetMipsRegHi_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].W[1]; }
CX86Ops::x86Reg GetMipsRegMapLo(int32_t Reg) const { return m_RegMapLo[Reg]; } CX86Ops::x86Reg GetMipsRegMapLo(int32_t Reg) const { return m_RegMapLo[Reg]; }
CX86Ops::x86Reg GetMipsRegMapHi(int32_t Reg) const { return m_RegMapHi[Reg]; } CX86Ops::x86Reg GetMipsRegMapHi(int32_t Reg) const { return m_RegMapHi[Reg]; }
@ -134,22 +97,13 @@ public:
bool GetX86Protected(x86Reg Reg) const { return m_x86reg_Protected[Reg]; } bool GetX86Protected(x86Reg Reg) const { return m_x86reg_Protected[Reg]; }
REG_MAPPED GetX86Mapped(x86Reg Reg) const { return m_x86reg_MappedTo[Reg]; } REG_MAPPED GetX86Mapped(x86Reg Reg) const { return m_x86reg_MappedTo[Reg]; }
uint32_t GetBlockCycleCount() const { return m_CycleCount; }
void SetMipsReg(int32_t Reg, uint64_t Value) { m_MIPS_RegVal[Reg].UDW = Value; }
void SetMipsReg_S(int32_t Reg, int64_t Value) { m_MIPS_RegVal[Reg].DW = Value; }
void SetMipsRegLo(int32_t Reg, uint32_t Value) { m_MIPS_RegVal[Reg].UW[0] = Value; }
void SetMipsRegHi(int32_t Reg, uint32_t Value) { m_MIPS_RegVal[Reg].UW[1] = Value; }
void SetMipsRegMapLo(int32_t GetMipsReg, x86Reg Reg) { m_RegMapLo[GetMipsReg] = Reg; } void SetMipsRegMapLo(int32_t GetMipsReg, x86Reg Reg) { m_RegMapLo[GetMipsReg] = Reg; }
void SetMipsRegMapHi(int32_t GetMipsReg, x86Reg Reg) { m_RegMapHi[GetMipsReg] = Reg; } void SetMipsRegMapHi(int32_t GetMipsReg, x86Reg Reg) { m_RegMapHi[GetMipsReg] = Reg; }
void SetMipsRegState(int32_t GetMipsReg, REG_STATE State) { m_MIPS_RegState[GetMipsReg] = State; }
void SetX86MapOrder(x86Reg Reg, uint32_t Order) { m_x86reg_MapOrder[Reg] = Order; } void SetX86MapOrder(x86Reg Reg, uint32_t Order) { m_x86reg_MapOrder[Reg] = Order; }
void SetX86Protected(x86Reg Reg, bool Protected) { m_x86reg_Protected[Reg] = Protected; } void SetX86Protected(x86Reg Reg, bool Protected) { m_x86reg_Protected[Reg] = Protected; }
void SetX86Mapped(x86Reg Reg, REG_MAPPED Mapping) { m_x86reg_MappedTo[Reg] = Mapping; } void SetX86Mapped(x86Reg Reg, REG_MAPPED Mapping) { m_x86reg_MappedTo[Reg] = Mapping; }
void SetBlockCycleCount(uint32_t CyleCount) { m_CycleCount = CyleCount; }
int32_t & StackTopPos() { return m_Stack_TopPos; } int32_t & StackTopPos() { return m_Stack_TopPos; }
int32_t & FpuMappedTo(int32_t Reg) { return m_x86fpu_MappedTo[Reg]; } int32_t & FpuMappedTo(int32_t Reg) { return m_x86fpu_MappedTo[Reg]; }
FPU_STATE & FpuState(int32_t Reg) { return m_x86fpu_State[Reg]; } FPU_STATE & FpuState(int32_t Reg) { return m_x86fpu_State[Reg]; }
@ -164,8 +118,6 @@ private:
x86Reg UnMap_8BitTempReg(); x86Reg UnMap_8BitTempReg();
//r4k //r4k
REG_STATE m_MIPS_RegState[32];
MIPS_DWORD m_MIPS_RegVal[32];
x86Reg m_RegMapHi[32]; x86Reg m_RegMapHi[32];
x86Reg m_RegMapLo[32]; x86Reg m_RegMapLo[32];
@ -173,8 +125,6 @@ private:
uint32_t m_x86reg_MapOrder[10]; uint32_t m_x86reg_MapOrder[10];
bool m_x86reg_Protected[10]; bool m_x86reg_Protected[10];
uint32_t m_CycleCount;
//FPU //FPU
int32_t m_Stack_TopPos; int32_t m_Stack_TopPos;
int32_t m_x86fpu_MappedTo[8]; int32_t m_x86fpu_MappedTo[8];
@ -187,3 +137,4 @@ private:
static uint32_t m_fpuControl; static uint32_t m_fpuControl;
}; };
#endif

View File

@ -9,6 +9,8 @@
* * * *
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#if defined(__i386__) || defined(_M_IX86)
#include <Project64-core/N64System/SystemGlobals.h> #include <Project64-core/N64System/SystemGlobals.h>
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h> #include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
#include <Project64-core/N64System/Recompiler/x86/x86ops.h> #include <Project64-core/N64System/Recompiler/x86/x86ops.h>
@ -4325,3 +4327,5 @@ void CX86Ops::AddCode32(uint32_t value)
(*((uint32_t *)(*g_RecompPos))=(uint32_t)(value)); (*((uint32_t *)(*g_RecompPos))=(uint32_t)(value));
*g_RecompPos += 4; *g_RecompPos += 4;
} }
#endif

View File

@ -10,6 +10,7 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#if defined(__i386__) || defined(_M_IX86)
class CX86Ops class CX86Ops
{ {
public: public:
@ -304,3 +305,5 @@ private:
}; };
#define AddressOf(Addr) CX86Ops::GetAddressOf(5,(Addr)) #define AddressOf(Addr) CX86Ops::GetAddressOf(5,(Addr))
#endif

View File

@ -74,6 +74,7 @@
<ClCompile Include="N64System\Recompiler\RecompilerClass.cpp" /> <ClCompile Include="N64System\Recompiler\RecompilerClass.cpp" />
<ClCompile Include="N64System\Recompiler\RecompilerCodeLog.cpp" /> <ClCompile Include="N64System\Recompiler\RecompilerCodeLog.cpp" />
<ClCompile Include="N64System\Recompiler\RecompilerMemory.cpp" /> <ClCompile Include="N64System\Recompiler\RecompilerMemory.cpp" />
<ClCompile Include="N64System\Recompiler\RegBase.cpp" />
<ClCompile Include="N64System\Recompiler\SectionInfo.cpp" /> <ClCompile Include="N64System\Recompiler\SectionInfo.cpp" />
<ClCompile Include="N64System\Recompiler\x86\x86ops.cpp" /> <ClCompile Include="N64System\Recompiler\x86\x86ops.cpp" />
<ClCompile Include="N64System\Recompiler\x86\x86RecompilerOps.cpp" /> <ClCompile Include="N64System\Recompiler\x86\x86RecompilerOps.cpp" />
@ -169,8 +170,10 @@
<ClInclude Include="N64System\Recompiler\RecompilerCodeLog.h" /> <ClInclude Include="N64System\Recompiler\RecompilerCodeLog.h" />
<ClInclude Include="N64System\Recompiler\RecompilerMemory.h" /> <ClInclude Include="N64System\Recompiler\RecompilerMemory.h" />
<ClInclude Include="N64System\Recompiler\RecompilerOps.h" /> <ClInclude Include="N64System\Recompiler\RecompilerOps.h" />
<ClInclude Include="N64System\Recompiler\RegBase.h" />
<ClInclude Include="N64System\Recompiler\RegInfo.h" /> <ClInclude Include="N64System\Recompiler\RegInfo.h" />
<ClInclude Include="N64System\Recompiler\SectionInfo.h" /> <ClInclude Include="N64System\Recompiler\SectionInfo.h" />
<ClInclude Include="N64System\Recompiler\x64-86\x64RegInfo.h" />
<ClInclude Include="N64System\Recompiler\X86ops.h" /> <ClInclude Include="N64System\Recompiler\X86ops.h" />
<ClInclude Include="N64System\Recompiler\x86\x86ops.h" /> <ClInclude Include="N64System\Recompiler\x86\x86ops.h" />
<ClInclude Include="N64System\Recompiler\x86\x86RecompilerOps.h" /> <ClInclude Include="N64System\Recompiler\x86\x86RecompilerOps.h" />

View File

@ -85,6 +85,9 @@
<Filter Include="Header Files\N64 System\Recompiler\x86"> <Filter Include="Header Files\N64 System\Recompiler\x86">
<UniqueIdentifier>{b6d9fd3a-e8e5-42a2-8bcc-8fa430dd8aaa}</UniqueIdentifier> <UniqueIdentifier>{b6d9fd3a-e8e5-42a2-8bcc-8fa430dd8aaa}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\N64 System\Recompiler\x64-86">
<UniqueIdentifier>{4a163a31-b1fb-4e50-b229-45d508dfc4a2}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
@ -324,6 +327,9 @@
<ClCompile Include="N64System\Recompiler\x86\x86RegInfo.cpp"> <ClCompile Include="N64System\Recompiler\x86\x86RegInfo.cpp">
<Filter>Source Files\N64 System\Recompiler\x86</Filter> <Filter>Source Files\N64 System\Recompiler\x86</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="N64System\Recompiler\RegBase.cpp">
<Filter>Source Files\N64 System\Recompiler</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="stdafx.h"> <ClInclude Include="stdafx.h">
@ -626,5 +632,11 @@
<ClInclude Include="N64System\Recompiler\x86\x86RegInfo.h"> <ClInclude Include="N64System\Recompiler\x86\x86RegInfo.h">
<Filter>Header Files\N64 System\Recompiler\x86</Filter> <Filter>Header Files\N64 System\Recompiler\x86</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="N64System\Recompiler\x64-86\x64RegInfo.h">
<Filter>Source Files\N64 System\Recompiler\x64-86</Filter>
</ClInclude>
<ClInclude Include="N64System\Recompiler\RegBase.h">
<Filter>Header Files\N64 System\Recompiler</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>