InstEmitException32.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using ARMeilleure.Decoders;
  2. using ARMeilleure.Translation;
  3. using static ARMeilleure.Instructions.InstEmitFlowHelper;
  4. using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
  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. string name = nameof(NativeInterface.SupervisorCall);
  13. context.StoreToContext();
  14. context.Call(typeof(NativeInterface).GetMethod(name), Const(((IOpCode)op).Address), Const(op.Id));
  15. context.LoadFromContext();
  16. Translator.EmitSynchronization(context);
  17. }
  18. public static void Trap(ArmEmitterContext context)
  19. {
  20. IOpCode32Exception op = (IOpCode32Exception)context.CurrOp;
  21. string name = nameof(NativeInterface.Break);
  22. context.StoreToContext();
  23. context.Call(typeof(NativeInterface).GetMethod(name), Const(((IOpCode)op).Address), Const(op.Id));
  24. context.LoadFromContext();
  25. context.Return(Const(context.CurrOp.Address));
  26. }
  27. }
  28. }