2018-02-05 00:08:20 +01:00
|
|
|
using ChocolArm64.Instruction;
|
|
|
|
using ChocolArm64.State;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace ChocolArm64.Decoder
|
|
|
|
{
|
|
|
|
class AOpCode : IAOpCode
|
|
|
|
{
|
2018-02-10 18:20:46 +01:00
|
|
|
public long Position { get; private set; }
|
|
|
|
public int RawOpCode { get; private set; }
|
2018-02-05 00:08:20 +01:00
|
|
|
|
2018-05-26 22:49:21 +02:00
|
|
|
public AInstEmitter Emitter { get; protected set; }
|
|
|
|
public AInstInterpreter Interpreter { get; protected set; }
|
|
|
|
public ARegisterSize RegisterSize { get; protected set; }
|
2018-02-05 00:08:20 +01:00
|
|
|
|
2018-02-10 18:20:46 +01:00
|
|
|
public AOpCode(AInst Inst, long Position, int OpCode)
|
2018-02-05 00:08:20 +01:00
|
|
|
{
|
2018-02-10 18:20:46 +01:00
|
|
|
this.Position = Position;
|
|
|
|
this.RawOpCode = OpCode;
|
2018-02-05 00:08:20 +01:00
|
|
|
|
|
|
|
RegisterSize = ARegisterSize.Int64;
|
|
|
|
|
2018-05-26 22:49:21 +02:00
|
|
|
Emitter = Inst.Emitter;
|
|
|
|
Interpreter = Inst.Interpreter;
|
2018-02-05 00:08:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int GetBitsCount()
|
|
|
|
{
|
|
|
|
switch (RegisterSize)
|
|
|
|
{
|
|
|
|
case ARegisterSize.Int32: return 32;
|
|
|
|
case ARegisterSize.Int64: return 64;
|
|
|
|
case ARegisterSize.SIMD64: return 64;
|
|
|
|
case ARegisterSize.SIMD128: return 128;
|
|
|
|
}
|
|
|
|
|
|
|
|
throw new InvalidOperationException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|