Emit undefined instruction on invalid coprocessor

...rather than throwing.
This commit is contained in:
riperiperi 2020-03-03 00:46:20 +00:00
parent 679509e698
commit ad05af16c8

View file

@ -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));
}
}
}