diff --git a/src/backend/core/interpreter/cop0instructions.cpp b/src/backend/core/interpreter/cop0instructions.cpp index 1a6ef6e7..484316fb 100644 --- a/src/backend/core/interpreter/cop0instructions.cpp +++ b/src/backend/core/interpreter/cop0instructions.cpp @@ -25,6 +25,10 @@ void Cop0::dmfc0(const Instruction instr) const { void Cop0::eret() { Registers& regs = Core::GetRegs(); + if (!regs.cop0.kernelMode) { + FireException(ExceptionCode::CoprocessorUnusable, 0, regs.oldPC); + return; + } if (status.erl) { regs.SetPC64(ErrorEPC); status.erl = false; @@ -76,12 +80,14 @@ void Cop0::tlbw(const int index_) { void Cop0::tlbp() { int match = -1; - if (const TLBEntry *entry = TLBTryMatch(entryHi.raw, match); match >= 0) { + const TLBEntry *entry = TLBTryMatch(entryHi.raw, match); + if (match >= 0) { index.raw = match; - } else { - index.raw = 0; - index.p = 1; + return; } + + index.raw = 0; + index.p = 1; } } // namespace n64