Began removal of platform/. The Monitor:: namespace is completely converted.
[aesalon.git] / src / monitor / asm / Register.h
blob3537b883d507519c239b993d0368bbb9339ff6b1
1 #ifndef AESALON_MONITOR_ASM_REGISTER_H
2 #define AESALON_MONITOR_ASM_REGISTER_H
4 #include <cstddef>
5 #include <vector>
6 #include <string>
8 namespace Aesalon {
9 namespace Monitor {
10 namespace ASM {
12 class Register {
13 public:
14 enum register_e {
15 INVALID = 0,
16 #if AESALON_PLATFORM == AESALON_PLATFORM_x86 || AESALON_PLATFORM == AESALON_PLATFORM_x86_64
17 AL,
18 AH,
19 BL,
20 BH,
21 CL,
22 CH,
23 DL,
24 DH,
25 AX,
26 BX,
27 CX,
28 DX,
29 EAX,
30 EBX,
31 ECX,
32 EDX,
33 ESI,
34 EDI,
35 ESP,
36 EBP,
37 EIP,
38 #if AESALON_PLATFORM == AESALON_PLATFORM_x86_64
39 RAX,
40 RBX,
41 RCX,
42 RDX,
43 R8,
44 R9,
45 R10,
46 R11,
47 R12,
48 R13,
49 R14,
50 R15,
51 RSI,
52 RDI,
53 RSP,
54 RBP,
55 RIP,
56 #endif
57 CS,
59 #endif
62 enum data_size_e {
63 SIZE_BYTE,
64 SIZE_WORD,
65 SIZE_DWORD,
66 SIZE_QWORD
69 private:
70 register_e reg;
71 public:
72 Register(register_e reg = INVALID) : reg(reg) {}
73 virtual ~Register() {}
75 operator register_e() const {
76 return reg;
79 bool operator==(const Register &other) const {
80 return other.reg == reg;
82 bool operator==(const register_e &other) const {
83 return other == reg;
85 bool operator!=(const Register &other) const {
86 return other.reg != reg;
88 bool operator!=(const register_e &other) const {
89 return other != reg;
92 register_e operator=(const Register &other) {
93 return (reg = other.reg);
95 data_size_e get_register_size() const;
97 static Register from_string(std::string string);
100 } // namespace ASM
101 } // namespace Monitor
102 } // namespace Aesalon
104 #endif