RSP: DelaySlotAffectBranch should clamp PC
This commit is contained in:
parent
661ec98bb3
commit
06eea03d7d
|
@ -1835,22 +1835,22 @@ Input: PC
|
||||||
|
|
||||||
bool DelaySlotAffectBranch(uint32_t PC)
|
bool DelaySlotAffectBranch(uint32_t PC)
|
||||||
{
|
{
|
||||||
RSPOpcode Branch, Delay;
|
uint32_t DelayPC = (PC + 4) & 0xFFC;
|
||||||
OPCODE_INFO infoBranch, infoDelay;
|
if (IsOpcodeNop(DelayPC) == true)
|
||||||
|
|
||||||
if (IsOpcodeNop(PC + 4) == true)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RSP_LW_IMEM(PC, &Branch.Value);
|
RSPOpcode BranchOp, DelayOp;
|
||||||
RSP_LW_IMEM(PC + 4, &Delay.Value);
|
RSP_LW_IMEM(PC, &BranchOp.Value);
|
||||||
|
RSP_LW_IMEM(DelayPC, &DelayOp.Value);
|
||||||
|
|
||||||
|
OPCODE_INFO infoBranch, infoDelay;
|
||||||
memset(&infoDelay, 0, sizeof(infoDelay));
|
memset(&infoDelay, 0, sizeof(infoDelay));
|
||||||
memset(&infoBranch, 0, sizeof(infoBranch));
|
memset(&infoBranch, 0, sizeof(infoBranch));
|
||||||
|
|
||||||
GetInstructionInfo(PC, &Branch, &infoBranch);
|
GetInstructionInfo(PC, &BranchOp, &infoBranch);
|
||||||
GetInstructionInfo(PC + 4, &Delay, &infoDelay);
|
GetInstructionInfo(DelayPC, &DelayOp, &infoDelay);
|
||||||
|
|
||||||
if ((infoDelay.flags & COPO_MF_Instruction) == COPO_MF_Instruction)
|
if ((infoDelay.flags & COPO_MF_Instruction) == COPO_MF_Instruction)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue