9#include "llvm/Support/Compiler.h"
14#ifdef DECLARE_REGISTER_INFOS_I386_STRUCT
17#define GPR_OFFSET(regname) (LLVM_EXTENSION offsetof(GPR, regname))
20#define FPR_OFFSET(regname) \
21 (LLVM_EXTENSION offsetof(UserArea, i387) + \
22 LLVM_EXTENSION offsetof(FPR_i386, regname))
26#define YMM_OFFSET(reg_index) \
27 (LLVM_EXTENSION offsetof(UserArea, i387) + \
28 LLVM_EXTENSION offsetof(FPR, fxsave) + \
29 LLVM_EXTENSION offsetof(FXSAVE, xmm[7]) + sizeof(XMMReg) + \
32#define BNDR_OFFSET(reg_index) \
33 (LLVM_EXTENSION offsetof(UserArea, i387) + \
34 LLVM_EXTENSION offsetof(FPR, xsave) + \
35 LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]))
37#define BNDC_OFFSET(reg_index) \
38 (LLVM_EXTENSION offsetof(UserArea, i387) + \
39 LLVM_EXTENSION offsetof(FPR, xsave) + \
40 LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]))
44#define FPR_SIZE(reg) sizeof(((FXSAVE *)nullptr)->reg)
48#define FP_SIZE sizeof(((MMSReg *)nullptr)->bytes)
51#define XMM_SIZE sizeof(XMMReg)
54#define YMM_SIZE sizeof(YMMReg)
57#define BNDR_SIZE sizeof(MPXReg)
58#define BNDC_SIZE sizeof(MPXCsr)
61#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \
63 #reg, alt, sizeof(((GPR *)nullptr)->reg), \
64 GPR_OFFSET(reg), eEncodingUint, eFormatHex, \
65 {kind1, kind2, kind3, kind4, \
66 lldb_##reg##_i386 }, \
67 nullptr, nullptr, nullptr, \
70#define DEFINE_FPR(name, reg, kind1, kind2, kind3, kind4) \
72 #name, nullptr, FPR_SIZE(reg), FPR_OFFSET(reg), eEncodingUint, eFormatHex, \
73 {kind1, kind2, kind3, kind4, \
74 lldb_##name##_i386 }, \
75 nullptr, nullptr, nullptr, \
80#define DEFINE_FP_ST(reg, i) \
82 #reg #i, nullptr, FP_SIZE, \
83 LLVM_EXTENSION FPR_OFFSET( \
84 stmm[i]), eEncodingVector, eFormatVectorOfUInt8, \
85 {ehframe_st##i##_i386, dwarf_st##i##_i386, LLDB_INVALID_REGNUM, \
86 LLDB_INVALID_REGNUM, lldb_st##i##_i386 }, \
87 nullptr, nullptr, nullptr, \
90#define DEFINE_FP_MM(reg, i, streg) \
92 #reg #i, nullptr, sizeof(uint64_t), LLVM_EXTENSION FPR_OFFSET(stmm[i]), \
93 eEncodingUint, eFormatHex, \
94 {dwarf_mm##i##_i386, dwarf_mm##i##_i386, LLDB_INVALID_REGNUM, \
95 LLDB_INVALID_REGNUM, lldb_mm##i##_i386 }, \
96 RegisterContextPOSIX_x86::g_contained_##streg##_32, \
97 RegisterContextPOSIX_x86::g_invalidate_##streg##_32, \
101#define DEFINE_XMM(reg, i) \
103 #reg #i, nullptr, XMM_SIZE, \
104 LLVM_EXTENSION FPR_OFFSET( \
105 reg[i]), eEncodingVector, eFormatVectorOfUInt8, \
106 {ehframe_##reg##i##_i386, dwarf_##reg##i##_i386, \
107 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_##reg##i##_i386 }, \
108 nullptr, nullptr, nullptr, \
113#define DEFINE_YMM(reg, i) \
115 #reg #i, nullptr, YMM_SIZE, \
116 LLVM_EXTENSION YMM_OFFSET(i), eEncodingVector, eFormatVectorOfUInt8, \
117 {LLDB_INVALID_REGNUM, dwarf_xmm##i##_i386, \
118 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
119 lldb_##reg##i##_i386 }, \
120 nullptr, nullptr, nullptr, \
123#define DEFINE_BNDR(reg, i) \
125 #reg #i, nullptr, BNDR_SIZE, \
126 LLVM_EXTENSION BNDR_OFFSET(i), eEncodingVector, eFormatVectorOfUInt64, \
127 {dwarf_##reg##i##_i386, dwarf_##reg##i##_i386, LLDB_INVALID_REGNUM, \
128 LLDB_INVALID_REGNUM, lldb_##reg##i##_i386 }, \
129 nullptr, nullptr, nullptr, \
132#define DEFINE_BNDC(name, i) \
134 #name, nullptr, BNDC_SIZE, \
135 LLVM_EXTENSION BNDC_OFFSET(i), eEncodingVector, \
136 eFormatVectorOfUInt8, \
137 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
138 LLDB_INVALID_REGNUM, lldb_##name##_i386 }, \
139 nullptr, nullptr, nullptr, \
142#define DEFINE_DR(reg, i) \
144 #reg #i, nullptr, DR_SIZE, \
145 DR_OFFSET(i), eEncodingUint, eFormatHex, \
146 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
147 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
148 lldb_##reg##i##_i386 }, \
149 nullptr, nullptr, nullptr, \
152#define DEFINE_GPR_PSEUDO_16(reg16, reg32) \
154 #reg16, nullptr, 2, \
155 GPR_OFFSET(reg32), eEncodingUint, eFormatHex, \
156 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
157 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
158 lldb_##reg16##_i386 }, \
159 RegisterContextPOSIX_x86::g_contained_##reg32, \
160 RegisterContextPOSIX_x86::g_invalidate_##reg32, \
164#define DEFINE_GPR_PSEUDO_8H(reg8, reg32) \
167 GPR_OFFSET(reg32) + 1, eEncodingUint, eFormatHex, \
168 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
169 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
170 lldb_##reg8##_i386 }, \
171 RegisterContextPOSIX_x86::g_contained_##reg32, \
172 RegisterContextPOSIX_x86::g_invalidate_##reg32, \
176#define DEFINE_GPR_PSEUDO_8L(reg8, reg32) \
179 GPR_OFFSET(reg32), eEncodingUint, eFormatHex, \
180 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
181 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
182 lldb_##reg8##_i386 }, \
183 RegisterContextPOSIX_x86::g_contained_##reg32, \
184 RegisterContextPOSIX_x86::g_invalidate_##reg32, \
188static RegisterInfo g_register_infos_i386[] = {
208 DEFINE_GPR(eflags,
"flags", ehframe_eflags_i386, dwarf_eflags_i386,
223 DEFINE_GPR_PSEUDO_16(ax,
eax), DEFINE_GPR_PSEUDO_16(bx,
ebx),
224 DEFINE_GPR_PSEUDO_16(cx,
ecx), DEFINE_GPR_PSEUDO_16(dx,
edx),
225 DEFINE_GPR_PSEUDO_16(di,
edi), DEFINE_GPR_PSEUDO_16(si,
esi),
226 DEFINE_GPR_PSEUDO_16(bp,
ebp), DEFINE_GPR_PSEUDO_16(
sp,
esp),
227 DEFINE_GPR_PSEUDO_8H(ah,
eax), DEFINE_GPR_PSEUDO_8H(bh,
ebx),
228 DEFINE_GPR_PSEUDO_8H(ch,
ecx), DEFINE_GPR_PSEUDO_8H(dh,
edx),
229 DEFINE_GPR_PSEUDO_8L(al,
eax), DEFINE_GPR_PSEUDO_8L(bl,
ebx),
230 DEFINE_GPR_PSEUDO_8L(cl,
ecx), DEFINE_GPR_PSEUDO_8L(dl,
edx),
255 DEFINE_FP_ST(st, 0), DEFINE_FP_ST(st, 1), DEFINE_FP_ST(st, 2),
256 DEFINE_FP_ST(st, 3), DEFINE_FP_ST(st, 4), DEFINE_FP_ST(st, 5),
257 DEFINE_FP_ST(st, 6), DEFINE_FP_ST(st, 7),
259 DEFINE_FP_MM(mm, 0, st0), DEFINE_FP_MM(mm, 1, st1),
260 DEFINE_FP_MM(mm, 2, st2), DEFINE_FP_MM(mm, 3, st3),
261 DEFINE_FP_MM(mm, 4, st4), DEFINE_FP_MM(mm, 5, st5),
262 DEFINE_FP_MM(mm, 6, st6), DEFINE_FP_MM(mm, 7, st7),
270 DEFINE_YMM(ymm, 0), DEFINE_YMM(ymm, 1), DEFINE_YMM(ymm, 2),
271 DEFINE_YMM(ymm, 3), DEFINE_YMM(ymm, 4), DEFINE_YMM(ymm, 5),
272 DEFINE_YMM(ymm, 6), DEFINE_YMM(ymm, 7),
280 DEFINE_BNDC(bndcfgu, 0),
281 DEFINE_BNDC(bndstatus, 1),
284 DEFINE_DR(dr, 0), DEFINE_DR(dr, 1), DEFINE_DR(dr, 2), DEFINE_DR(dr, 3),
285 DEFINE_DR(dr, 4), DEFINE_DR(dr, 5), DEFINE_DR(dr, 6), DEFINE_DR(dr, 7)};
287static_assert((
sizeof(g_register_infos_i386) /
288 sizeof(g_register_infos_i386[0])) == k_num_registers_i386,
289 "g_register_infos_x86_64 has wrong number of register infos");
306#undef DEFINE_GPR_PSEUDO_16
307#undef DEFINE_GPR_PSEUDO_8H
308#undef DEFINE_GPR_PSEUDO_8L
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)
#define LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_FLAGS
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_FP