CPU: Don't panic on invalid instructions

This commit is contained in:
Connor McLaughlin 2021-06-15 22:58:29 +10:00
parent 2548f75267
commit 4f09d61825
3 changed files with 12 additions and 8 deletions

View file

@ -1421,7 +1421,7 @@ restart_instruction:
break;
default:
Panic("Missing implementation");
Log_ErrorPrintf("Unhandled instruction at %08X: %08X", g_state.current_instruction_pc, inst.bits);
break;
}
}
@ -1438,8 +1438,15 @@ restart_instruction:
}
break;
case Cop0Instruction::tlbr:
case Cop0Instruction::tlbwi:
case Cop0Instruction::tlbwr:
case Cop0Instruction::tlbp:
RaiseException(Exception::RI);
break;
default:
Panic("Missing implementation");
Log_ErrorPrintf("Unhandled instruction at %08X: %08X", g_state.current_instruction_pc, inst.bits);
break;
}
}
@ -1500,9 +1507,8 @@ restart_instruction:
}
break;
case CopCommonInstruction::bcnc:
default:
Panic("Missing implementation");
Log_ErrorPrintf("Unhandled instruction at %08X: %08X", g_state.current_instruction_pc, inst.bits);
break;
}
}

View file

@ -158,12 +158,11 @@ static const std::array<const char*, 64> s_special_table = {{
"UNKNOWN" // 63
}};
static const std::array<std::pair<CopCommonInstruction, const char*>, 5> s_cop_common_table = {
static const std::array<std::pair<CopCommonInstruction, const char*>, 4> s_cop_common_table = {
{{CopCommonInstruction::mfcn, "mfc$cop $rt, $coprd"},
{CopCommonInstruction::cfcn, "cfc$cop $rt, $coprd"},
{CopCommonInstruction::mtcn, "mtc$cop $rt, $coprd"},
{CopCommonInstruction::ctcn, "ctc$cop $rt, $coprd"},
{CopCommonInstruction::bcnc, "bc$cop$copcc $rel"}}};
{CopCommonInstruction::ctcn, "ctc$cop $rt, $coprd"}}};
static const std::array<std::pair<Cop0Instruction, const char*>, 1> s_cop0_table = {{{Cop0Instruction::rfe, "rfe"}}};

View file

@ -154,7 +154,6 @@ enum class CopCommonInstruction : u32
cfcn = 0b0010,
mtcn = 0b0100,
ctcn = 0b0110,
bcnc = 0b1000,
};
enum class Cop0Instruction : u32