CPU: Don't raise #RI on write to read-only COP0 registers

Should be silently ignored instead apparently.
This commit is contained in:
Stenzek
2026-01-02 19:57:18 +10:00
parent c015893571
commit 632aa18df0
3 changed files with 10 additions and 10 deletions

View File

@@ -1796,12 +1796,6 @@ restart_instruction:
}
break;
case Cop0Reg::JUMPDEST:
{
WARNING_LOG("Ignoring write to Cop0 JUMPDEST");
}
break;
case Cop0Reg::DCIC:
{
g_state.cop0_regs.dcic.bits = (g_state.cop0_regs.dcic.bits & ~Cop0Registers::DCIC::WRITE_MASK) |
@@ -1834,6 +1828,15 @@ restart_instruction:
}
break;
case Cop0Reg::JUMPDEST:
case Cop0Reg::BadVaddr:
case Cop0Reg::EPC:
{
WARNING_LOG("Ignoring write to COP0 register {} value 0x{:08X}",
GetCop0RegisterName(static_cast<u8>(inst.r.rd.GetValue())), value);
}
break;
[[unlikely]] default:
RaiseException(Exception::RI);
return;

View File

@@ -385,7 +385,7 @@ void CPU::FormatInstruction(SmallStringBase* dest, const Instruction inst, u32 p
}
else if (std::strncmp(str, "cop", 3) == 0)
{
dest->append_format("{}", static_cast<u8>(inst.op.GetValue()) & INSTRUCTION_COP_N_MASK);
dest->append_format("{}", inst.cop.cop_n.GetValue());
str += 3;
}
else

View File

@@ -110,9 +110,6 @@ enum class InstructionOp : u8
swc2 = 58,
swc3 = 59,
};
constexpr u8 INSTRUCTION_COP_BITS = 0x10;
constexpr u8 INSTRUCTION_COP_MASK = 0x3C;
constexpr u8 INSTRUCTION_COP_N_MASK = 0x03;
enum class InstructionFunct : u8
{