15#define GPR_OFFSET(regname) (LLVM_EXTENSION offsetof(GPR, regname))
18#define FPR_OFFSET(regname) \
19 (LLVM_EXTENSION offsetof(UserArea, fpr) + \
20 LLVM_EXTENSION offsetof(FPR, fxsave) + \
21 LLVM_EXTENSION offsetof(FXSAVE, regname))
25#define YMM_OFFSET(reg_index) \
26 (LLVM_EXTENSION offsetof(UserArea, fpr) + \
27 LLVM_EXTENSION offsetof(FPR, xsave) + \
28 LLVM_EXTENSION offsetof(XSAVE, ymmh[0]) + (32 * reg_index))
31#define GDB_REMOTE_OFFSET 128
33#define BNDR_OFFSET(reg_index) \
34 (LLVM_EXTENSION offsetof(UserArea, fpr) + \
35 LLVM_EXTENSION offsetof(FPR, xsave) + \
36 LLVM_EXTENSION offsetof(XSAVE, mpxr[reg_index]) + GDB_REMOTE_OFFSET)
38#define BNDC_OFFSET(reg_index) \
39 (LLVM_EXTENSION offsetof(UserArea, fpr) + \
40 LLVM_EXTENSION offsetof(FPR, xsave) + \
41 LLVM_EXTENSION offsetof(XSAVE, mpxc[reg_index]) + GDB_REMOTE_OFFSET)
43#ifdef DECLARE_REGISTER_INFOS_X86_64_STRUCT
46#define FPR_SIZE(reg) sizeof(((FXSAVE *)nullptr)->reg)
49#define FP_SIZE sizeof(((MMSReg *)nullptr)->bytes)
52#define XMM_SIZE sizeof(XMMReg)
55#define YMM_SIZE sizeof(YMMReg)
58#define BNDR_SIZE sizeof(MPXReg)
59#define BNDC_SIZE sizeof(MPXCsr)
61#define DR_SIZE sizeof(((DBG *)nullptr)->dr[0])
66#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \
68 #reg, alt, sizeof(((GPR *)nullptr)->reg), GPR_OFFSET(reg), eEncodingUint, \
70 {kind1, kind2, kind3, kind4, x86_64_with_base::lldb_##reg}, nullptr, \
74#define DEFINE_FPR(name, reg, kind1, kind2, kind3, kind4) \
76 #name, nullptr, FPR_SIZE(reg), FPR_OFFSET(reg), eEncodingUint, eFormatHex, \
77 {kind1, kind2, kind3, kind4, x86_64_with_base::lldb_##name}, nullptr, \
81#define DEFINE_FP_ST(reg, i) \
83 #reg #i, nullptr, FP_SIZE, LLVM_EXTENSION FPR_OFFSET(stmm[i]), \
84 eEncodingVector, eFormatVectorOfUInt8, \
85 {dwarf_st##i##_x86_64, dwarf_st##i##_x86_64, LLDB_INVALID_REGNUM, \
86 LLDB_INVALID_REGNUM, x86_64_with_base::lldb_st##i}, \
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##_x86_64, dwarf_mm##i##_x86_64, LLDB_INVALID_REGNUM, \
95 LLDB_INVALID_REGNUM, x86_64_with_base::lldb_mm##i}, \
96 RegisterInfos_x86_64_with_base_shared::g_contained_##streg##_64, \
97 RegisterInfos_x86_64_with_base_shared::g_invalidate_##streg##_64, \
101#define DEFINE_XMM(reg, i) \
103 #reg #i, nullptr, XMM_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]), \
104 eEncodingVector, eFormatVectorOfUInt8, \
105 {dwarf_##reg##i##_x86_64, dwarf_##reg##i##_x86_64, \
106 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
107 x86_64_with_base::lldb_##reg##i}, \
108 nullptr, nullptr, nullptr, \
111#define DEFINE_YMM(reg, i) \
113 #reg #i, nullptr, YMM_SIZE, LLVM_EXTENSION YMM_OFFSET(i), eEncodingVector, \
114 eFormatVectorOfUInt8, \
115 {dwarf_##reg##i##h_x86_64, dwarf_##reg##i##h_x86_64, \
116 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
117 x86_64_with_base::lldb_##reg##i}, \
118 nullptr, nullptr, nullptr, \
121#define DEFINE_BNDR(reg, i) \
123 #reg #i, nullptr, BNDR_SIZE, LLVM_EXTENSION BNDR_OFFSET(i), \
124 eEncodingVector, eFormatVectorOfUInt64, \
125 {dwarf_##reg##i##_x86_64, dwarf_##reg##i##_x86_64, \
126 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
127 x86_64_with_base::lldb_##reg##i}, \
128 nullptr, nullptr, nullptr, \
131#define DEFINE_BNDC(name, i) \
133 #name, nullptr, BNDC_SIZE, LLVM_EXTENSION BNDC_OFFSET(i), eEncodingVector, \
134 eFormatVectorOfUInt8, \
135 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
136 LLDB_INVALID_REGNUM, x86_64_with_base::lldb_##name}, \
137 nullptr, nullptr, nullptr, \
140#define DEFINE_DR(reg, i) \
142 #reg #i, nullptr, DR_SIZE, DR_OFFSET(i), eEncodingUint, eFormatHex, \
143 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
144 LLDB_INVALID_REGNUM, x86_64_with_base::lldb_##reg##i}, \
145 nullptr, nullptr, nullptr, \
148#define DEFINE_GPR_PSEUDO_32(reg32, reg64) \
150 #reg32, nullptr, 4, GPR_OFFSET(reg64), eEncodingUint, eFormatHex, \
151 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
152 LLDB_INVALID_REGNUM, x86_64_with_base::lldb_##reg32}, \
153 RegisterInfos_x86_64_with_base_shared::g_contained_##reg64, \
154 RegisterInfos_x86_64_with_base_shared::g_invalidate_##reg64, nullptr, \
157#define DEFINE_GPR_PSEUDO_16(reg16, reg64) \
159 #reg16, nullptr, 2, GPR_OFFSET(reg64), eEncodingUint, eFormatHex, \
160 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
161 LLDB_INVALID_REGNUM, x86_64_with_base::lldb_##reg16}, \
162 RegisterInfos_x86_64_with_base_shared::g_contained_##reg64, \
163 RegisterInfos_x86_64_with_base_shared::g_invalidate_##reg64, nullptr, \
166#define DEFINE_GPR_PSEUDO_8H(reg8, reg64) \
168 #reg8, nullptr, 1, GPR_OFFSET(reg64) + 1, eEncodingUint, eFormatHex, \
169 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
170 LLDB_INVALID_REGNUM, x86_64_with_base::lldb_##reg8}, \
171 RegisterInfos_x86_64_with_base_shared::g_contained_##reg64, \
172 RegisterInfos_x86_64_with_base_shared::g_invalidate_##reg64, nullptr, \
175#define DEFINE_GPR_PSEUDO_8L(reg8, reg64) \
177 #reg8, nullptr, 1, GPR_OFFSET(reg64), eEncodingUint, eFormatHex, \
178 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
179 LLDB_INVALID_REGNUM, x86_64_with_base::lldb_##reg8}, \
180 RegisterInfos_x86_64_with_base_shared::g_contained_##reg64, \
181 RegisterInfos_x86_64_with_base_shared::g_invalidate_##reg64, nullptr \
184#define DEFINE_FPR_32(name, reg, kind1, kind2, kind3, kind4, reg64) \
186 #name, nullptr, FPR_SIZE(reg), FPR_OFFSET(reg), eEncodingUint, eFormatHex, \
187 {kind1, kind2, kind3, kind4, x86_64_with_base::lldb_##name}, \
188 RegisterInfos_x86_64_with_base_shared::g_contained_##reg64, \
189 RegisterInfos_x86_64_with_base_shared::g_invalidate_##reg64, nullptr, \
193static RegisterInfo g_register_infos_x86_64_with_base[] = {
223 DEFINE_GPR_PSEUDO_32(
eax,
rax), DEFINE_GPR_PSEUDO_32(
ebx,
rbx),
224 DEFINE_GPR_PSEUDO_32(
ecx,
rcx), DEFINE_GPR_PSEUDO_32(
edx,
rdx),
225 DEFINE_GPR_PSEUDO_32(
edi,
rdi), DEFINE_GPR_PSEUDO_32(
esi,
rsi),
226 DEFINE_GPR_PSEUDO_32(
ebp,
rbp), DEFINE_GPR_PSEUDO_32(
esp,
rsp),
227 DEFINE_GPR_PSEUDO_32(r8d,
r8), DEFINE_GPR_PSEUDO_32(r9d,
r9),
228 DEFINE_GPR_PSEUDO_32(r10d,
r10), DEFINE_GPR_PSEUDO_32(r11d,
r11),
229 DEFINE_GPR_PSEUDO_32(r12d,
r12), DEFINE_GPR_PSEUDO_32(r13d,
r13),
230 DEFINE_GPR_PSEUDO_32(r14d,
r14), DEFINE_GPR_PSEUDO_32(r15d,
r15),
231 DEFINE_GPR_PSEUDO_16(ax,
rax), DEFINE_GPR_PSEUDO_16(bx,
rbx),
232 DEFINE_GPR_PSEUDO_16(cx,
rcx), DEFINE_GPR_PSEUDO_16(dx,
rdx),
233 DEFINE_GPR_PSEUDO_16(di,
rdi), DEFINE_GPR_PSEUDO_16(si,
rsi),
234 DEFINE_GPR_PSEUDO_16(bp,
rbp), DEFINE_GPR_PSEUDO_16(
sp,
rsp),
235 DEFINE_GPR_PSEUDO_16(r8w,
r8), DEFINE_GPR_PSEUDO_16(r9w,
r9),
236 DEFINE_GPR_PSEUDO_16(r10w,
r10), DEFINE_GPR_PSEUDO_16(r11w,
r11),
237 DEFINE_GPR_PSEUDO_16(r12w,
r12), DEFINE_GPR_PSEUDO_16(r13w,
r13),
238 DEFINE_GPR_PSEUDO_16(r14w,
r14), DEFINE_GPR_PSEUDO_16(r15w,
r15),
239 DEFINE_GPR_PSEUDO_8H(ah,
rax), DEFINE_GPR_PSEUDO_8H(bh,
rbx),
240 DEFINE_GPR_PSEUDO_8H(ch,
rcx), DEFINE_GPR_PSEUDO_8H(dh,
rdx),
241 DEFINE_GPR_PSEUDO_8L(al,
rax), DEFINE_GPR_PSEUDO_8L(bl,
rbx),
242 DEFINE_GPR_PSEUDO_8L(cl,
rcx), DEFINE_GPR_PSEUDO_8L(dl,
rdx),
243 DEFINE_GPR_PSEUDO_8L(dil,
rdi), DEFINE_GPR_PSEUDO_8L(sil,
rsi),
244 DEFINE_GPR_PSEUDO_8L(bpl,
rbp), DEFINE_GPR_PSEUDO_8L(spl,
rsp),
245 DEFINE_GPR_PSEUDO_8L(r8l,
r8), DEFINE_GPR_PSEUDO_8L(r9l,
r9),
246 DEFINE_GPR_PSEUDO_8L(r10l,
r10), DEFINE_GPR_PSEUDO_8L(r11l,
r11),
247 DEFINE_GPR_PSEUDO_8L(r12l,
r12), DEFINE_GPR_PSEUDO_8L(r13l,
r13),
248 DEFINE_GPR_PSEUDO_8L(r14l,
r14), DEFINE_GPR_PSEUDO_8L(r15l,
r15),
266 DEFINE_FP_ST(st, 0), DEFINE_FP_ST(st, 1), DEFINE_FP_ST(st, 2),
267 DEFINE_FP_ST(st, 3), DEFINE_FP_ST(st, 4), DEFINE_FP_ST(st, 5),
268 DEFINE_FP_ST(st, 6), DEFINE_FP_ST(st, 7),
270 DEFINE_FP_MM(mm, 0, st0), DEFINE_FP_MM(mm, 1, st1),
271 DEFINE_FP_MM(mm, 2, st2), DEFINE_FP_MM(mm, 3, st3),
272 DEFINE_FP_MM(mm, 4, st4), DEFINE_FP_MM(mm, 5, st5),
273 DEFINE_FP_MM(mm, 6, st6), DEFINE_FP_MM(mm, 7, st7),
284 DEFINE_YMM(ymm, 0), DEFINE_YMM(ymm, 1), DEFINE_YMM(ymm, 2),
285 DEFINE_YMM(ymm, 3), DEFINE_YMM(ymm, 4), DEFINE_YMM(ymm, 5),
286 DEFINE_YMM(ymm, 6), DEFINE_YMM(ymm, 7), DEFINE_YMM(ymm, 8),
287 DEFINE_YMM(ymm, 9), DEFINE_YMM(ymm, 10), DEFINE_YMM(ymm, 11),
288 DEFINE_YMM(ymm, 12), DEFINE_YMM(ymm, 13), DEFINE_YMM(ymm, 14),
297 DEFINE_BNDC(bndcfgu, 0),
298 DEFINE_BNDC(bndstatus, 1),
301 DEFINE_DR(dr, 0), DEFINE_DR(dr, 1), DEFINE_DR(dr, 2), DEFINE_DR(dr, 3),
302 DEFINE_DR(dr, 4), DEFINE_DR(dr, 5), DEFINE_DR(dr, 6), DEFINE_DR(dr, 7)};
307 (
sizeof(g_register_infos_x86_64_with_base) /
308 sizeof(g_register_infos_x86_64_with_base[0])) ==
309 x86_64_with_base::k_num_registers,
310 "g_register_infos_x86_64_with_base has wrong number of register infos");
324#undef DEFINE_GPR_PSEUDO_32
325#undef DEFINE_GPR_PSEUDO_16
326#undef DEFINE_GPR_PSEUDO_8H
327#undef DEFINE_GPR_PSEUDO_8L
331#ifdef UPDATE_REGISTER_INFOS_I386_STRUCT_WITH_X86_64_OFFSETS
333#define UPDATE_GPR_INFO(reg, reg64) \
335 g_register_infos[lldb_##reg##_i386].byte_offset = GPR_OFFSET(reg64); \
338#define UPDATE_GPR_INFO_8H(reg, reg64) \
340 g_register_infos[lldb_##reg##_i386].byte_offset = GPR_OFFSET(reg64) + 1; \
343#define UPDATE_FPR_INFO(reg, reg64) \
345 g_register_infos[lldb_##reg##_i386].byte_offset = FPR_OFFSET(reg64); \
348#define UPDATE_FP_INFO(reg, i) \
350 g_register_infos[lldb_##reg##i##_i386].byte_offset = FPR_OFFSET(stmm[i]); \
353#define UPDATE_XMM_INFO(reg, i) \
355 g_register_infos[lldb_##reg##i##_i386].byte_offset = FPR_OFFSET(reg[i]); \
358#define UPDATE_YMM_INFO(reg, i) \
360 g_register_infos[lldb_##reg##i##_i386].byte_offset = YMM_OFFSET(i); \
363#define UPDATE_DR_INFO(reg_index) \
365 g_register_infos[lldb_dr##reg_index##_i386].byte_offset = \
366 DR_OFFSET(reg_index); \
379UPDATE_GPR_INFO(eflags, rflags);
380UPDATE_GPR_INFO(cs, cs);
381UPDATE_GPR_INFO(fs, fs);
382UPDATE_GPR_INFO(gs, gs);
383UPDATE_GPR_INFO(ss, ss);
384UPDATE_GPR_INFO(ds, ds);
385UPDATE_GPR_INFO(es, es);
387UPDATE_GPR_INFO(ax,
rax);
388UPDATE_GPR_INFO(bx,
rbx);
389UPDATE_GPR_INFO(cx,
rcx);
390UPDATE_GPR_INFO(dx,
rdx);
391UPDATE_GPR_INFO(di,
rdi);
392UPDATE_GPR_INFO(si,
rsi);
393UPDATE_GPR_INFO(bp,
rbp);
394UPDATE_GPR_INFO(
sp,
rsp);
395UPDATE_GPR_INFO_8H(ah,
rax);
396UPDATE_GPR_INFO_8H(bh,
rbx);
397UPDATE_GPR_INFO_8H(ch,
rcx);
398UPDATE_GPR_INFO_8H(dh,
rdx);
399UPDATE_GPR_INFO(al,
rax);
400UPDATE_GPR_INFO(bl,
rbx);
401UPDATE_GPR_INFO(cl,
rcx);
402UPDATE_GPR_INFO(dl,
rdx);
404UPDATE_FPR_INFO(fctrl, fctrl);
405UPDATE_FPR_INFO(fstat, fstat);
406UPDATE_FPR_INFO(ftag, ftag);
407UPDATE_FPR_INFO(fop, fop);
408UPDATE_FPR_INFO(fiseg, ptr.i386_.fiseg);
409UPDATE_FPR_INFO(fioff, ptr.i386_.fioff);
410UPDATE_FPR_INFO(fooff, ptr.i386_.fooff);
411UPDATE_FPR_INFO(foseg, ptr.i386_.foseg);
412UPDATE_FPR_INFO(mxcsr, mxcsr);
413UPDATE_FPR_INFO(mxcsrmask, mxcsrmask);
415UPDATE_FP_INFO(st, 0);
416UPDATE_FP_INFO(st, 1);
417UPDATE_FP_INFO(st, 2);
418UPDATE_FP_INFO(st, 3);
419UPDATE_FP_INFO(st, 4);
420UPDATE_FP_INFO(st, 5);
421UPDATE_FP_INFO(st, 6);
422UPDATE_FP_INFO(st, 7);
423UPDATE_FP_INFO(mm, 0);
424UPDATE_FP_INFO(mm, 1);
425UPDATE_FP_INFO(mm, 2);
426UPDATE_FP_INFO(mm, 3);
427UPDATE_FP_INFO(mm, 4);
428UPDATE_FP_INFO(mm, 5);
429UPDATE_FP_INFO(mm, 6);
430UPDATE_FP_INFO(mm, 7);
432UPDATE_XMM_INFO(xmm, 0);
433UPDATE_XMM_INFO(xmm, 1);
434UPDATE_XMM_INFO(xmm, 2);
435UPDATE_XMM_INFO(xmm, 3);
436UPDATE_XMM_INFO(xmm, 4);
437UPDATE_XMM_INFO(xmm, 5);
438UPDATE_XMM_INFO(xmm, 6);
439UPDATE_XMM_INFO(xmm, 7);
441UPDATE_YMM_INFO(ymm, 0);
442UPDATE_YMM_INFO(ymm, 1);
443UPDATE_YMM_INFO(ymm, 2);
444UPDATE_YMM_INFO(ymm, 3);
445UPDATE_YMM_INFO(ymm, 4);
446UPDATE_YMM_INFO(ymm, 5);
447UPDATE_YMM_INFO(ymm, 6);
448UPDATE_YMM_INFO(ymm, 7);
459#undef UPDATE_GPR_INFO
460#undef UPDATE_GPR_INFO_8H
461#undef UPDATE_FPR_INFO
463#undef UPDATE_XMM_INFO
464#undef UPDATE_YMM_INFO
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)
#define LLDB_REGNUM_GENERIC_ARG6
#define LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_ARG4
#define LLDB_REGNUM_GENERIC_ARG3
#define LLDB_REGNUM_GENERIC_ARG1
#define LLDB_REGNUM_GENERIC_FLAGS
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_TP
#define LLDB_REGNUM_GENERIC_ARG2
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_FP
#define LLDB_REGNUM_GENERIC_ARG5