Core: Add Cop2/Cop3 handling exception
This commit is contained in:
parent
c8bb04b6b0
commit
6c154f6547
|
@ -84,6 +84,34 @@ void R4300iOp::COP1()
|
|||
Jump_CoP1[m_Opcode.fmt]();
|
||||
}
|
||||
|
||||
void R4300iOp::COP2()
|
||||
{
|
||||
if ((g_Reg->STATUS_REGISTER & STATUS_CU2) == 0)
|
||||
{
|
||||
g_Reg->DoCopUnusableException(g_System->m_PipelineStage == PIPELINE_STAGE_JUMP, 2);
|
||||
g_System->m_PipelineStage = PIPELINE_STAGE_JUMP;
|
||||
g_System->m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnknownOpcode();
|
||||
}
|
||||
}
|
||||
|
||||
void R4300iOp::COP3()
|
||||
{
|
||||
if ((g_Reg->STATUS_REGISTER & STATUS_CU3) == 0)
|
||||
{
|
||||
g_Reg->DoCopUnusableException(g_System->m_PipelineStage == PIPELINE_STAGE_JUMP, 3);
|
||||
g_System->m_PipelineStage = PIPELINE_STAGE_JUMP;
|
||||
g_System->m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnknownOpcode();
|
||||
}
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_BC()
|
||||
{
|
||||
Jump_CoP1_BC[m_Opcode.ft]();
|
||||
|
@ -131,8 +159,8 @@ R4300iOp::Func * R4300iOp::BuildInterpreter()
|
|||
Jump_Opcode[15] = LUI;
|
||||
Jump_Opcode[16] = COP0;
|
||||
Jump_Opcode[17] = COP1;
|
||||
Jump_Opcode[18] = UnknownOpcode;
|
||||
Jump_Opcode[19] = UnknownOpcode;
|
||||
Jump_Opcode[18] = COP2;
|
||||
Jump_Opcode[19] = COP3;
|
||||
Jump_Opcode[20] = BEQL;
|
||||
Jump_Opcode[21] = BNEL;
|
||||
Jump_Opcode[22] = BLEZL;
|
||||
|
@ -1908,7 +1936,6 @@ void R4300iOp::COP1_CT()
|
|||
case 2: *_RoundingModel = FE_UPWARD; break;
|
||||
case 3: *_RoundingModel = FE_DOWNWARD; break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -225,6 +225,8 @@ protected:
|
|||
static void COP0();
|
||||
static void COP0_CO();
|
||||
static void COP1();
|
||||
static void COP2();
|
||||
static void COP3();
|
||||
static void COP1_BC();
|
||||
static void COP1_S();
|
||||
static void COP1_D();
|
||||
|
|
|
@ -407,6 +407,14 @@ void R4300iInstruction::DecodeName(void)
|
|||
case R4300i_CP1:
|
||||
DecodeCop1Name();
|
||||
break;
|
||||
case R4300i_CP2:
|
||||
strcpy(m_Name, "Reserved(CP2)");
|
||||
sprintf(m_Param, "");
|
||||
break;
|
||||
case R4300i_CP3:
|
||||
strcpy(m_Name, "Reserved(CP3)");
|
||||
sprintf(m_Param, "");
|
||||
break;
|
||||
case R4300i_BEQL:
|
||||
if (m_Instruction.rs == m_Instruction.rt)
|
||||
{
|
||||
|
|
|
@ -79,6 +79,8 @@ enum R4300iOpCodes
|
|||
R4300i_LUI = 15,
|
||||
R4300i_CP0 = 16,
|
||||
R4300i_CP1 = 17,
|
||||
R4300i_CP2 = 18,
|
||||
R4300i_CP3 = 19,
|
||||
R4300i_BEQL = 20,
|
||||
R4300i_BNEL = 21,
|
||||
R4300i_BLEZL = 22,
|
||||
|
|
|
@ -625,6 +625,14 @@ void CRegisters::DoCopUnusableException(bool DelaySlot, int32_t Coprocessor)
|
|||
{
|
||||
CAUSE_REGISTER |= 0x10000000;
|
||||
}
|
||||
else if (Coprocessor == 2)
|
||||
{
|
||||
CAUSE_REGISTER |= 0x20000000;
|
||||
}
|
||||
else if (Coprocessor == 3)
|
||||
{
|
||||
CAUSE_REGISTER |= 0x30000000;
|
||||
}
|
||||
if (DelaySlot)
|
||||
{
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
|
|
|
@ -101,6 +101,8 @@ enum
|
|||
STATUS_FR = 0x04000000,
|
||||
STATUS_CU0 = 0x10000000,
|
||||
STATUS_CU1 = 0x20000000,
|
||||
STATUS_CU2 = 0x40000000,
|
||||
STATUS_CU3 = 0x80000000,
|
||||
|
||||
// Cause flags
|
||||
CAUSE_EXC_CODE = 0xFF,
|
||||
|
|
Loading…
Reference in New Issue