PowerPC: Parametrize TL macro.

This commit is contained in:
Admiral H. Curtiss 2023-01-10 01:47:36 +01:00
parent 2f241856b6
commit a7d3315b4f
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
3 changed files with 7 additions and 7 deletions

View File

@ -309,7 +309,7 @@ void Interpreter::mtspr(UGeckoInstruction inst)
break; break;
case SPR_TL_W: case SPR_TL_W:
TL = PowerPC::ppcState.gpr[inst.RD]; TL(PowerPC::ppcState) = PowerPC::ppcState.gpr[inst.RD];
SystemTimers::TimeBaseSet(); SystemTimers::TimeBaseSet();
break; break;

View File

@ -107,8 +107,8 @@ void DoState(PointerWrap& p)
// conflict to mess with them here. // conflict to mess with them here.
// PowerPC::ppcState.spr[SPR_DEC] = SystemTimers::GetFakeDecrementer(); // PowerPC::ppcState.spr[SPR_DEC] = SystemTimers::GetFakeDecrementer();
// *((u64 *)&TL) = SystemTimers::GetFakeTimeBase(); //works since we are little endian and TL // *((u64 *)&TL(PowerPC::ppcState)) = SystemTimers::GetFakeTimeBase(); //works since we are little
// comes first :) // endian and TL comes first :)
p.DoArray(ppcState.gpr); p.DoArray(ppcState.gpr);
p.Do(ppcState.pc); p.Do(ppcState.pc);
@ -206,7 +206,7 @@ static void ResetRegisters()
DBATUpdated(); DBATUpdated();
IBATUpdated(); IBATUpdated();
TL = 0; TL(PowerPC::ppcState) = 0;
TU = 0; TU = 0;
SystemTimers::TimeBaseSet(); SystemTimers::TimeBaseSet();
@ -394,13 +394,13 @@ void RunLoop()
u64 ReadFullTimeBaseValue() u64 ReadFullTimeBaseValue()
{ {
u64 value; u64 value;
std::memcpy(&value, &TL, sizeof(value)); std::memcpy(&value, &TL(PowerPC::ppcState), sizeof(value));
return value; return value;
} }
void WriteFullTimeBaseValue(u64 value) void WriteFullTimeBaseValue(u64 value)
{ {
std::memcpy(&TL, &value, sizeof(value)); std::memcpy(&TL(PowerPC::ppcState), &value, sizeof(value));
} }
void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst) void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst)

View File

@ -251,7 +251,7 @@ void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst);
#define SRR0(ppc_state) (ppc_state).spr[SPR_SRR0] #define SRR0(ppc_state) (ppc_state).spr[SPR_SRR0]
#define SRR1(ppc_state) (ppc_state).spr[SPR_SRR1] #define SRR1(ppc_state) (ppc_state).spr[SPR_SRR1]
#define GQR(ppc_state, x) (ppc_state).spr[SPR_GQR0 + (x)] #define GQR(ppc_state, x) (ppc_state).spr[SPR_GQR0 + (x)]
#define TL PowerPC::ppcState.spr[SPR_TL] #define TL(ppc_state) (ppc_state).spr[SPR_TL]
#define TU PowerPC::ppcState.spr[SPR_TU] #define TU PowerPC::ppcState.spr[SPR_TU]
inline void SetCarry(u32 ca) inline void SetCarry(u32 ca)