summaryrefslogtreecommitdiff
path: root/src/ExecutorCases.h
blob: bbcd8ae33c4517ac04767b1464e4c24d7cc457b6 (plain)
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
#pragma once

#include <cstdint>
#include <memory>
#include <array>

struct CPUContext;

typedef void (*ExecutorCase)(CPUContext&);

enum OperandEncoding : uint8_t {
  ZO   =   0b00000000,
  RM   =   0b00000001,
  MR   =   0b00000010,
  MI   =   0b00000100,
  OI   =   0b00001000,
  I32  =   0b00100000,
  I16  =   0b01000000,
  I8   =   0b10000000,
};

struct InstructionEntry {
  ExecutorCase m_Executor;
  OperandEncoding m_Encoding;
};

const std::array<InstructionEntry, 256>& GetInstructionTable();

const std::array<ExecutorCase, 256>& GetExecutorTable();

namespace executor_cases::helpers {
  uint32_t ResolveModRMAddress(CPUContext& cc);
}