InstEmitException32.cs
1 using ARMeilleure.Decoders; 2 using ARMeilleure.Translation; 3 using static ARMeilleure.IntermediateRepresentation.Operand.Factory; 4 5 namespace ARMeilleure.Instructions 6 { 7 static partial class InstEmit32 8 { 9 public static void Svc(ArmEmitterContext context) 10 { 11 IOpCode32Exception op = (IOpCode32Exception)context.CurrOp; 12 13 string name = nameof(NativeInterface.SupervisorCall); 14 15 context.StoreToContext(); 16 17 context.Call(typeof(NativeInterface).GetMethod(name), Const(((IOpCode)op).Address), Const(op.Id)); 18 19 context.LoadFromContext(); 20 21 Translator.EmitSynchronization(context); 22 } 23 24 public static void Trap(ArmEmitterContext context) 25 { 26 IOpCode32Exception op = (IOpCode32Exception)context.CurrOp; 27 28 string name = nameof(NativeInterface.Break); 29 30 context.StoreToContext(); 31 32 context.Call(typeof(NativeInterface).GetMethod(name), Const(((IOpCode)op).Address), Const(op.Id)); 33 34 context.LoadFromContext(); 35 36 context.Return(Const(context.CurrOp.Address)); 37 } 38 } 39 }