InstEmitException.cs
1 using ARMeilleure.Decoders; 2 using ARMeilleure.Translation; 3 4 using static ARMeilleure.IntermediateRepresentation.Operand.Factory; 5 6 namespace ARMeilleure.Instructions 7 { 8 static partial class InstEmit 9 { 10 public static void Brk(ArmEmitterContext context) 11 { 12 OpCodeException op = (OpCodeException)context.CurrOp; 13 14 string name = nameof(NativeInterface.Break); 15 16 context.StoreToContext(); 17 18 context.Call(typeof(NativeInterface).GetMethod(name), Const(op.Address), Const(op.Id)); 19 20 context.LoadFromContext(); 21 22 context.Return(Const(op.Address)); 23 } 24 25 public static void Svc(ArmEmitterContext context) 26 { 27 OpCodeException op = (OpCodeException)context.CurrOp; 28 29 string name = nameof(NativeInterface.SupervisorCall); 30 31 context.StoreToContext(); 32 33 context.Call(typeof(NativeInterface).GetMethod(name), Const(op.Address), Const(op.Id)); 34 35 context.LoadFromContext(); 36 37 Translator.EmitSynchronization(context); 38 } 39 40 public static void Und(ArmEmitterContext context) 41 { 42 OpCode op = context.CurrOp; 43 44 string name = nameof(NativeInterface.Undefined); 45 46 context.StoreToContext(); 47 48 context.Call(typeof(NativeInterface).GetMethod(name), Const(op.Address), Const(op.RawOpCode)); 49 50 context.LoadFromContext(); 51 52 context.Return(Const(op.Address)); 53 } 54 } 55 }