From 124567fd7189e3909f96f5892aa5f77b8961023f Mon Sep 17 00:00:00 2001 From: Nabile Rahmani Date: Sat, 22 Dec 2018 00:28:05 +0100 Subject: [PATCH] The CPU is in kernel mode when EXL or ERL is on. This would fix the User and Supervisor modes entering an exception and being unable to service it as they have no way to return to Kernel mode. The CPU would get stuck in a coprocessor unusable exception loop servicing or exiting it. See VR4300 user manual #6.4.1, or #6.3.5, Operating Modes. --- .../CPU/VR4300/CP0/VR4300.SystemControlUnit.StatusRegister.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DotN64/CPU/VR4300/CP0/VR4300.SystemControlUnit.StatusRegister.cs b/DotN64/CPU/VR4300/CP0/VR4300.SystemControlUnit.StatusRegister.cs index 7579463..66d63ee 100644 --- a/DotN64/CPU/VR4300/CP0/VR4300.SystemControlUnit.StatusRegister.cs +++ b/DotN64/CPU/VR4300/CP0/VR4300.SystemControlUnit.StatusRegister.cs @@ -61,7 +61,7 @@ namespace DotN64.CPU /// public Mode KSU { - get => (Mode)this[ksu]; + get => (EXL | ERL) ? Mode.Kernel : (Mode)this[ksu]; set => this[ksu] = (int)value; }