From ad05af16c86345cd7a16c5b3d0513411030502b0 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Tue, 3 Mar 2020 00:46:20 +0000 Subject: [PATCH] Emit undefined instruction on invalid coprocessor ...rather than throwing. --- ARMeilleure/Instructions/InstEmitSystem32.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ARMeilleure/Instructions/InstEmitSystem32.cs b/ARMeilleure/Instructions/InstEmitSystem32.cs index 808b4fdd7a..45783c3163 100644 --- a/ARMeilleure/Instructions/InstEmitSystem32.cs +++ b/ARMeilleure/Instructions/InstEmitSystem32.cs @@ -17,7 +17,8 @@ namespace ARMeilleure.Instructions if (op.Coproc != 15) { - throw new NotImplementedException($"Unknown MRC Coprocessor ID 0x{op.Coproc:X16} at 0x{op.Address:X16}."); + EmitUndefined(context); + return; } if (op.Opc1 != 0) @@ -70,7 +71,8 @@ namespace ARMeilleure.Instructions if (op.Coproc != 15) { - throw new NotImplementedException($"Unknown MRC Coprocessor ID 0x{op.Coproc:X16} at 0x{op.Address:X16}."); + EmitUndefined(context); + return; } if (op.Opc1 != 0) @@ -119,7 +121,8 @@ namespace ARMeilleure.Instructions if (op.Coproc != 15) { - throw new NotImplementedException($"Unknown MRC Coprocessor ID 0x{op.Coproc:X16} at 0x{op.Address:X16}."); + EmitUndefined(context); + return; } var opc = op.MrrcOp; @@ -229,5 +232,11 @@ namespace ARMeilleure.Instructions SetFlag(context, PState.ZFlag, z); SetFlag(context, PState.NFlag, n); } + + private static void EmitUndefined(ArmEmitterContext context) + { + OpCode32 op = (OpCode32)context.CurrOp; + context.Call(new _Void_U64_S32(NativeInterface.Undefined), Const(op.Address), Const(op.RawOpCode)); + } } }