PowerPC: Remove MSR macro.

This commit is contained in:
Admiral H. Curtiss committed 2023-01-27 15:22:42 +01:00
1 parent 4b6b8fa1ae
commit ba1b624e1b
26 files changed
+120 -116

No files matched your search

@@ -132,8 +132,8 @@ static void Trace(const UGeckoInstruction& inst)
"INTER PC: {:08x} SRR0: {:08x} SRR1: {:08x} CRval: {:016x} "
"FPSCR: {:08x} MSR: {:08x} LR: {:08x} {} {:08x} {}",
PowerPC::ppcState.pc, SRR0, SRR1, PowerPC::ppcState.cr.fields[0],
PowerPC::ppcState.fpscr.Hex, MSR.Hex, PowerPC::ppcState.spr[8], regs, inst.hex,
ppc_inst);
PowerPC::ppcState.fpscr.Hex, PowerPC::ppcState.msr.Hex, PowerPC::ppcState.spr[8],
regs, inst.hex, ppc_inst);
}
bool Interpreter::HandleFunctionHooking(u32 address)
@@ -178,7 +178,7 @@ int Interpreter::SingleStepInner()
GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
CheckExceptions();
}
else if (MSR.FP)
else if (PowerPC::ppcState.msr.FP)
{
m_op_table[m_prev_inst.OPCD](m_prev_inst);
if ((PowerPC::ppcState.Exceptions & EXCEPTION_DSI) != 0)
@@ -100,7 +100,7 @@ void Interpreter::HLEFunction(UGeckoInstruction inst)
void Interpreter::rfi(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
@@ -109,9 +109,9 @@ void Interpreter::rfi(UGeckoInstruction inst)
// Restore saved bits from SRR1 to MSR.
// Gecko/Broadway can save more bits than explicitly defined in ppc spec
const u32 mask = 0x87C0FFFF;
MSR.Hex = (MSR.Hex & ~mask) | (SRR1 & mask);
PowerPC::ppcState.msr.Hex = (PowerPC::ppcState.msr.Hex & ~mask) | (SRR1 & mask);
// MSR[13] is set to 0.
MSR.Hex &= 0xFFFBFFFF;
PowerPC::ppcState.msr.Hex &= 0xFFFBFFFF;
// Here we should check if there are pending exceptions, and if their corresponding enable bits
// are set
// if above is true, we'd do:
@@ -27,7 +27,7 @@ enum class FPCC
inline void CheckFPExceptions(UReg_FPSCR fpscr)
{
if (fpscr.FEX && (MSR.FE0 || MSR.FE1))
if (fpscr.FEX && (PowerPC::ppcState.msr.FE0 || PowerPC::ppcState.msr.FE1))
GenerateProgramException(ProgramExceptionCause::FloatingPoint);
}
@@ -254,7 +254,7 @@ void Interpreter::lmw(UGeckoInstruction inst)
{
u32 address = Helper_Get_EA(PowerPC::ppcState, inst);
if ((address & 0b11) != 0 || MSR.LE)
if ((address & 0b11) != 0 || PowerPC::ppcState.msr.LE)
{
GenerateAlignmentException(address);
return;
@@ -282,7 +282,7 @@ void Interpreter::stmw(UGeckoInstruction inst)
{
u32 address = Helper_Get_EA(PowerPC::ppcState, inst);
if ((address & 0b11) != 0 || MSR.LE)
if ((address & 0b11) != 0 || PowerPC::ppcState.msr.LE)
{
GenerateAlignmentException(address);
return;
@@ -453,7 +453,7 @@ void Interpreter::dcbf(UGeckoInstruction inst)
void Interpreter::dcbi(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
@@ -678,7 +678,7 @@ void Interpreter::lswx(UGeckoInstruction inst)
{
u32 EA = Helper_Get_EA_X(PowerPC::ppcState, inst);
if (MSR.LE)
if (PowerPC::ppcState.msr.LE)
{
GenerateAlignmentException(EA);
return;
@@ -858,7 +858,7 @@ void Interpreter::lswi(UGeckoInstruction inst)
if (inst.RA != 0)
EA = rGPR[inst.RA];
if (MSR.LE)
if (PowerPC::ppcState.msr.LE)
{
GenerateAlignmentException(EA);
return;
@@ -905,7 +905,7 @@ void Interpreter::stswi(UGeckoInstruction inst)
if (inst.RA != 0)
EA = rGPR[inst.RA];
if (MSR.LE)
if (PowerPC::ppcState.msr.LE)
{
GenerateAlignmentException(EA);
return;
@@ -943,7 +943,7 @@ void Interpreter::stswx(UGeckoInstruction inst)
{
u32 EA = Helper_Get_EA_X(PowerPC::ppcState, inst);
if (MSR.LE)
if (PowerPC::ppcState.msr.LE)
{
GenerateAlignmentException(EA);
return;
@@ -1051,7 +1051,7 @@ void Interpreter::sync(UGeckoInstruction inst)
void Interpreter::tlbie(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
@@ -1065,7 +1065,7 @@ void Interpreter::tlbie(UGeckoInstruction inst)
void Interpreter::tlbsync(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
}
@@ -128,18 +128,18 @@ void Interpreter::mtcrf(UGeckoInstruction inst)
void Interpreter::mfmsr(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
}
rGPR[inst.RD] = MSR.Hex;
rGPR[inst.RD] = PowerPC::ppcState.msr.Hex;
}
void Interpreter::mfsr(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
@@ -150,7 +150,7 @@ void Interpreter::mfsr(UGeckoInstruction inst)
void Interpreter::mfsrin(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
@@ -162,13 +162,13 @@ void Interpreter::mfsrin(UGeckoInstruction inst)
void Interpreter::mtmsr(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
}
MSR.Hex = rGPR[inst.RS];
PowerPC::ppcState.msr.Hex = rGPR[inst.RS];
// FE0/FE1 may have been set
CheckFPExceptions(PowerPC::ppcState.fpscr);
@@ -181,7 +181,7 @@ void Interpreter::mtmsr(UGeckoInstruction inst)
void Interpreter::mtsr(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
@@ -194,7 +194,7 @@ void Interpreter::mtsr(UGeckoInstruction inst)
void Interpreter::mtsrin(UGeckoInstruction inst)
{
if (MSR.PR)
if (PowerPC::ppcState.msr.PR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
@@ -217,8 +217,8 @@ void Interpreter::mfspr(UGeckoInstruction inst)
const u32 index = ((inst.SPR & 0x1F) << 5) + ((inst.SPR >> 5) & 0x1F);
// XER, LR, CTR, and timebase halves are the only ones available in user mode.
if (MSR.PR && index != SPR_XER && index != SPR_LR && index != SPR_CTR && index != SPR_TL &&
index != SPR_TU)
if (PowerPC::ppcState.msr.PR && index != SPR_XER && index != SPR_LR && index != SPR_CTR &&
index != SPR_TL && index != SPR_TU)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;
@@ -288,7 +288,7 @@ void Interpreter::mtspr(UGeckoInstruction inst)
const u32 index = (inst.SPRU << 5) | (inst.SPRL & 0x1F);
// XER, LR, and CTR are the only ones available to be written to in user mode
if (MSR.PR && index != SPR_XER && index != SPR_LR && index != SPR_CTR)
if (PowerPC::ppcState.msr.PR && index != SPR_XER && index != SPR_LR && index != SPR_CTR)
{
GenerateProgramException(ProgramExceptionCause::PrivilegedInstruction);
return;