Core: handle better CX86RecompilerOps::ResetMemoryStack

This commit is contained in:
zilmar 2022-10-28 16:41:24 +10:30
parent edeaf14471
commit 94247ce1a6
1 changed files with 8 additions and 26 deletions

View File

@ -7298,7 +7298,7 @@ void CX86RecompilerOps::COP0_DMF()
void CX86RecompilerOps::COP0_MT() void CX86RecompilerOps::COP0_MT()
{ {
if (m_Opcode.rd == 6) if (m_Opcode.rd == 6 || m_Opcode.rd == 11)
{ {
UpdateCounters(m_RegWorkingSet, false, true); UpdateCounters(m_RegWorkingSet, false, true);
} }
@ -11225,37 +11225,19 @@ void CX86RecompilerOps::SW_Register(CX86Ops::x86Reg Reg, uint32_t VAddr)
void CX86RecompilerOps::ResetMemoryStack() void CX86RecompilerOps::ResetMemoryStack()
{ {
CX86Ops::x86Reg Reg, TempReg;
int32_t MipsReg = 29; int32_t MipsReg = 29;
m_CodeBlock.Log(" ResetMemoryStack"); if (IsConst(MipsReg))
Reg = Get_MemoryStack();
if (Reg == CX86Ops::x86_Unknown)
{ {
Reg = Map_TempReg(CX86Ops::x86_Unknown, MipsReg, false, false); m_Assembler.MoveConstToVariable(GetMipsRegLo(MipsReg), &_GPR[MipsReg].UW[0], CRegName::GPR_Lo[MipsReg]);
}
else
{
if (IsUnknown(MipsReg))
{
m_Assembler.MoveVariableToX86reg(Reg, &_GPR[MipsReg].UW[0], CRegName::GPR_Lo[MipsReg]);
} }
else if (IsMapped(MipsReg)) else if (IsMapped(MipsReg))
{ {
m_Assembler.MoveX86RegToX86Reg(GetMipsRegMapLo(MipsReg), Reg); m_Assembler.MoveX86regToVariable(GetMipsRegMapLo(MipsReg), &_GPR[MipsReg].UW[0], CRegName::GPR_Lo[MipsReg]);
}
else
{
m_Assembler.MoveConstToX86reg(Reg, GetMipsRegLo(MipsReg));
}
} }
TempReg = Map_TempReg(CX86Ops::x86_Unknown, -1, false, false); m_RegWorkingSet.BeforeCallDirect();
m_Assembler.MoveX86RegToX86Reg(Reg, TempReg); m_Assembler.CallThis((uint32_t)g_Recompiler, AddressOf(&CRecompiler::ResetMemoryStackPos), "CRecompiler::ResetMemoryStackPos", 4);
m_Assembler.ShiftRightUnsignImmed(TempReg, 12); m_RegWorkingSet.AfterCallDirect();
m_Assembler.MoveVariableDispToX86Reg(g_MMU->m_MemoryReadMap, "MMU->m_MemoryReadMap", TempReg, TempReg, 4);
m_Assembler.AddX86RegToX86Reg(Reg, TempReg);
m_Assembler.MoveX86regToVariable(Reg, &(g_Recompiler->MemoryStackPos()), "MemoryStack");
} }
#endif #endif