InstEmitException32.cs 1.1 KB

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