InstEmitException32.cs 972 B

123456789101112131415161718192021222324252627282930313233343536
  1. using ARMeilleure.Decoders;
  2. using ARMeilleure.Translation;
  3. using static ARMeilleure.IntermediateRepresentation.OperandHelper;
  4. namespace ARMeilleure.Instructions
  5. {
  6. static partial class InstEmit32
  7. {
  8. public static void Svc(ArmEmitterContext context)
  9. {
  10. EmitExceptionCall(context, NativeInterface.SupervisorCall);
  11. }
  12. public static void Trap(ArmEmitterContext context)
  13. {
  14. EmitExceptionCall(context, NativeInterface.Break);
  15. }
  16. private static void EmitExceptionCall(ArmEmitterContext context, _Void_U64_S32 func)
  17. {
  18. OpCode32Exception op = (OpCode32Exception)context.CurrOp;
  19. context.StoreToContext();
  20. context.Call(func, Const(op.Address), Const(op.Id));
  21. context.LoadFromContext();
  22. if (context.CurrBlock.Next == null)
  23. {
  24. context.Return(Const(op.Address + 4));
  25. }
  26. }
  27. }
  28. }