aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Decoders/OpCode64.cs
blob: b2dc363b8b627793c85cabdb87aaf260193a1087 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using ChocolArm64.Instructions;
using ChocolArm64.State;
using System;

namespace ChocolArm64.Decoders
{
    class OpCode64 : IOpCode64
    {
        public long Position  { get; private set; }
        public int  RawOpCode { get; private set; }

        public InstEmitter     Emitter      { get; protected set; }
        public InstInterpreter Interpreter  { get; protected set; }
        public RegisterSize    RegisterSize { get; protected set; }

        public OpCode64(Inst inst, long position, int opCode)
        {
            Position  = position;
            RawOpCode = opCode;

            RegisterSize = RegisterSize.Int64;

            Emitter     = inst.Emitter;
            Interpreter = inst.Interpreter;
        }

        public int GetBitsCount()
        {
            switch (RegisterSize)
            {
                case RegisterSize.Int32:   return 32;
                case RegisterSize.Int64:   return 64;
                case RegisterSize.Simd64:  return 64;
                case RegisterSize.Simd128: return 128;
            }

            throw new InvalidOperationException();
        }
    }
}