PowerPC: Parametrize HID2 macro.

This commit is contained in:
Admiral H. Curtiss 2023-01-09 20:49:37 +01:00
parent 49eeb986c6
commit 6f0ab1b33e
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
5 changed files with 12 additions and 11 deletions

View File

@ -91,9 +91,9 @@ void CBoot::SetupHID(bool is_wii)
// HID1 is initialized in PowerPC.cpp to 0x80000000 // HID1 is initialized in PowerPC.cpp to 0x80000000
// HID2 is 0xe0000000 // HID2 is 0xe0000000
HID2.PSE = 1; HID2(PowerPC::ppcState).PSE = 1;
HID2.WPE = 1; HID2(PowerPC::ppcState).WPE = 1;
HID2.LSQE = 1; HID2(PowerPC::ppcState).LSQE = 1;
// HID4 is 0 on GC and 0x83900000 on Wii // HID4 is 0 on GC and 0x83900000 on Wii
if (is_wii) if (is_wii)

View File

@ -64,10 +64,11 @@ bool IsPairedSingleInstruction(UGeckoInstruction inst)
// but HID2.LSQE is not set. // but HID2.LSQE is not set.
bool IsInvalidPairedSingleExecution(UGeckoInstruction inst) bool IsInvalidPairedSingleExecution(UGeckoInstruction inst)
{ {
if (!HID2.PSE && IsPairedSingleInstruction(inst)) if (!HID2(PowerPC::ppcState).PSE && IsPairedSingleInstruction(inst))
return true; return true;
return HID2.PSE && !HID2.LSQE && IsPairedSingleQuantizedNonIndexedInstruction(inst); return HID2(PowerPC::ppcState).PSE && !HID2(PowerPC::ppcState).LSQE &&
IsPairedSingleQuantizedNonIndexedInstruction(inst);
} }
void UpdatePC() void UpdatePC()

View File

@ -525,7 +525,7 @@ void Interpreter::dcbz(UGeckoInstruction inst)
void Interpreter::dcbz_l(UGeckoInstruction inst) void Interpreter::dcbz_l(UGeckoInstruction inst)
{ {
if (!HID2.LCE) if (!HID2(PowerPC::ppcState).LCE)
{ {
GenerateProgramException(ProgramExceptionCause::IllegalInstruction); GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
return; return;

View File

@ -310,7 +310,7 @@ static void Helper_Dequantize(PowerPC::PowerPCState* ppcs, u32 addr, u32 instI,
void Interpreter::psq_l(UGeckoInstruction inst) void Interpreter::psq_l(UGeckoInstruction inst)
{ {
if (HID2.LSQE == 0) if (HID2(PowerPC::ppcState).LSQE == 0)
{ {
GenerateProgramException(ProgramExceptionCause::IllegalInstruction); GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
return; return;
@ -322,7 +322,7 @@ void Interpreter::psq_l(UGeckoInstruction inst)
void Interpreter::psq_lu(UGeckoInstruction inst) void Interpreter::psq_lu(UGeckoInstruction inst)
{ {
if (HID2.LSQE == 0) if (HID2(PowerPC::ppcState).LSQE == 0)
{ {
GenerateProgramException(ProgramExceptionCause::IllegalInstruction); GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
return; return;
@ -341,7 +341,7 @@ void Interpreter::psq_lu(UGeckoInstruction inst)
void Interpreter::psq_st(UGeckoInstruction inst) void Interpreter::psq_st(UGeckoInstruction inst)
{ {
if (HID2.LSQE == 0) if (HID2(PowerPC::ppcState).LSQE == 0)
{ {
GenerateProgramException(ProgramExceptionCause::IllegalInstruction); GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
return; return;
@ -353,7 +353,7 @@ void Interpreter::psq_st(UGeckoInstruction inst)
void Interpreter::psq_stu(UGeckoInstruction inst) void Interpreter::psq_stu(UGeckoInstruction inst)
{ {
if (HID2.LSQE == 0) if (HID2(PowerPC::ppcState).LSQE == 0)
{ {
GenerateProgramException(ProgramExceptionCause::IllegalInstruction); GenerateProgramException(ProgramExceptionCause::IllegalInstruction);
return; return;

View File

@ -236,7 +236,7 @@ void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst);
// Easy register access macros. // Easy register access macros.
#define HID0(ppc_state) ((UReg_HID0&)(ppc_state).spr[SPR_HID0]) #define HID0(ppc_state) ((UReg_HID0&)(ppc_state).spr[SPR_HID0])
#define HID2 ((UReg_HID2&)PowerPC::ppcState.spr[SPR_HID2]) #define HID2(ppc_state) ((UReg_HID2&)(ppc_state).spr[SPR_HID2])
#define HID4 ((UReg_HID4&)PowerPC::ppcState.spr[SPR_HID4]) #define HID4 ((UReg_HID4&)PowerPC::ppcState.spr[SPR_HID4])
#define DMAU (*(UReg_DMAU*)&PowerPC::ppcState.spr[SPR_DMAU]) #define DMAU (*(UReg_DMAU*)&PowerPC::ppcState.spr[SPR_DMAU])
#define DMAL (*(UReg_DMAL*)&PowerPC::ppcState.spr[SPR_DMAL]) #define DMAL (*(UReg_DMAL*)&PowerPC::ppcState.spr[SPR_DMAL])