From 8713878994fbcffcb31831324b72593abd489c72 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 24 Oct 2022 12:13:48 +1030 Subject: [PATCH] Core: Change order of MoveX86regToX86Pointer parameters --- .../N64System/Recompiler/CodeBlock.h | 8 +++--- .../Recompiler/x86/x86RecompilerOps.cpp | 26 +++++++++---------- .../N64System/Recompiler/x86/x86ops.cpp | 6 ++--- .../N64System/Recompiler/x86/x86ops.h | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Source/Project64-core/N64System/Recompiler/CodeBlock.h b/Source/Project64-core/N64System/Recompiler/CodeBlock.h index e97fc3bb9..2f0bfe81f 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeBlock.h +++ b/Source/Project64-core/N64System/Recompiler/CodeBlock.h @@ -103,10 +103,10 @@ private: 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? - uint8_t * m_CompiledLocationEnd; // What address is this compiled at? + uint32_t m_VAddrFirst; + uint32_t m_VAddrLast; + uint8_t * m_CompiledLocation; + uint8_t * m_CompiledLocationEnd; typedef std::map SectionMap; typedef std::list SectionList; diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 778a82a2f..bfbd3a923 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -3906,7 +3906,7 @@ void CX86RecompilerOps::LWC1() CX86Ops::x86Reg TempReg2 = Map_TempReg(CX86Ops::x86_Unknown, -1, false, false); m_Assembler.MoveVariableToX86reg(&_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str(), TempReg2); - m_Assembler.MoveX86regToX86Pointer(TempReg1, TempReg2); + m_Assembler.MoveX86regToX86Pointer(TempReg2, TempReg1); return; } PreReadInstruction(); @@ -3914,7 +3914,7 @@ void CX86RecompilerOps::LWC1() CompileLoadMemoryValue(CX86Ops::x86_Unknown, ValueReg, CX86Ops::x86_Unknown, 32, false); CX86Ops::x86Reg FPR_SPtr = Map_TempReg(CX86Ops::x86_Unknown, -1, false, false); m_Assembler.MoveVariableToX86reg(&_FPR_S[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str(), FPR_SPtr); - m_Assembler.MoveX86regToX86Pointer(ValueReg, FPR_SPtr); + m_Assembler.MoveX86regToX86Pointer(FPR_SPtr, ValueReg); } void CX86RecompilerOps::LDC1() @@ -3936,11 +3936,11 @@ void CX86RecompilerOps::LDC1() CX86Ops::x86Reg TempReg2 = Map_TempReg(CX86Ops::x86_Unknown, -1, false, false); m_Assembler.MoveVariableToX86reg(&_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str(), TempReg2); m_Assembler.AddConstToX86Reg(TempReg2, 4); - m_Assembler.MoveX86regToX86Pointer(TempReg1, TempReg2); + m_Assembler.MoveX86regToX86Pointer(TempReg2, TempReg1); LW_KnownAddress(TempReg1, Address + 4); m_Assembler.MoveVariableToX86reg(&_FPR_D[m_Opcode.ft], stdstr_f("_FPR_S[%d]", m_Opcode.ft).c_str(), TempReg2); - m_Assembler.MoveX86regToX86Pointer(TempReg1, TempReg2); + m_Assembler.MoveX86regToX86Pointer(TempReg2, TempReg1); } else { @@ -3952,9 +3952,9 @@ void CX86RecompilerOps::LDC1() CX86Ops::x86Reg FPR_DPtr = Map_TempReg(CX86Ops::x86_Unknown, -1, false, false); m_Assembler.MoveVariableToX86reg(&_FPR_D[m_Opcode.ft], stdstr_f("_FPR_D[%d]", m_Opcode.ft).c_str(), FPR_DPtr); - m_Assembler.MoveX86regToX86Pointer(ValueRegLo, FPR_DPtr); + m_Assembler.MoveX86regToX86Pointer(FPR_DPtr, ValueRegLo); m_Assembler.AddConstToX86Reg(FPR_DPtr, 4); - m_Assembler.MoveX86regToX86Pointer(ValueRegHi, FPR_DPtr); + m_Assembler.MoveX86regToX86Pointer(FPR_DPtr, ValueRegHi); } } @@ -7500,11 +7500,11 @@ void CX86RecompilerOps::COP1_MT() } else if (IsMapped(m_Opcode.rt)) { - m_Assembler.MoveX86regToX86Pointer(GetMipsRegMapLo(m_Opcode.rt), TempReg); + m_Assembler.MoveX86regToX86Pointer(TempReg, GetMipsRegMapLo(m_Opcode.rt)); } else { - m_Assembler.MoveX86regToX86Pointer(Map_TempReg(CX86Ops::x86_Unknown, m_Opcode.rt, false, false), TempReg); + m_Assembler.MoveX86regToX86Pointer(TempReg, Map_TempReg(CX86Ops::x86_Unknown, m_Opcode.rt, false, false)); } } @@ -7538,23 +7538,23 @@ void CX86RecompilerOps::COP1_DMT() } else if (IsMapped(m_Opcode.rt)) { - m_Assembler.MoveX86regToX86Pointer(GetMipsRegMapLo(m_Opcode.rt), TempReg); + m_Assembler.MoveX86regToX86Pointer(TempReg, GetMipsRegMapLo(m_Opcode.rt)); m_Assembler.AddConstToX86Reg(TempReg, 4); if (Is64Bit(m_Opcode.rt)) { - m_Assembler.MoveX86regToX86Pointer(GetMipsRegMapHi(m_Opcode.rt), TempReg); + m_Assembler.MoveX86regToX86Pointer(TempReg, GetMipsRegMapHi(m_Opcode.rt)); } else { - m_Assembler.MoveX86regToX86Pointer(Map_TempReg(CX86Ops::x86_Unknown, m_Opcode.rt, true, false), TempReg); + m_Assembler.MoveX86regToX86Pointer(TempReg, Map_TempReg(CX86Ops::x86_Unknown, m_Opcode.rt, true, false)); } } else { CX86Ops::x86Reg Reg = Map_TempReg(CX86Ops::x86_Unknown, m_Opcode.rt, false, false); - m_Assembler.MoveX86regToX86Pointer(Reg, TempReg); + m_Assembler.MoveX86regToX86Pointer(TempReg, Reg); m_Assembler.AddConstToX86Reg(TempReg, 4); - m_Assembler.MoveX86regToX86Pointer(Map_TempReg(Reg, m_Opcode.rt, true, false), TempReg); + m_Assembler.MoveX86regToX86Pointer(TempReg, Map_TempReg(Reg, m_Opcode.rt, true, false)); } } diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp index 368ee417f..d2ec462ea 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp @@ -2004,11 +2004,11 @@ void CX86Ops::MoveX86RegToX86Reg(x86Reg Source, x86Reg Destination) AddCode16(x86Command); } -void CX86Ops::MoveX86regToX86Pointer(x86Reg reg, x86Reg X86Pointer) +void CX86Ops::MoveX86regToX86Pointer(x86Reg X86Pointer, x86Reg Reg) { uint16_t x86Command = 0; - CodeLog(" mov dword ptr [%s], %s", x86_Name(X86Pointer), x86_Name(reg)); + CodeLog(" mov dword ptr [%s], %s", x86_Name(X86Pointer), x86_Name(Reg)); switch (X86Pointer) { @@ -2022,7 +2022,7 @@ void CX86Ops::MoveX86regToX86Pointer(x86Reg reg, x86Reg X86Pointer) g_Notify->BreakPoint(__FILE__, __LINE__); } - switch (reg) + switch (Reg) { case x86_EAX: x86Command += 0x0000; break; case x86_EBX: x86Command += 0x1800; break; diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h index 5793cef2a..5e1cd4d23 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h @@ -171,7 +171,7 @@ public: 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 MoveX86regToX86Pointer(x86Reg X86Pointer, x86Reg Reg); void MoveX86regToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2); void MoveZxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg); void MoveZxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);