From a2f271c50560da158f363868b887c6e217241124 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 7 Aug 2020 17:05:01 +1000 Subject: [PATCH] CPU: Simplify some exception checks in cop0-3 --- src/core/cpu_core.cpp | 12 ++++++------ src/core/cpu_types.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index 251d8810d..c489fb38e 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -1152,9 +1152,9 @@ void ExecuteInstruction() case InstructionOp::cop2: { - if (InUserMode() && !g_state.cop0_regs.sr.CU2) + if (!g_state.cop0_regs.sr.CE2) { - Log_WarningPrintf("Coprocessor 2 not present in user mode"); + Log_WarningPrintf("Coprocessor 2 not enabled"); RaiseException(Exception::CpU); return; } @@ -1165,9 +1165,9 @@ void ExecuteInstruction() case InstructionOp::lwc2: { - if (InUserMode() && !g_state.cop0_regs.sr.CU2) + if (!g_state.cop0_regs.sr.CE2) { - Log_WarningPrintf("Coprocessor 2 not present in user mode"); + Log_WarningPrintf("Coprocessor 2 not enabled"); RaiseException(Exception::CpU); return; } @@ -1186,9 +1186,9 @@ void ExecuteInstruction() case InstructionOp::swc2: { - if (InUserMode() && !g_state.cop0_regs.sr.CU2) + if (!g_state.cop0_regs.sr.CE2) { - Log_WarningPrintf("Coprocessor 2 not present in user mode"); + Log_WarningPrintf("Coprocessor 2 not enabled"); RaiseException(Exception::CpU); return; } diff --git a/src/core/cpu_types.h b/src/core/cpu_types.h index d5a1ab10f..48ed2f19d 100644 --- a/src/core/cpu_types.h +++ b/src/core/cpu_types.h @@ -332,9 +332,9 @@ struct Cop0Registers BitField BEV; // boot exception vectors, 0 = KSEG0, 1 = KSEG1 BitField RE; // reverse endianness in user mode BitField CU0; // coprocessor 0 enable in user mode - BitField CU1; // coprocessor 1 enable in user mode - BitField CU2; // coprocessor 2 enable in user mode - BitField CU3; // coprocessor 3 enable in user mode + BitField CE1; // coprocessor 1 enable + BitField CE2; // coprocessor 2 enable + BitField CE3; // coprocessor 3 enable BitField mode_bits; BitField coprocessor_enable_mask;