-
Notifications
You must be signed in to change notification settings - Fork 15
/
asm_regs_dbx.h
76 lines (71 loc) · 2.35 KB
/
asm_regs_dbx.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
class eflags
{
dd& _value;
public:
eflags(uint32_t& flags): _value((dd&)flags)
{}
dd getvalue() const noexcept
{ return _value; }
void setvalue(dd v) noexcept
{ _value=v; }
#define REGDEF_flags(Z) \
inline bool set##Z##F(bool i) noexcept {return (reinterpret_cast<flagsUnion*>(&_value)->bits._##Z##F=i);} \
inline bool get##Z##F() const noexcept {return reinterpret_cast<flagsUnion*>(&_value)->bits._##Z##F;}
inline void reset(){_value=0;}
REGDEF_flags(C)
REGDEF_flags(P)
REGDEF_flags(A)
REGDEF_flags(Z)
REGDEF_flags(S)
REGDEF_flags(T)
REGDEF_flags(I)
REGDEF_flags(D)
REGDEF_flags(O)
};
// #define m2cflags cpu_regs.flags
#define X86_REGREF \
db& al = cpu_regs.regs[REGI_AX].byte[BL_INDEX]; \
db& ah = cpu_regs.regs[REGI_AX].byte[BH_INDEX]; \
dw& ax = cpu_regs.regs[REGI_AX].word[W_INDEX]; \
dd& eax = *(dd*)&cpu_regs.regs[REGI_AX].dword[DW_INDEX]; \
\
db& bl = cpu_regs.regs[REGI_BX].byte[BL_INDEX]; \
db& bh = cpu_regs.regs[REGI_BX].byte[BH_INDEX]; \
dw& bx = cpu_regs.regs[REGI_BX].word[W_INDEX]; \
dd& ebx = *(dd*)&cpu_regs.regs[REGI_BX].dword[DW_INDEX]; \
\
db& cl = cpu_regs.regs[REGI_CX].byte[BL_INDEX]; \
db& ch = cpu_regs.regs[REGI_CX].byte[BH_INDEX]; \
dw& cx = cpu_regs.regs[REGI_CX].word[W_INDEX]; \
dd& ecx = *(dd*)&cpu_regs.regs[REGI_CX].dword[DW_INDEX]; \
\
db& dl = cpu_regs.regs[REGI_DX].byte[BL_INDEX]; \
db& dh = cpu_regs.regs[REGI_DX].byte[BH_INDEX]; \
dw& dx = cpu_regs.regs[REGI_DX].word[W_INDEX]; \
dd& edx = *(dd*)&cpu_regs.regs[REGI_DX].dword[DW_INDEX]; \
\
dw& si = cpu_regs.regs[REGI_SI].word[W_INDEX]; \
dd& esi = *(dd*)&cpu_regs.regs[REGI_SI].dword[DW_INDEX]; \
\
dw& di = cpu_regs.regs[REGI_DI].word[W_INDEX]; \
dd& edi = *(dd*)&cpu_regs.regs[REGI_DI].dword[DW_INDEX]; \
\
dw& sp = cpu_regs.regs[REGI_SP].word[W_INDEX]; \
dd& esp = *(dd*)&cpu_regs.regs[REGI_SP].dword[DW_INDEX]; \
\
dw& bp = cpu_regs.regs[REGI_BP].word[W_INDEX]; \
dd& ebp = *(dd*)&cpu_regs.regs[REGI_BP].dword[DW_INDEX]; \
\
dw& ip = cpu_regs.ip.word[W_INDEX]; \
dd& eip = *(dd*)&cpu_regs.ip.dword[DW_INDEX]; \
dw& cs = Segs.val[SegNames::cs]; \
dw& ds = Segs.val[SegNames::ds]; \
dw& es = Segs.val[SegNames::es]; \
dw& fs = Segs.val[SegNames::fs]; \
dw& gs = Segs.val[SegNames::gs]; \
dw& ss = Segs.val[SegNames::ss]; \
\
m2c::eflags m2cflags(cpu_regs.flags); \
dd& stackPointer = esp;\
m2c::_offsets __disp; \
dd _source;