HW/CPU: Avoid ppcState global.

This commit is contained in:
Admiral H. Curtiss 2023-01-10 06:45:13 +01:00
parent 078a460446
commit 18d9ec75f1
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 4 additions and 2 deletions

View File

@ -88,6 +88,8 @@ static void ExecutePendingJobs(std::unique_lock<std::mutex>& state_lock)
void Run()
{
auto& system = Core::System::GetInstance();
// Updating the host CPU's rounding mode must be done on the CPU thread.
// We can't rely on PowerPC::Init doing it, since it's called from EmuThread.
PowerPC::RoundingModeUpdated();
@ -111,7 +113,7 @@ void Run()
// If watchpoints are enabled, any instruction could be a breakpoint.
if (PowerPC::GetMode() != PowerPC::CoreMode::Interpreter)
{
if (PowerPC::breakpoints.IsAddressBreakPoint(PowerPC::ppcState.pc) ||
if (PowerPC::breakpoints.IsAddressBreakPoint(system.GetPPCState().pc) ||
PowerPC::memchecks.HasAny())
{
s_state = State::Stepping;

View File

@ -69,7 +69,7 @@ const State* GetStatePtr();
// Locks the CPU Thread (waiting for it to become idle).
// While this lock is held, the CPU Thread will not perform any action so it is safe to access
// PowerPC::ppcState, CoreTiming, etc. without racing the CPU Thread.
// PowerPC, CoreTiming, etc. without racing the CPU Thread.
// Cannot be used recursively. Must be paired as PauseAndLock(true)/PauseAndLock(false).
// Return value for do_lock == true is whether the state was State::Running or not.
// Return value for do_lock == false is whether the state was changed *to* State::Running or not.