InstEmitException32.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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, NativeInterface.SupervisorCall);
  12. }
  13. public static void Trap(ArmEmitterContext context)
  14. {
  15. EmitExceptionCall(context, NativeInterface.Break);
  16. }
  17. private static void EmitExceptionCall(ArmEmitterContext context, _Void_U64_S32 func)
  18. {
  19. OpCode32Exception op = (OpCode32Exception)context.CurrOp;
  20. context.StoreToContext();
  21. context.Call(func, Const(op.Address), Const(op.Id));
  22. context.LoadFromContext();
  23. if (context.CurrBlock.Next == null)
  24. {
  25. EmitTailContinue(context, Const(op.Address + 4));
  26. }
  27. }
  28. }
  29. }