diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp index 04c8df9d68..3aba8662fd 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp @@ -104,7 +104,6 @@ void Interpreter::RunTable63(UGeckoInstruction inst) void Interpreter::Init() { InitializeInstructionTables(); - m_reserve = false; m_end_block = false; } diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h index 9c9609f0f6..2f7d5906d9 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h @@ -298,9 +298,4 @@ private: UGeckoInstruction m_prev_inst{}; static bool m_end_block; - - // TODO: These should really be in the save state, although it's unlikely to matter much. - // They are for lwarx and its friend stwcxd. - static bool m_reserve; - static u32 m_reserve_address; }; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp index c4e7e8de3d..af2ac6eb30 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -15,9 +15,6 @@ #include "Core/PowerPC/MMU.h" #include "Core/PowerPC/PowerPC.h" -bool Interpreter::m_reserve; -u32 Interpreter::m_reserve_address; - static u32 Helper_Get_EA(const PowerPC::PowerPCState& ppcs, const UGeckoInstruction inst) { return inst.RA ? (ppcs.gpr[inst.RA] + inst.SIMM_16) : (u32)inst.SIMM_16; @@ -992,8 +989,8 @@ void Interpreter::lwarx(UGeckoInstruction inst) if (!(PowerPC::ppcState.Exceptions & EXCEPTION_DSI)) { rGPR[inst.RD] = temp; - m_reserve = true; - m_reserve_address = address; + PowerPC::ppcState.reserve = true; + PowerPC::ppcState.reserve_address = address; } } @@ -1008,14 +1005,14 @@ void Interpreter::stwcxd(UGeckoInstruction inst) return; } - if (m_reserve) + if (PowerPC::ppcState.reserve) { - if (address == m_reserve_address) + if (address == PowerPC::ppcState.reserve_address) { PowerPC::Write_U32(rGPR[inst.RS], address); if (!(PowerPC::ppcState.Exceptions & EXCEPTION_DSI)) { - m_reserve = false; + PowerPC::ppcState.reserve = false; PowerPC::ppcState.cr.SetField(0, 2 | PowerPC::GetXER_SO()); return; } diff --git a/Source/Core/Core/PowerPC/PowerPC.cpp b/Source/Core/Core/PowerPC/PowerPC.cpp index 8c62dceec2..2bc74c031f 100644 --- a/Source/Core/Core/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/PowerPC/PowerPC.cpp @@ -175,6 +175,10 @@ static void ResetRegisters() ppcState.pc = 0; ppcState.npc = 0; ppcState.Exceptions = 0; + + ppcState.reserve = false; + ppcState.reserve_address = 0; + for (auto& v : ppcState.cr.fields) { v = 0x8000000000000001; diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index 36b2ac6fc9..9586bbe3ab 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -167,6 +167,11 @@ struct PowerPCState InstructionCache iCache; + // TODO: These should really be in the save state, although it's unlikely to matter much. + // They are for lwarx and its friend stwcxd. + bool reserve; + u32 reserve_address; + void UpdateCR1() { cr.SetField(1, (fpscr.FX << 3) | (fpscr.FEX << 2) | (fpscr.VX << 1) | fpscr.OX);