Core: Convert DoIllegalInstructionException to TriggerException

This commit is contained in:
zilmar 2023-05-18 11:13:22 +09:30
parent 59a1277bed
commit 252f629e14
4 changed files with 5 additions and 24 deletions

View File

@ -3072,9 +3072,7 @@ void R4300iOp::COP1_L_CVT_D()
// Other functions
void R4300iOp::ReservedInstruction()
{
g_Reg->DoIllegalInstructionException(g_System->m_PipelineStage == PIPELINE_STAGE_JUMP);
g_System->m_PipelineStage = PIPELINE_STAGE_JUMP;
g_System->m_JumpToLocation = (*_PROGRAM_COUNTER);
g_Reg->TriggerException(EXC_II);
}
void R4300iOp::UnknownOpcode()

View File

@ -712,24 +712,6 @@ bool CRegisters::DoIntrException(bool DelaySlot)
return true;
}
void CRegisters::DoIllegalInstructionException(bool DelaySlot)
{
CAUSE_REGISTER.ExceptionCode = EXC_II;
CAUSE_REGISTER.CoprocessorUnitNumber = 0;
if (DelaySlot)
{
CAUSE_REGISTER.BranchDelay = 1;
EPC_REGISTER = (int64_t)((int32_t)m_PROGRAM_COUNTER - 4);
}
else
{
CAUSE_REGISTER.BranchDelay = 0;
EPC_REGISTER = (int64_t)((int32_t)m_PROGRAM_COUNTER);
}
m_PROGRAM_COUNTER = 0x80000180;
STATUS_REGISTER |= STATUS_EXL;
}
void CRegisters::DoTLBReadMiss(bool DelaySlot, uint64_t BadVaddr)
{
CAUSE_REGISTER.ExceptionCode = EXC_RMISS;

View File

@ -408,7 +408,6 @@ public:
void DoFloatingPointException(bool DelaySlot);
void DoCopUnusableException(bool DelaySlot, int32_t Coprocessor);
bool DoIntrException(bool DelaySlot);
void DoIllegalInstructionException(bool DelaySlot);
void DoTLBReadMiss(bool DelaySlot, uint64_t BadVaddr);
void DoTLBWriteMiss(bool DelaySlot, uint64_t BadVaddr);
void FixFpuLocations();

View File

@ -9533,8 +9533,10 @@ void CX86RecompilerOps::CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo
ExitCodeBlock();
break;
case ExitReason_IllegalInstruction:
m_Assembler.PushImm32(InDelaySlot ? "true" : "false", InDelaySlot);
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::DoIllegalInstructionException), "CRegisters::DoIllegalInstructionException", 8);
m_Assembler.MoveConstToVariable(&g_System->m_PipelineStage, "System->m_PipelineStage", m_PipelineStage == PIPELINE_STAGE_JUMP || m_PipelineStage == PIPELINE_STAGE_DELAY_SLOT ? PIPELINE_STAGE_JUMP : PIPELINE_STAGE_NORMAL);
m_Assembler.push(0);
m_Assembler.PushImm32("EXC_II", EXC_II);
m_Assembler.CallThis((uint32_t)g_Reg, AddressOf(&CRegisters::TriggerException), "CRegisters::TriggerException", 12);
ExitCodeBlock();
break;
default: