InstEmitException.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using ARMeilleure.Decoders;
  2. using ARMeilleure.Translation;
  3. using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
  4. namespace ARMeilleure.Instructions
  5. {
  6. static partial class InstEmit
  7. {
  8. public static void Brk(ArmEmitterContext context)
  9. {
  10. OpCodeException op = (OpCodeException)context.CurrOp;
  11. string name = nameof(NativeInterface.Break);
  12. context.StoreToContext();
  13. context.Call(typeof(NativeInterface).GetMethod(name), Const(op.Address), Const(op.Id));
  14. context.LoadFromContext();
  15. context.Return(Const(op.Address));
  16. }
  17. public static void Svc(ArmEmitterContext context)
  18. {
  19. OpCodeException op = (OpCodeException)context.CurrOp;
  20. string name = nameof(NativeInterface.SupervisorCall);
  21. context.StoreToContext();
  22. context.Call(typeof(NativeInterface).GetMethod(name), Const(op.Address), Const(op.Id));
  23. context.LoadFromContext();
  24. Translator.EmitSynchronization(context);
  25. }
  26. public static void Und(ArmEmitterContext context)
  27. {
  28. OpCode op = context.CurrOp;
  29. string name = nameof(NativeInterface.Undefined);
  30. context.StoreToContext();
  31. context.Call(typeof(NativeInterface).GetMethod(name), Const(op.Address), Const(op.RawOpCode));
  32. context.LoadFromContext();
  33. context.Return(Const(op.Address));
  34. }
  35. }
  36. }