diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp index 23e722f713..138506df52 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp @@ -131,9 +131,9 @@ static void Trace(const UGeckoInstruction& inst) DEBUG_LOG_FMT(POWERPC, "INTER PC: {:08x} SRR0: {:08x} SRR1: {:08x} CRval: {:016x} " "FPSCR: {:08x} MSR: {:08x} LR: {:08x} {} {:08x} {}", - PowerPC::ppcState.pc, SRR0(PowerPC::ppcState), SRR1, PowerPC::ppcState.cr.fields[0], - PowerPC::ppcState.fpscr.Hex, PowerPC::ppcState.msr.Hex, PowerPC::ppcState.spr[8], - regs, inst.hex, ppc_inst); + PowerPC::ppcState.pc, SRR0(PowerPC::ppcState), SRR1(PowerPC::ppcState), + PowerPC::ppcState.cr.fields[0], PowerPC::ppcState.fpscr.Hex, + PowerPC::ppcState.msr.Hex, PowerPC::ppcState.spr[8], regs, inst.hex, ppc_inst); } bool Interpreter::HandleFunctionHooking(u32 address) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp index ef1cde4463..13c739b9f3 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Branch.cpp @@ -109,7 +109,8 @@ 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; - PowerPC::ppcState.msr.Hex = (PowerPC::ppcState.msr.Hex & ~mask) | (SRR1 & mask); + PowerPC::ppcState.msr.Hex = + (PowerPC::ppcState.msr.Hex & ~mask) | (SRR1(PowerPC::ppcState) & mask); // MSR[13] is set to 0. PowerPC::ppcState.msr.Hex &= 0xFFFBFFFF; // Here we should check if there are pending exceptions, and if their corresponding enable bits diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index e6544d1c66..84c9611776 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -759,8 +759,9 @@ void Jit64::Trace() DEBUG_LOG_FMT(DYNA_REC, "JIT64 PC: {:08x} SRR0: {:08x} SRR1: {:08x} FPSCR: {:08x} " "MSR: {:08x} LR: {:08x} {} {}", - PowerPC::ppcState.pc, SRR0(PowerPC::ppcState), SRR1, PowerPC::ppcState.fpscr.Hex, - PowerPC::ppcState.msr.Hex, PowerPC::ppcState.spr[8], regs, fregs); + PowerPC::ppcState.pc, SRR0(PowerPC::ppcState), SRR1(PowerPC::ppcState), + PowerPC::ppcState.fpscr.Hex, PowerPC::ppcState.msr.Hex, PowerPC::ppcState.spr[8], + regs, fregs); } void Jit64::Jit(u32 em_address) diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index bb9c3fd7ed..01461ca19b 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -705,8 +705,9 @@ void JitArm64::Trace() DEBUG_LOG_FMT(DYNA_REC, "JitArm64 PC: {:08x} SRR0: {:08x} SRR1: {:08x} FPSCR: {:08x} " "MSR: {:08x} LR: {:08x} {} {}", - PowerPC::ppcState.pc, SRR0(PowerPC::ppcState), SRR1, PowerPC::ppcState.fpscr.Hex, - PowerPC::ppcState.msr.Hex, PowerPC::ppcState.spr[8], regs, fregs); + PowerPC::ppcState.pc, SRR0(PowerPC::ppcState), SRR1(PowerPC::ppcState), + PowerPC::ppcState.fpscr.Hex, PowerPC::ppcState.msr.Hex, PowerPC::ppcState.spr[8], + regs, fregs); } void JitArm64::Jit(u32 em_address) diff --git a/Source/Core/Core/PowerPC/PowerPC.cpp b/Source/Core/Core/PowerPC/PowerPC.cpp index aa6306f91c..ff49eca4e6 100644 --- a/Source/Core/Core/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/PowerPC/PowerPC.cpp @@ -491,7 +491,7 @@ void CheckExceptions() { SRR0(PowerPC::ppcState) = PowerPC::ppcState.npc; // Page fault occurred - SRR1 = (PowerPC::ppcState.msr.Hex & 0x87C0FFFF) | (1 << 30); + SRR1(PowerPC::ppcState) = (PowerPC::ppcState.msr.Hex & 0x87C0FFFF) | (1 << 30); PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000400; @@ -503,7 +503,7 @@ void CheckExceptions() { SRR0(PowerPC::ppcState) = PowerPC::ppcState.pc; // SRR1 was partially set by GenerateProgramException, so bitwise or is used here - SRR1 |= PowerPC::ppcState.msr.Hex & 0x87C0FFFF; + SRR1(PowerPC::ppcState) |= PowerPC::ppcState.msr.Hex & 0x87C0FFFF; PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000700; @@ -514,7 +514,7 @@ void CheckExceptions() else if (exceptions & EXCEPTION_SYSCALL) { SRR0(PowerPC::ppcState) = PowerPC::ppcState.npc; - SRR1 = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; + SRR1(PowerPC::ppcState) = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000C00; @@ -526,7 +526,7 @@ void CheckExceptions() { // This happens a lot - GameCube OS uses deferred FPU context switching SRR0(PowerPC::ppcState) = PowerPC::ppcState.pc; // re-execute the instruction - SRR1 = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; + SRR1(PowerPC::ppcState) = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000800; @@ -541,7 +541,7 @@ void CheckExceptions() else if (exceptions & EXCEPTION_DSI) { SRR0(PowerPC::ppcState) = PowerPC::ppcState.pc; - SRR1 = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; + SRR1(PowerPC::ppcState) = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000300; @@ -553,7 +553,7 @@ void CheckExceptions() else if (exceptions & EXCEPTION_ALIGNMENT) { SRR0(PowerPC::ppcState) = PowerPC::ppcState.pc; - SRR1 = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; + SRR1(PowerPC::ppcState) = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000600; @@ -583,7 +583,7 @@ void CheckExternalExceptions() { // Pokemon gets this "too early", it hasn't a handler yet SRR0(PowerPC::ppcState) = PowerPC::ppcState.npc; - SRR1 = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; + SRR1(PowerPC::ppcState) = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000500; @@ -591,12 +591,13 @@ void CheckExternalExceptions() DEBUG_LOG_FMT(POWERPC, "EXCEPTION_EXTERNAL_INT"); ppcState.Exceptions &= ~EXCEPTION_EXTERNAL_INT; - DEBUG_ASSERT_MSG(POWERPC, (SRR1 & 0x02) != 0, "EXTERNAL_INT unrecoverable???"); + DEBUG_ASSERT_MSG(POWERPC, (SRR1(PowerPC::ppcState) & 0x02) != 0, + "EXTERNAL_INT unrecoverable???"); } else if (exceptions & EXCEPTION_PERFORMANCE_MONITOR) { SRR0(PowerPC::ppcState) = PowerPC::ppcState.npc; - SRR1 = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; + SRR1(PowerPC::ppcState) = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000F00; @@ -607,7 +608,7 @@ void CheckExternalExceptions() else if (exceptions & EXCEPTION_DECREMENTER) { SRR0(PowerPC::ppcState) = PowerPC::ppcState.npc; - SRR1 = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; + SRR1(PowerPC::ppcState) = PowerPC::ppcState.msr.Hex & 0x87C0FFFF; PowerPC::ppcState.msr.LE = PowerPC::ppcState.msr.ILE; PowerPC::ppcState.msr.Hex &= ~0x04EF36; PowerPC::ppcState.pc = PowerPC::ppcState.npc = 0x00000900; diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index 6a278d3bbd..915d125dcd 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -249,7 +249,7 @@ void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst); #define LR(ppc_state) (ppc_state).spr[SPR_LR] #define CTR(ppc_state) (ppc_state).spr[SPR_CTR] #define SRR0(ppc_state) (ppc_state).spr[SPR_SRR0] -#define SRR1 PowerPC::ppcState.spr[SPR_SRR1] +#define SRR1(ppc_state) (ppc_state).spr[SPR_SRR1] #define SPRG0 PowerPC::ppcState.spr[SPR_SPRG0] #define SPRG1 PowerPC::ppcState.spr[SPR_SPRG1] #define SPRG2 PowerPC::ppcState.spr[SPR_SPRG2]