OpCode64.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using ChocolArm64.Instructions;
  2. using ChocolArm64.State;
  3. using System;
  4. namespace ChocolArm64.Decoders
  5. {
  6. class OpCode64 : IOpCode64
  7. {
  8. public long Position { get; private set; }
  9. public int RawOpCode { get; private set; }
  10. public int OpCodeSizeInBytes { get; protected set; } = 4;
  11. public InstEmitter Emitter { get; protected set; }
  12. public RegisterSize RegisterSize { get; protected set; }
  13. public OpCode64(Inst inst, long position, int opCode)
  14. {
  15. Position = position;
  16. RawOpCode = opCode;
  17. RegisterSize = RegisterSize.Int64;
  18. Emitter = inst.Emitter;
  19. }
  20. public int GetBitsCount()
  21. {
  22. switch (RegisterSize)
  23. {
  24. case RegisterSize.Int32: return 32;
  25. case RegisterSize.Int64: return 64;
  26. case RegisterSize.Simd64: return 64;
  27. case RegisterSize.Simd128: return 128;
  28. }
  29. throw new InvalidOperationException();
  30. }
  31. }
  32. }