74 changes: 35 additions & 39 deletions Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
Expand Up @@ -23,13 +23,13 @@ enum class RoundingMode
TowardsNegativeInfinity = 0b11
};

void SetFI(UReg_FPSCR* fpscr, u32 FI)
void SetFI(PowerPC::PowerPCState& ppc_state, u32 FI)
{
if (FI != 0)
{
SetFPException(fpscr, FPSCR_XX);
SetFPException(ppc_state, FPSCR_XX);
}
fpscr->FI = FI;
ppc_state.fpscr.FI = FI;
}

// Note that the convert to integer operation is defined
Expand All @@ -45,24 +45,24 @@ void ConvertToInteger(PowerPC::PowerPCState& ppc_state, UGeckoInstruction inst,
if (std::isnan(b))
{
if (Common::IsSNAN(b))
SetFPException(&ppc_state.fpscr, FPSCR_VXSNAN);
SetFPException(ppc_state, FPSCR_VXSNAN);

value = 0x80000000;
SetFPException(&ppc_state.fpscr, FPSCR_VXCVI);
SetFPException(ppc_state, FPSCR_VXCVI);
exception_occurred = true;
}
else if (b > static_cast<double>(0x7fffffff))
{
// Positive large operand or +inf
value = 0x7fffffff;
SetFPException(&ppc_state.fpscr, FPSCR_VXCVI);
SetFPException(ppc_state, FPSCR_VXCVI);
exception_occurred = true;
}
else if (b < -static_cast<double>(0x80000000))
{
// Negative large operand or -inf
value = 0x80000000;
SetFPException(&ppc_state.fpscr, FPSCR_VXCVI);
SetFPException(ppc_state, FPSCR_VXCVI);
exception_occurred = true;
}
else
Expand Down Expand Up @@ -109,7 +109,7 @@ void ConvertToInteger(PowerPC::PowerPCState& ppc_state, UGeckoInstruction inst,
else
{
// Also sets FPSCR[XX]
SetFI(&ppc_state.fpscr, 1);
SetFI(ppc_state, 1);
ppc_state.fpscr.FR = fabs(di) > fabs(b);
}
}
Expand Down Expand Up @@ -145,15 +145,15 @@ void Interpreter::Helper_FloatCompareOrdered(PowerPC::PowerPCState& ppc_state,
compare_result = FPCC::FU;
if (Common::IsSNAN(fa) || Common::IsSNAN(fb))
{
SetFPException(&ppc_state.fpscr, FPSCR_VXSNAN);
SetFPException(ppc_state, FPSCR_VXSNAN);
if (ppc_state.fpscr.VE == 0)
{
SetFPException(&ppc_state.fpscr, FPSCR_VXVC);
SetFPException(ppc_state, FPSCR_VXVC);
}
}
else // QNaN
{
SetFPException(&ppc_state.fpscr, FPSCR_VXVC);
SetFPException(ppc_state, FPSCR_VXVC);
}
}
else if (fa < fb)
Expand Down Expand Up @@ -188,7 +188,7 @@ void Interpreter::Helper_FloatCompareUnordered(PowerPC::PowerPCState& ppc_state,

if (Common::IsSNAN(fa) || Common::IsSNAN(fb))
{
SetFPException(&ppc_state.fpscr, FPSCR_VXSNAN);
SetFPException(ppc_state, FPSCR_VXSNAN);
}
}
else if (fa < fb)
Expand Down Expand Up @@ -310,7 +310,7 @@ void Interpreter::frspx(Interpreter& interpreter, UGeckoInstruction inst) // ro
const bool is_snan = Common::IsSNAN(b);

if (is_snan)
SetFPException(&ppc_state.fpscr, FPSCR_VXSNAN);
SetFPException(ppc_state, FPSCR_VXSNAN);

if (!is_snan || ppc_state.fpscr.VE == 0)
{
Expand All @@ -322,7 +322,7 @@ void Interpreter::frspx(Interpreter& interpreter, UGeckoInstruction inst) // ro
}
else
{
SetFI(&ppc_state.fpscr, b != rounded);
SetFI(ppc_state, b != rounded);
ppc_state.fpscr.FR = fabs(rounded) > fabs(b);
ppc_state.UpdateFPRFSingle(rounded);
ppc_state.ps[inst.FD].Fill(rounded);
Expand All @@ -338,7 +338,7 @@ void Interpreter::fmulx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& c = ppc_state.ps[inst.FC];

const FPResult product = NI_mul(&ppc_state.fpscr, a.PS0AsDouble(), c.PS0AsDouble());
const FPResult product = NI_mul(ppc_state, a.PS0AsDouble(), c.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || product.HasNoInvalidExceptions())
{
Expand All @@ -360,7 +360,7 @@ void Interpreter::fmulsx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c_value = Force25Bit(c.PS0AsDouble());
const FPResult d_value = NI_mul(&ppc_state.fpscr, a.PS0AsDouble(), c_value);
const FPResult d_value = NI_mul(ppc_state, a.PS0AsDouble(), c_value);

if (ppc_state.fpscr.VE == 0 || d_value.HasNoInvalidExceptions())
{
Expand All @@ -382,8 +382,7 @@ void Interpreter::fmaddx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];
const auto& c = ppc_state.ps[inst.FC];
const FPResult product =
NI_madd(&ppc_state.fpscr, a.PS0AsDouble(), c.PS0AsDouble(), b.PS0AsDouble());
const FPResult product = NI_madd(ppc_state, a.PS0AsDouble(), c.PS0AsDouble(), b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || product.HasNoInvalidExceptions())
{
Expand All @@ -404,7 +403,7 @@ void Interpreter::fmaddsx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c_value = Force25Bit(c.PS0AsDouble());
const FPResult d_value = NI_madd(&ppc_state.fpscr, a.PS0AsDouble(), c_value, b.PS0AsDouble());
const FPResult d_value = NI_madd(ppc_state, a.PS0AsDouble(), c_value, b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || d_value.HasNoInvalidExceptions())
{
Expand All @@ -426,7 +425,7 @@ void Interpreter::faddx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const FPResult sum = NI_add(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble());
const FPResult sum = NI_add(ppc_state, a.PS0AsDouble(), b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || sum.HasNoInvalidExceptions())
{
Expand All @@ -444,7 +443,7 @@ void Interpreter::faddsx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const FPResult sum = NI_add(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble());
const FPResult sum = NI_add(ppc_state, a.PS0AsDouble(), b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || sum.HasNoInvalidExceptions())
{
Expand All @@ -463,7 +462,7 @@ void Interpreter::fdivx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const FPResult quotient = NI_div(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble());
const FPResult quotient = NI_div(ppc_state, a.PS0AsDouble(), b.PS0AsDouble());
const bool not_divide_by_zero = ppc_state.fpscr.ZE == 0 || quotient.exception != FPSCR_ZX;
const bool not_invalid = ppc_state.fpscr.VE == 0 || quotient.HasNoInvalidExceptions();

Expand All @@ -484,7 +483,7 @@ void Interpreter::fdivsx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const FPResult quotient = NI_div(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble());
const FPResult quotient = NI_div(ppc_state, a.PS0AsDouble(), b.PS0AsDouble());
const bool not_divide_by_zero = ppc_state.fpscr.ZE == 0 || quotient.exception != FPSCR_ZX;
const bool not_invalid = ppc_state.fpscr.VE == 0 || quotient.HasNoInvalidExceptions();

Expand Down Expand Up @@ -513,15 +512,15 @@ void Interpreter::fresx(Interpreter& interpreter, UGeckoInstruction inst)

if (b == 0.0)
{
SetFPException(&ppc_state.fpscr, FPSCR_ZX);
SetFPException(ppc_state, FPSCR_ZX);
ppc_state.fpscr.ClearFIFR();

if (ppc_state.fpscr.ZE == 0)
compute_result(b);
}
else if (Common::IsSNAN(b))
{
SetFPException(&ppc_state.fpscr, FPSCR_VXSNAN);
SetFPException(ppc_state, FPSCR_VXSNAN);
ppc_state.fpscr.ClearFIFR();

if (ppc_state.fpscr.VE == 0)
Expand Down Expand Up @@ -552,23 +551,23 @@ void Interpreter::frsqrtex(Interpreter& interpreter, UGeckoInstruction inst)

if (b < 0.0)
{
SetFPException(&ppc_state.fpscr, FPSCR_VXSQRT);
SetFPException(ppc_state, FPSCR_VXSQRT);
ppc_state.fpscr.ClearFIFR();

if (ppc_state.fpscr.VE == 0)
compute_result(b);
}
else if (b == 0.0)
{
SetFPException(&ppc_state.fpscr, FPSCR_ZX);
SetFPException(ppc_state, FPSCR_ZX);
ppc_state.fpscr.ClearFIFR();

if (ppc_state.fpscr.ZE == 0)
compute_result(b);
}
else if (Common::IsSNAN(b))
{
SetFPException(&ppc_state.fpscr, FPSCR_VXSNAN);
SetFPException(ppc_state, FPSCR_VXSNAN);
ppc_state.fpscr.ClearFIFR();

if (ppc_state.fpscr.VE == 0)
Expand All @@ -593,8 +592,7 @@ void Interpreter::fmsubx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& b = ppc_state.ps[inst.FB];
const auto& c = ppc_state.ps[inst.FC];

const FPResult product =
NI_msub(&ppc_state.fpscr, a.PS0AsDouble(), c.PS0AsDouble(), b.PS0AsDouble());
const FPResult product = NI_msub(ppc_state, a.PS0AsDouble(), c.PS0AsDouble(), b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || product.HasNoInvalidExceptions())
{
Expand All @@ -615,7 +613,7 @@ void Interpreter::fmsubsx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c_value = Force25Bit(c.PS0AsDouble());
const FPResult product = NI_msub(&ppc_state.fpscr, a.PS0AsDouble(), c_value, b.PS0AsDouble());
const FPResult product = NI_msub(ppc_state, a.PS0AsDouble(), c_value, b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || product.HasNoInvalidExceptions())
{
Expand All @@ -635,8 +633,7 @@ void Interpreter::fnmaddx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& b = ppc_state.ps[inst.FB];
const auto& c = ppc_state.ps[inst.FC];

const FPResult product =
NI_madd(&ppc_state.fpscr, a.PS0AsDouble(), c.PS0AsDouble(), b.PS0AsDouble());
const FPResult product = NI_madd(ppc_state, a.PS0AsDouble(), c.PS0AsDouble(), b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || product.HasNoInvalidExceptions())
{
Expand All @@ -659,7 +656,7 @@ void Interpreter::fnmaddsx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c_value = Force25Bit(c.PS0AsDouble());
const FPResult product = NI_madd(&ppc_state.fpscr, a.PS0AsDouble(), c_value, b.PS0AsDouble());
const FPResult product = NI_madd(ppc_state, a.PS0AsDouble(), c_value, b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || product.HasNoInvalidExceptions())
{
Expand All @@ -681,8 +678,7 @@ void Interpreter::fnmsubx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& b = ppc_state.ps[inst.FB];
const auto& c = ppc_state.ps[inst.FC];

const FPResult product =
NI_msub(&ppc_state.fpscr, a.PS0AsDouble(), c.PS0AsDouble(), b.PS0AsDouble());
const FPResult product = NI_msub(ppc_state, a.PS0AsDouble(), c.PS0AsDouble(), b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || product.HasNoInvalidExceptions())
{
Expand All @@ -705,7 +701,7 @@ void Interpreter::fnmsubsx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c_value = Force25Bit(c.PS0AsDouble());
const FPResult product = NI_msub(&ppc_state.fpscr, a.PS0AsDouble(), c_value, b.PS0AsDouble());
const FPResult product = NI_msub(ppc_state, a.PS0AsDouble(), c_value, b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || product.HasNoInvalidExceptions())
{
Expand All @@ -726,7 +722,7 @@ void Interpreter::fsubx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const FPResult difference = NI_sub(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble());
const FPResult difference = NI_sub(ppc_state, a.PS0AsDouble(), b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || difference.HasNoInvalidExceptions())
{
Expand All @@ -745,7 +741,7 @@ void Interpreter::fsubsx(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const FPResult difference = NI_sub(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble());
const FPResult difference = NI_sub(ppc_state, a.PS0AsDouble(), b.PS0AsDouble());

if (ppc_state.fpscr.VE == 0 || difference.HasNoInvalidExceptions())
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
Expand Up @@ -149,7 +149,7 @@ void Interpreter::twi(Interpreter& interpreter, UGeckoInstruction inst)
if ((a < b && (TO & 0x10) != 0) || (a > b && (TO & 0x08) != 0) || (a == b && (TO & 0x04) != 0) ||
(u32(a) < u32(b) && (TO & 0x02) != 0) || (u32(a) > u32(b) && (TO & 0x01) != 0))
{
GenerateProgramException(ProgramExceptionCause::Trap);
GenerateProgramException(ppc_state, ProgramExceptionCause::Trap);
PowerPC::CheckExceptions();
interpreter.m_end_block = true; // Dunno about this
}
Expand Down Expand Up @@ -380,7 +380,7 @@ void Interpreter::tw(Interpreter& interpreter, UGeckoInstruction inst)
if ((a < b && (TO & 0x10) != 0) || (a > b && (TO & 0x08) != 0) || (a == b && (TO & 0x04) != 0) ||
((u32(a) < u32(b)) && (TO & 0x02) != 0) || ((u32(a) > u32(b)) && (TO & 0x01) != 0))
{
GenerateProgramException(ProgramExceptionCause::Trap);
GenerateProgramException(ppc_state, ProgramExceptionCause::Trap);
PowerPC::CheckExceptions();
interpreter.m_end_block = true; // Dunno about this
}
Expand Down
70 changes: 35 additions & 35 deletions Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
Expand Up @@ -66,7 +66,7 @@ void Interpreter::lfd(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -83,7 +83,7 @@ void Interpreter::lfdu(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -103,7 +103,7 @@ void Interpreter::lfdux(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -123,7 +123,7 @@ void Interpreter::lfdx(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -140,7 +140,7 @@ void Interpreter::lfs(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -160,7 +160,7 @@ void Interpreter::lfsu(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -181,7 +181,7 @@ void Interpreter::lfsux(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -202,7 +202,7 @@ void Interpreter::lfsx(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand Down Expand Up @@ -271,7 +271,7 @@ void Interpreter::lmw(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0 || ppc_state.msr.LE)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand Down Expand Up @@ -300,7 +300,7 @@ void Interpreter::stmw(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0 || ppc_state.msr.LE)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand Down Expand Up @@ -366,7 +366,7 @@ void Interpreter::stfd(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -380,7 +380,7 @@ void Interpreter::stfdu(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -398,7 +398,7 @@ void Interpreter::stfs(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -412,7 +412,7 @@ void Interpreter::stfsu(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand Down Expand Up @@ -485,7 +485,7 @@ void Interpreter::dcbi(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand Down Expand Up @@ -537,7 +537,7 @@ void Interpreter::dcbz(Interpreter& interpreter, UGeckoInstruction inst)

if (!HID0(ppc_state).DCE)
{
GenerateAlignmentException(dcbz_addr);
GenerateAlignmentException(ppc_state, dcbz_addr);
return;
}

Expand All @@ -560,15 +560,15 @@ void Interpreter::dcbz_l(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (!HID2(ppc_state).LCE)
{
GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::IllegalInstruction);
return;
}

const u32 address = Helper_Get_EA_X(ppc_state, inst);

if (!HID0(ppc_state).DCE)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -584,13 +584,13 @@ void Interpreter::eciwx(Interpreter& interpreter, UGeckoInstruction inst)

if ((ppc_state.spr[SPR_EAR] & 0x80000000) == 0)
{
GenerateDSIException(EA);
GenerateDSIException(ppc_state, EA);
return;
}

if ((EA & 0b11) != 0)
{
GenerateAlignmentException(EA);
GenerateAlignmentException(ppc_state, EA);
return;
}

Expand All @@ -604,13 +604,13 @@ void Interpreter::ecowx(Interpreter& interpreter, UGeckoInstruction inst)

if ((ppc_state.spr[SPR_EAR] & 0x80000000) == 0)
{
GenerateDSIException(EA);
GenerateDSIException(ppc_state, EA);
return;
}

if ((EA & 0b11) != 0)
{
GenerateAlignmentException(EA);
GenerateAlignmentException(ppc_state, EA);
return;
}

Expand Down Expand Up @@ -724,7 +724,7 @@ void Interpreter::lswx(Interpreter& interpreter, UGeckoInstruction inst)

if (ppc_state.msr.LE)
{
GenerateAlignmentException(EA);
GenerateAlignmentException(ppc_state, EA);
return;
}

Expand Down Expand Up @@ -811,7 +811,7 @@ void Interpreter::stfdux(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -829,7 +829,7 @@ void Interpreter::stfdx(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -844,7 +844,7 @@ void Interpreter::stfiwx(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -858,7 +858,7 @@ void Interpreter::stfsux(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -876,7 +876,7 @@ void Interpreter::stfsx(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand Down Expand Up @@ -918,7 +918,7 @@ void Interpreter::lswi(Interpreter& interpreter, UGeckoInstruction inst)

if (ppc_state.msr.LE)
{
GenerateAlignmentException(EA);
GenerateAlignmentException(ppc_state, EA);
return;
}

Expand Down Expand Up @@ -966,7 +966,7 @@ void Interpreter::stswi(Interpreter& interpreter, UGeckoInstruction inst)

if (ppc_state.msr.LE)
{
GenerateAlignmentException(EA);
GenerateAlignmentException(ppc_state, EA);
return;
}

Expand Down Expand Up @@ -1005,7 +1005,7 @@ void Interpreter::stswx(Interpreter& interpreter, UGeckoInstruction inst)

if (ppc_state.msr.LE)
{
GenerateAlignmentException(EA);
GenerateAlignmentException(ppc_state, EA);
return;
}

Expand Down Expand Up @@ -1046,7 +1046,7 @@ void Interpreter::lwarx(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand All @@ -1068,7 +1068,7 @@ void Interpreter::stwcxd(Interpreter& interpreter, UGeckoInstruction inst)

if ((address & 0b11) != 0)
{
GenerateAlignmentException(address);
GenerateAlignmentException(ppc_state, address);
return;
}

Expand Down Expand Up @@ -1119,7 +1119,7 @@ void Interpreter::tlbie(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand All @@ -1134,7 +1134,7 @@ void Interpreter::tlbsync(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
}

// Ignored
Expand Down
Expand Up @@ -313,7 +313,7 @@ void Interpreter::psq_l(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (HID2(ppc_state).LSQE == 0)
{
GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::IllegalInstruction);
return;
}

Expand All @@ -326,7 +326,7 @@ void Interpreter::psq_lu(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (HID2(ppc_state).LSQE == 0)
{
GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::IllegalInstruction);
return;
}

Expand All @@ -346,7 +346,7 @@ void Interpreter::psq_st(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (HID2(ppc_state).LSQE == 0)
{
GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::IllegalInstruction);
return;
}

Expand All @@ -359,7 +359,7 @@ void Interpreter::psq_stu(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (HID2(ppc_state).LSQE == 0)
{
GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::IllegalInstruction);
return;
}

Expand Down
108 changes: 51 additions & 57 deletions Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp
Expand Up @@ -126,10 +126,10 @@ void Interpreter::ps_div(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const float ps0 = ForceSingle(ppc_state.fpscr,
NI_div(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble()).value);
const float ps1 = ForceSingle(ppc_state.fpscr,
NI_div(&ppc_state.fpscr, a.PS1AsDouble(), b.PS1AsDouble()).value);
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_div(ppc_state, a.PS0AsDouble(), b.PS0AsDouble()).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_div(ppc_state, a.PS1AsDouble(), b.PS1AsDouble()).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -147,15 +147,15 @@ void Interpreter::ps_res(Interpreter& interpreter, UGeckoInstruction inst)

if (a == 0.0 || b == 0.0)
{
SetFPException(&ppc_state.fpscr, FPSCR_ZX);
SetFPException(ppc_state, FPSCR_ZX);
ppc_state.fpscr.ClearFIFR();
}

if (std::isnan(a) || std::isinf(a) || std::isnan(b) || std::isinf(b))
ppc_state.fpscr.ClearFIFR();

if (Common::IsSNAN(a) || Common::IsSNAN(b))
SetFPException(&ppc_state.fpscr, FPSCR_VXSNAN);
SetFPException(ppc_state, FPSCR_VXSNAN);

const double ps0 = Common::ApproximateReciprocal(a);
const double ps1 = Common::ApproximateReciprocal(b);
Expand All @@ -175,21 +175,21 @@ void Interpreter::ps_rsqrte(Interpreter& interpreter, UGeckoInstruction inst)

if (ps0 == 0.0 || ps1 == 0.0)
{
SetFPException(&ppc_state.fpscr, FPSCR_ZX);
SetFPException(ppc_state, FPSCR_ZX);
ppc_state.fpscr.ClearFIFR();
}

if (ps0 < 0.0 || ps1 < 0.0)
{
SetFPException(&ppc_state.fpscr, FPSCR_VXSQRT);
SetFPException(ppc_state, FPSCR_VXSQRT);
ppc_state.fpscr.ClearFIFR();
}

if (std::isnan(ps0) || std::isinf(ps0) || std::isnan(ps1) || std::isinf(ps1))
ppc_state.fpscr.ClearFIFR();

if (Common::IsSNAN(ps0) || Common::IsSNAN(ps1))
SetFPException(&ppc_state.fpscr, FPSCR_VXSNAN);
SetFPException(ppc_state, FPSCR_VXSNAN);

const float dst_ps0 = ForceSingle(ppc_state.fpscr, Common::ApproximateReciprocalSquareRoot(ps0));
const float dst_ps1 = ForceSingle(ppc_state.fpscr, Common::ApproximateReciprocalSquareRoot(ps1));
Expand All @@ -207,10 +207,10 @@ void Interpreter::ps_sub(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const float ps0 = ForceSingle(ppc_state.fpscr,
NI_sub(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble()).value);
const float ps1 = ForceSingle(ppc_state.fpscr,
NI_sub(&ppc_state.fpscr, a.PS1AsDouble(), b.PS1AsDouble()).value);
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_sub(ppc_state, a.PS0AsDouble(), b.PS0AsDouble()).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_sub(ppc_state, a.PS1AsDouble(), b.PS1AsDouble()).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -225,10 +225,10 @@ void Interpreter::ps_add(Interpreter& interpreter, UGeckoInstruction inst)
const auto& a = ppc_state.ps[inst.FA];
const auto& b = ppc_state.ps[inst.FB];

const float ps0 = ForceSingle(ppc_state.fpscr,
NI_add(&ppc_state.fpscr, a.PS0AsDouble(), b.PS0AsDouble()).value);
const float ps1 = ForceSingle(ppc_state.fpscr,
NI_add(&ppc_state.fpscr, a.PS1AsDouble(), b.PS1AsDouble()).value);
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_add(ppc_state, a.PS0AsDouble(), b.PS0AsDouble()).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_add(ppc_state, a.PS1AsDouble(), b.PS1AsDouble()).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -246,10 +246,8 @@ void Interpreter::ps_mul(Interpreter& interpreter, UGeckoInstruction inst)
const double c0 = Force25Bit(c.PS0AsDouble());
const double c1 = Force25Bit(c.PS1AsDouble());

const float ps0 =
ForceSingle(ppc_state.fpscr, NI_mul(&ppc_state.fpscr, a.PS0AsDouble(), c0).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_mul(&ppc_state.fpscr, a.PS1AsDouble(), c1).value);
const float ps0 = ForceSingle(ppc_state.fpscr, NI_mul(ppc_state, a.PS0AsDouble(), c0).value);
const float ps1 = ForceSingle(ppc_state.fpscr, NI_mul(ppc_state, a.PS1AsDouble(), c1).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -268,10 +266,10 @@ void Interpreter::ps_msub(Interpreter& interpreter, UGeckoInstruction inst)
const double c0 = Force25Bit(c.PS0AsDouble());
const double c1 = Force25Bit(c.PS1AsDouble());

const float ps0 = ForceSingle(
ppc_state.fpscr, NI_msub(&ppc_state.fpscr, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float ps1 = ForceSingle(
ppc_state.fpscr, NI_msub(&ppc_state.fpscr, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_msub(ppc_state, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_msub(ppc_state, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -290,10 +288,10 @@ void Interpreter::ps_madd(Interpreter& interpreter, UGeckoInstruction inst)
const double c0 = Force25Bit(c.PS0AsDouble());
const double c1 = Force25Bit(c.PS1AsDouble());

const float ps0 = ForceSingle(
ppc_state.fpscr, NI_madd(&ppc_state.fpscr, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float ps1 = ForceSingle(
ppc_state.fpscr, NI_madd(&ppc_state.fpscr, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_madd(ppc_state, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_madd(ppc_state, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -312,10 +310,10 @@ void Interpreter::ps_nmsub(Interpreter& interpreter, UGeckoInstruction inst)
const double c0 = Force25Bit(c.PS0AsDouble());
const double c1 = Force25Bit(c.PS1AsDouble());

const float tmp0 = ForceSingle(
ppc_state.fpscr, NI_msub(&ppc_state.fpscr, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float tmp1 = ForceSingle(
ppc_state.fpscr, NI_msub(&ppc_state.fpscr, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);
const float tmp0 =
ForceSingle(ppc_state.fpscr, NI_msub(ppc_state, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float tmp1 =
ForceSingle(ppc_state.fpscr, NI_msub(ppc_state, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);

const float ps0 = std::isnan(tmp0) ? tmp0 : -tmp0;
const float ps1 = std::isnan(tmp1) ? tmp1 : -tmp1;
Expand All @@ -337,10 +335,10 @@ void Interpreter::ps_nmadd(Interpreter& interpreter, UGeckoInstruction inst)
const double c0 = Force25Bit(c.PS0AsDouble());
const double c1 = Force25Bit(c.PS1AsDouble());

const float tmp0 = ForceSingle(
ppc_state.fpscr, NI_madd(&ppc_state.fpscr, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float tmp1 = ForceSingle(
ppc_state.fpscr, NI_madd(&ppc_state.fpscr, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);
const float tmp0 =
ForceSingle(ppc_state.fpscr, NI_madd(ppc_state, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float tmp1 =
ForceSingle(ppc_state.fpscr, NI_madd(ppc_state, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);

const float ps0 = std::isnan(tmp0) ? tmp0 : -tmp0;
const float ps1 = std::isnan(tmp1) ? tmp1 : -tmp1;
Expand All @@ -359,8 +357,8 @@ void Interpreter::ps_sum0(Interpreter& interpreter, UGeckoInstruction inst)
const auto& b = ppc_state.ps[inst.FB];
const auto& c = ppc_state.ps[inst.FC];

const float ps0 = ForceSingle(ppc_state.fpscr,
NI_add(&ppc_state.fpscr, a.PS0AsDouble(), b.PS1AsDouble()).value);
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_add(ppc_state, a.PS0AsDouble(), b.PS1AsDouble()).value);
const float ps1 = ForceSingle(ppc_state.fpscr, c.PS1AsDouble());

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
Expand All @@ -378,8 +376,8 @@ void Interpreter::ps_sum1(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const float ps0 = ForceSingle(ppc_state.fpscr, c.PS0AsDouble());
const float ps1 = ForceSingle(ppc_state.fpscr,
NI_add(&ppc_state.fpscr, a.PS0AsDouble(), b.PS1AsDouble()).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_add(ppc_state, a.PS0AsDouble(), b.PS1AsDouble()).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps1);
Expand All @@ -395,10 +393,8 @@ void Interpreter::ps_muls0(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c0 = Force25Bit(c.PS0AsDouble());
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_mul(&ppc_state.fpscr, a.PS0AsDouble(), c0).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_mul(&ppc_state.fpscr, a.PS1AsDouble(), c0).value);
const float ps0 = ForceSingle(ppc_state.fpscr, NI_mul(ppc_state, a.PS0AsDouble(), c0).value);
const float ps1 = ForceSingle(ppc_state.fpscr, NI_mul(ppc_state, a.PS1AsDouble(), c0).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -414,10 +410,8 @@ void Interpreter::ps_muls1(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c1 = Force25Bit(c.PS1AsDouble());
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_mul(&ppc_state.fpscr, a.PS0AsDouble(), c1).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_mul(&ppc_state.fpscr, a.PS1AsDouble(), c1).value);
const float ps0 = ForceSingle(ppc_state.fpscr, NI_mul(ppc_state, a.PS0AsDouble(), c1).value);
const float ps1 = ForceSingle(ppc_state.fpscr, NI_mul(ppc_state, a.PS1AsDouble(), c1).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -434,10 +428,10 @@ void Interpreter::ps_madds0(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c0 = Force25Bit(c.PS0AsDouble());
const float ps0 = ForceSingle(
ppc_state.fpscr, NI_madd(&ppc_state.fpscr, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float ps1 = ForceSingle(
ppc_state.fpscr, NI_madd(&ppc_state.fpscr, a.PS1AsDouble(), c0, b.PS1AsDouble()).value);
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_madd(ppc_state, a.PS0AsDouble(), c0, b.PS0AsDouble()).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_madd(ppc_state, a.PS1AsDouble(), c0, b.PS1AsDouble()).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand All @@ -454,10 +448,10 @@ void Interpreter::ps_madds1(Interpreter& interpreter, UGeckoInstruction inst)
const auto& c = ppc_state.ps[inst.FC];

const double c1 = Force25Bit(c.PS1AsDouble());
const float ps0 = ForceSingle(
ppc_state.fpscr, NI_madd(&ppc_state.fpscr, a.PS0AsDouble(), c1, b.PS0AsDouble()).value);
const float ps1 = ForceSingle(
ppc_state.fpscr, NI_madd(&ppc_state.fpscr, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);
const float ps0 =
ForceSingle(ppc_state.fpscr, NI_madd(ppc_state, a.PS0AsDouble(), c1, b.PS0AsDouble()).value);
const float ps1 =
ForceSingle(ppc_state.fpscr, NI_madd(ppc_state, a.PS1AsDouble(), c1, b.PS1AsDouble()).value);

ppc_state.ps[inst.FD].SetBoth(ps0, ps1);
ppc_state.UpdateFPRFSingle(ps0);
Expand Down
Expand Up @@ -26,9 +26,9 @@ mffsx: 80036650 (huh?)
*/

static void FPSCRUpdated(UReg_FPSCR* fpscr)
static void FPSCRUpdated(PowerPC::PowerPCState& ppc_state)
{
UpdateFPExceptionSummary(fpscr);
UpdateFPExceptionSummary(ppc_state);
PowerPC::RoundingModeUpdated();
}

Expand All @@ -38,7 +38,7 @@ void Interpreter::mtfsb0x(Interpreter& interpreter, UGeckoInstruction inst)
u32 b = 0x80000000 >> inst.CRBD;

ppc_state.fpscr.Hex &= ~b;
FPSCRUpdated(&ppc_state.fpscr);
FPSCRUpdated(ppc_state);

if (inst.Rc)
ppc_state.UpdateCR1();
Expand All @@ -52,11 +52,11 @@ void Interpreter::mtfsb1x(Interpreter& interpreter, UGeckoInstruction inst)
const u32 b = 0x80000000 >> bit;

if ((b & FPSCR_ANY_X) != 0)
SetFPException(&ppc_state.fpscr, b);
SetFPException(ppc_state, b);
else
ppc_state.fpscr |= b;

FPSCRUpdated(&ppc_state.fpscr);
FPSCRUpdated(ppc_state);

if (inst.Rc)
ppc_state.UpdateCR1();
Expand All @@ -72,7 +72,7 @@ void Interpreter::mtfsfix(Interpreter& interpreter, UGeckoInstruction inst)

ppc_state.fpscr = (ppc_state.fpscr.Hex & ~mask) | (imm >> (4 * field));

FPSCRUpdated(&ppc_state.fpscr);
FPSCRUpdated(ppc_state);

if (inst.Rc)
ppc_state.UpdateCR1();
Expand All @@ -91,7 +91,7 @@ void Interpreter::mtfsfx(Interpreter& interpreter, UGeckoInstruction inst)

ppc_state.fpscr =
(ppc_state.fpscr.Hex & ~m) | (static_cast<u32>(ppc_state.ps[inst.FB].PS0AsU64()) & m);
FPSCRUpdated(&ppc_state.fpscr);
FPSCRUpdated(ppc_state);

if (inst.Rc)
ppc_state.UpdateCR1();
Expand Down Expand Up @@ -138,7 +138,7 @@ void Interpreter::mfmsr(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand All @@ -150,7 +150,7 @@ void Interpreter::mfsr(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand All @@ -162,7 +162,7 @@ void Interpreter::mfsrin(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand All @@ -175,14 +175,14 @@ void Interpreter::mtmsr(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

ppc_state.msr.Hex = ppc_state.gpr[inst.RS];

// FE0/FE1 may have been set
CheckFPExceptions(ppc_state.fpscr);
CheckFPExceptions(ppc_state);

PowerPC::CheckExceptions();
interpreter.m_end_block = true;
Expand All @@ -195,7 +195,7 @@ void Interpreter::mtsr(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand All @@ -209,7 +209,7 @@ void Interpreter::mtsrin(Interpreter& interpreter, UGeckoInstruction inst)
auto& ppc_state = interpreter.m_ppc_state;
if (ppc_state.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand All @@ -234,7 +234,7 @@ void Interpreter::mfspr(Interpreter& interpreter, UGeckoInstruction inst)
if (ppc_state.msr.PR && index != SPR_XER && index != SPR_LR && index != SPR_CTR &&
index != SPR_TL && index != SPR_TU)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand All @@ -260,7 +260,7 @@ void Interpreter::mfspr(Interpreter& interpreter, UGeckoInstruction inst)
// GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS)).
// Currently, we always treat the buffer as not empty, as the exact behavior is unclear
// (and games that use display lists will hang if the bit doesn't eventually become zero).
if (Core::System::GetInstance().GetGPFifo().IsBNE())
if (interpreter.m_system.GetGPFifo().IsBNE())
ppc_state.spr[index] |= 1;
else
ppc_state.spr[index] &= ~1;
Expand Down Expand Up @@ -305,7 +305,7 @@ void Interpreter::mtspr(Interpreter& interpreter, UGeckoInstruction inst)
// XER, LR, and CTR are the only ones available to be written to in user mode
if (ppc_state.msr.PR && index != SPR_XER && index != SPR_LR && index != SPR_CTR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
GenerateProgramException(ppc_state, ProgramExceptionCause::PrivilegedInstruction);
return;
}

Expand Down Expand Up @@ -388,7 +388,7 @@ void Interpreter::mtspr(Interpreter& interpreter, UGeckoInstruction inst)
ASSERT_MSG(POWERPC, ppc_state.spr[SPR_WPAR] == GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS,
"Gather pipe changed to unexpected address {:08x} @ PC {:08x}",
ppc_state.spr[SPR_WPAR], ppc_state.pc);
Core::System::GetInstance().GetGPFifo().ResetGatherPipe();
interpreter.m_system.GetGPFifo().ResetGatherPipe();
break;

// Graphics Quantization Registers
Expand Down Expand Up @@ -616,7 +616,7 @@ void Interpreter::mcrfs(Interpreter& interpreter, UGeckoInstruction inst)

// If any exception bits were read, clear them
ppc_state.fpscr.Hex &= ~((0xF << shift) & (FPSCR_FX | FPSCR_ANY_X));
FPSCRUpdated(&ppc_state.fpscr);
FPSCRUpdated(ppc_state);

ppc_state.cr.SetField(inst.CRFD, fpflags);
}
Expand Down