InstEmitException32.cs 942 B

1234567891011121314151617181920212223242526272829303132
  1. using ARMeilleure.Decoders;
  2. using ARMeilleure.Translation;
  3. using static ARMeilleure.Instructions.InstEmitFlowHelper;
  4. using static ARMeilleure.IntermediateRepresentation.OperandHelper;
  5. namespace ARMeilleure.Instructions
  6. {
  7. static partial class InstEmit32
  8. {
  9. public static void Svc(ArmEmitterContext context)
  10. {
  11. EmitExceptionCall(context, nameof(NativeInterface.SupervisorCall));
  12. }
  13. public static void Trap(ArmEmitterContext context)
  14. {
  15. EmitExceptionCall(context, nameof(NativeInterface.Break));
  16. }
  17. private static void EmitExceptionCall(ArmEmitterContext context, string name)
  18. {
  19. OpCode32Exception op = (OpCode32Exception)context.CurrOp;
  20. context.StoreToContext();
  21. context.Call(typeof(NativeInterface).GetMethod(name), Const(op.Address), Const(op.Id));
  22. context.LoadFromContext();
  23. }
  24. }
  25. }