diff --git a/Android/jni/Project64-core/Project64-core.mk b/Android/jni/Project64-core/Project64-core.mk index 358a31666..058eb83d1 100644 --- a/Android/jni/Project64-core/Project64-core.mk +++ b/Android/jni/Project64-core/Project64-core.mk @@ -44,15 +44,16 @@ LOCAL_SRC_FILES := \ $(SRCDIR)/N64System/Recompiler/x86/x86RecompilerOps.cpp \ $(SRCDIR)/N64System/Recompiler/x86/x86ops.cpp \ $(SRCDIR)/N64System/Recompiler/x86/x86RegInfo.cpp \ - $(SRCDIR)/N64System/Recompiler/LoopAnalysis.cpp \ $(SRCDIR)/N64System/Recompiler/CodeBlock.cpp \ + $(SRCDIR)/N64System/Recompiler/CodeSection.cpp \ $(SRCDIR)/N64System/Recompiler/SectionInfo.cpp \ $(SRCDIR)/N64System/Recompiler/FunctionInfo.cpp \ $(SRCDIR)/N64System/Recompiler/FunctionMapClass.cpp \ + $(SRCDIR)/N64System/Recompiler/LoopAnalysis.cpp \ $(SRCDIR)/N64System/Recompiler/RecompilerClass.cpp \ $(SRCDIR)/N64System/Recompiler/RecompilerCodeLog.cpp \ $(SRCDIR)/N64System/Recompiler/RecompilerMemory.cpp \ - $(SRCDIR)/N64System/Recompiler/CodeSection.cpp \ + $(SRCDIR)/N64System/Recompiler/RegBase.cpp \ $(SRCDIR)/N64System/CheatClass.cpp \ $(SRCDIR)/N64System/FramePerSecondClass.cpp \ $(SRCDIR)/N64System/N64Class.cpp \ diff --git a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.h b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.h index 48bdbf580..dc6da1fa1 100644 --- a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.h +++ b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.h @@ -38,7 +38,9 @@ * GPR bits[63..0] b1b2b3b4 b5b6b7b8 */ +#if defined(__i386__) || defined(_M_IX86) class CX86RecompilerOps; +#endif class CMipsMemoryVM : public CTransVaddr, @@ -112,7 +114,9 @@ private: CMipsMemoryVM(const CMipsMemoryVM&); // Disable copy constructor CMipsMemoryVM& operator=(const CMipsMemoryVM&); // Disable assignment +#if defined(__i386__) || defined(_M_IX86) friend CX86RecompilerOps; +#endif static void RdramChanged(CMipsMemoryVM * _this); static void ChangeSpStatus(); diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h new file mode 100644 index 000000000..08a4f09e4 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h @@ -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 + +class CArmRegInfo : + public CRegBase +{ +public: + bool operator==(const CArmRegInfo& right) const; +}; + +#endif diff --git a/Source/Project64-core/N64System/Recompiler/Arm/stdafx.h b/Source/Project64-core/N64System/Recompiler/Arm/stdafx.h new file mode 100644 index 000000000..8b696d0b1 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/Arm/stdafx.h @@ -0,0 +1 @@ +#include "../stdafx.h" diff --git a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp index 863bfac66..ccc030030 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp @@ -29,10 +29,9 @@ m_EnterSection(NULL), m_RecompilerOps(NULL), m_Test(1) { - memset(m_MemContents, 0, sizeof(m_MemContents)); - memset(m_MemLocation, 0, sizeof(m_MemLocation)); - +#if defined(__i386__) || defined(_M_IX86) m_RecompilerOps = new CX86RecompilerOps; +#endif if (m_RecompilerOps == NULL) { g_Notify->BreakPoint(__FILE__, __LINE__); @@ -86,7 +85,9 @@ CCodeBlock::~CCodeBlock() if (m_RecompilerOps != NULL) { +#if defined(__i386__) || defined(_M_IX86) delete (CX86RecompilerOps *)m_RecompilerOps; +#endif m_RecompilerOps = NULL; } } diff --git a/Source/Project64-core/N64System/Recompiler/CodeBlock.h b/Source/Project64-core/N64System/Recompiler/CodeBlock.h index 3c2ca75f0..bf1f8215a 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeBlock.h +++ b/Source/Project64-core/N64System/Recompiler/CodeBlock.h @@ -16,7 +16,7 @@ class CCodeBlock { public: - CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation ); + CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation); ~CCodeBlock(); bool Compile(); @@ -25,7 +25,7 @@ public: uint32_t VAddrFirst() const { return m_VAddrFirst; } uint32_t VAddrLast() const { return m_VAddrLast; } 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 MD5Digest & Hash() const { return m_Hash; } CRecompilerOps *& RecompilerOps() { return m_RecompilerOps; } @@ -47,19 +47,19 @@ private: bool AnalyseBlock(); - bool CreateBlockLinkage ( CCodeSection * EnterSection ); - void DetermineLoops (); - void LogSectionInfo (); - 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 & EndBlock, bool & PermLoop ); + bool CreateBlockLinkage(CCodeSection * EnterSection); + void DetermineLoops(); + void LogSectionInfo(); + 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 & EndBlock, bool & PermLoop); uint32_t m_VAddrEnter; 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 uint8_t* m_CompiledLocation; // What address is this compiled at - typedef std::map SectionMap; + typedef std::map SectionMap; typedef std::list SectionList; SectionMap m_SectionMap; diff --git a/Source/Project64-core/N64System/Recompiler/ExitInfo.h b/Source/Project64-core/N64System/Recompiler/ExitInfo.h index c74e4b6a6..35d72d340 100644 --- a/Source/Project64-core/N64System/Recompiler/ExitInfo.h +++ b/Source/Project64-core/N64System/Recompiler/ExitInfo.h @@ -11,6 +11,7 @@ #pragma once #include +#include struct CExitInfo { diff --git a/Source/Project64-core/N64System/Recompiler/LoopAnalysis.cpp b/Source/Project64-core/N64System/Recompiler/LoopAnalysis.cpp index f32c48a6f..6378b0e8a 100644 --- a/Source/Project64-core/N64System/Recompiler/LoopAnalysis.cpp +++ b/Source/Project64-core/N64System/Recompiler/LoopAnalysis.cpp @@ -188,7 +188,6 @@ bool LoopAnalysis::CheckLoopRegisterUsage(CCodeSection * Section) return false; } 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) { case R4300i_SPECIAL: diff --git a/Source/Project64-core/N64System/Recompiler/LoopAnalysis.h b/Source/Project64-core/N64System/Recompiler/LoopAnalysis.h index b4de7b6a5..09fbe947d 100644 --- a/Source/Project64-core/N64System/Recompiler/LoopAnalysis.h +++ b/Source/Project64-core/N64System/Recompiler/LoopAnalysis.h @@ -12,6 +12,7 @@ #include #include +#include class CCodeSection; class CCodeBlock; diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerClass.h b/Source/Project64-core/N64System/Recompiler/RecompilerClass.h index 2a52c6c70..b5cd58897 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerClass.h +++ b/Source/Project64-core/N64System/Recompiler/RecompilerClass.h @@ -9,10 +9,13 @@ * * ****************************************************************************/ #pragma once -#include + +#include #include #include #include +#include +#include class CRecompiler : protected CDebugSettings, diff --git a/Source/Project64-core/N64System/Recompiler/RegBase.cpp b/Source/Project64-core/N64System/Recompiler/RegBase.cpp new file mode 100644 index 000000000..3ca98b769 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/RegBase.cpp @@ -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 + +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; + } +} \ No newline at end of file diff --git a/Source/Project64-core/N64System/Recompiler/RegBase.h b/Source/Project64-core/N64System/Recompiler/RegBase.h new file mode 100644 index 000000000..e5b14209f --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/RegBase.h @@ -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 + +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; +}; diff --git a/Source/Project64-core/N64System/Recompiler/RegInfo.h b/Source/Project64-core/N64System/Recompiler/RegInfo.h index df509c836..d8e7690e9 100644 --- a/Source/Project64-core/N64System/Recompiler/RegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/RegInfo.h @@ -10,6 +10,21 @@ ****************************************************************************/ #pragma once +#if defined(__i386__) || defined(_M_IX86) #include -typedef CX86RegInfo CRegInfo; \ No newline at end of file +typedef CX86RegInfo CRegInfo; + +#elif defined(__amd64__) || defined(_M_X64) + +#include + +typedef CX64RegInfo CRegInfo; + +#elif defined(__arm__) || defined(_M_ARM) + +#include + +typedef CArmRegInfo CRegInfo; + +#endif diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/stdafx.h b/Source/Project64-core/N64System/Recompiler/x64-86/stdafx.h new file mode 100644 index 000000000..8b696d0b1 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/x64-86/stdafx.h @@ -0,0 +1 @@ +#include "../stdafx.h" diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.h b/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.h new file mode 100644 index 000000000..f1a25b7b0 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.h @@ -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 + +class CX64RegInfo : + public CRegBase +{ +public: + bool operator==(const CX64RegInfo& right) const; +}; + +#endif diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 0ea89722a..92ef7f5f2 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -9,6 +9,9 @@ * * ****************************************************************************/ #include "stdafx.h" + +#if defined(__i386__) || defined(_M_IX86) + #include #include #include @@ -11425,4 +11428,6 @@ void CX86RecompilerOps::ResetMemoryStack() AddConstToX86Reg(Reg, (uint32_t)g_MMU->Rdram()); } MoveX86regToVariable(Reg, &(g_Recompiler->MemoryStackPos()), "MemoryStack"); -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h index dca56ff34..5a708a324 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h @@ -9,6 +9,7 @@ * * ****************************************************************************/ #pragma once +#if defined(__i386__) || defined(_M_IX86) #include #include @@ -371,3 +372,5 @@ private: static CCodeSection * m_Section; static uint32_t m_TempValue; }; + +#endif diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp index 2dac6539a..8748c4a4f 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.cpp @@ -9,6 +9,8 @@ * * ****************************************************************************/ #include "stdafx.h" + +#if defined(__i386__) || defined(_M_IX86) #include #include #include @@ -24,20 +26,16 @@ uint32_t CX86RegInfo::m_fpuControl = 0; const char *Format_Name[] = { "Unknown", "dword", "qword", "float", "double" }; CX86RegInfo::CX86RegInfo() : - m_CycleCount(0), m_Stack_TopPos(0), m_Fpu_Used(false), m_RoundingModel(RoundUnknown) { - m_MIPS_RegState[0] = STATE_CONST_32_SIGN; m_MIPS_RegVal[0].DW = 0; m_RegMapLo[0] = x86_Unknown; m_RegMapHi[0] = x86_Unknown; 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_RegMapHi[i] = x86_Unknown; } @@ -1485,4 +1483,6 @@ const char * CX86RegInfo::RoundingModelName(FPU_ROUND RoundType) case RoundUp: return "RoundUp"; } return "** Invalid **"; -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h index bdfb63541..13ccca05f 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h @@ -9,35 +9,21 @@ * * ****************************************************************************/ #pragma once -#include -#include + +#if defined(__i386__) || defined(_M_IX86) +#include #include +#include +#include class CX86RegInfo : + public CRegBase, private CDebugSettings, private CX86Ops, private CSystemRegisters { public: //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 { NotMapped = 0, @@ -104,29 +90,6 @@ public: bool UnMap_X86reg(x86Reg Reg); 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 GetMipsRegMapHi(int32_t Reg) const { return m_RegMapHi[Reg]; } @@ -134,22 +97,13 @@ public: bool GetX86Protected(x86Reg Reg) const { return m_x86reg_Protected[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 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 SetX86Protected(x86Reg Reg, bool Protected) { m_x86reg_Protected[Reg] = Protected; } 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 & FpuMappedTo(int32_t Reg) { return m_x86fpu_MappedTo[Reg]; } FPU_STATE & FpuState(int32_t Reg) { return m_x86fpu_State[Reg]; } @@ -164,8 +118,6 @@ private: x86Reg UnMap_8BitTempReg(); //r4k - REG_STATE m_MIPS_RegState[32]; - MIPS_DWORD m_MIPS_RegVal[32]; x86Reg m_RegMapHi[32]; x86Reg m_RegMapLo[32]; @@ -173,8 +125,6 @@ private: uint32_t m_x86reg_MapOrder[10]; bool m_x86reg_Protected[10]; - uint32_t m_CycleCount; - //FPU int32_t m_Stack_TopPos; int32_t m_x86fpu_MappedTo[8]; @@ -187,3 +137,4 @@ private: static uint32_t m_fpuControl; }; +#endif diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp index 69ac1cc75..b3230c250 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp @@ -9,6 +9,8 @@ * * ****************************************************************************/ #include "stdafx.h" + +#if defined(__i386__) || defined(_M_IX86) #include #include #include @@ -4325,3 +4327,5 @@ void CX86Ops::AddCode32(uint32_t value) (*((uint32_t *)(*g_RecompPos))=(uint32_t)(value)); *g_RecompPos += 4; } + +#endif diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h index eee933d65..8e0a16f42 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h @@ -10,6 +10,7 @@ ****************************************************************************/ #pragma once +#if defined(__i386__) || defined(_M_IX86) class CX86Ops { public: @@ -304,3 +305,5 @@ private: }; #define AddressOf(Addr) CX86Ops::GetAddressOf(5,(Addr)) + +#endif diff --git a/Source/Project64-core/Project64-core.vcxproj b/Source/Project64-core/Project64-core.vcxproj index 4c20d25a2..38cf1afbf 100644 --- a/Source/Project64-core/Project64-core.vcxproj +++ b/Source/Project64-core/Project64-core.vcxproj @@ -74,6 +74,7 @@ + @@ -169,8 +170,10 @@ + + diff --git a/Source/Project64-core/Project64-core.vcxproj.filters b/Source/Project64-core/Project64-core.vcxproj.filters index 1c4d46c57..90aa2d4d8 100644 --- a/Source/Project64-core/Project64-core.vcxproj.filters +++ b/Source/Project64-core/Project64-core.vcxproj.filters @@ -85,6 +85,9 @@ {b6d9fd3a-e8e5-42a2-8bcc-8fa430dd8aaa} + + {4a163a31-b1fb-4e50-b229-45d508dfc4a2} + @@ -324,6 +327,9 @@ Source Files\N64 System\Recompiler\x86 + + Source Files\N64 System\Recompiler + @@ -626,5 +632,11 @@ Header Files\N64 System\Recompiler\x86 + + Source Files\N64 System\Recompiler\x64-86 + + + Header Files\N64 System\Recompiler + \ No newline at end of file