-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinstruction.hpp
56 lines (45 loc) · 1.04 KB
/
instruction.hpp
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
// STD
#include <cstdint>
#include <optional>
#include <vector>
// x86
#include "instruction_opcode.hpp"
#include "instruction_rex.hpp"
#include "instruction_operand.hpp"
#include "instruction_prefix.hpp"
namespace x86
{
class instruction
{
public:
bool& opcode_initialised();
bool& operand_initialised();
bool& prefix_initialised();
bool& rex_initialised();
std::uint8_t& size();
std::string name();
x86::opcode& opcode();
x86::operand& operand();
x86::prefix& prefix();
std::optional<x86::rex>& rex();
struct modifier_data_t
{
std::uint8_t mode;
std::uint8_t wide;
std::uint8_t source_register;
std::uint8_t destination_register;
};
modifier_data_t get_modifier(size_t index);
private:
bool m_opcode_init;
bool m_operand_init;
bool m_prefix_init;
bool m_rex_init;
std::uint8_t m_size;
x86::opcode m_opcode; // 1-3 BYTES
x86::operand m_operand; // 0-8 BYTES
x86::prefix m_prefix; // 0-4 BYTES
std::optional<x86::rex> m_rex; // 0-1 BYTES
};
}