1//===-- lldb-x86-register-enums.h -------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_LLDB_X86_REGISTER_ENUMS_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_LLDB_X86_REGISTER_ENUMS_H
11
12namespace lldb_private {
13// LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB)
14
15// Internal codes for all i386 registers.
16enum {
17 k_first_gpr_i386,
18 lldb_eax_i386 = k_first_gpr_i386,
19 lldb_ebx_i386,
20 lldb_ecx_i386,
21 lldb_edx_i386,
22 lldb_edi_i386,
23 lldb_esi_i386,
24 lldb_ebp_i386,
25 lldb_esp_i386,
26 lldb_eip_i386,
27 lldb_eflags_i386,
28 lldb_cs_i386,
29 lldb_fs_i386,
30 lldb_gs_i386,
31 lldb_ss_i386,
32 lldb_ds_i386,
33 lldb_es_i386,
34
35 k_first_alias_i386,
36 lldb_ax_i386 = k_first_alias_i386,
37 lldb_bx_i386,
38 lldb_cx_i386,
39 lldb_dx_i386,
40 lldb_di_i386,
41 lldb_si_i386,
42 lldb_bp_i386,
43 lldb_sp_i386,
44 lldb_ah_i386,
45 lldb_bh_i386,
46 lldb_ch_i386,
47 lldb_dh_i386,
48 lldb_al_i386,
49 lldb_bl_i386,
50 lldb_cl_i386,
51 lldb_dl_i386,
52 k_last_alias_i386 = lldb_dl_i386,
53
54 k_last_gpr_i386 = k_last_alias_i386,
55
56 k_first_fpr_i386,
57 lldb_fctrl_i386 = k_first_fpr_i386,
58 lldb_fstat_i386,
59 lldb_ftag_i386,
60 lldb_fop_i386,
61 lldb_fiseg_i386,
62 lldb_fioff_i386,
63 lldb_foseg_i386,
64 lldb_fooff_i386,
65 lldb_mxcsr_i386,
66 lldb_mxcsrmask_i386,
67 lldb_st0_i386,
68 lldb_st1_i386,
69 lldb_st2_i386,
70 lldb_st3_i386,
71 lldb_st4_i386,
72 lldb_st5_i386,
73 lldb_st6_i386,
74 lldb_st7_i386,
75 lldb_mm0_i386,
76 lldb_mm1_i386,
77 lldb_mm2_i386,
78 lldb_mm3_i386,
79 lldb_mm4_i386,
80 lldb_mm5_i386,
81 lldb_mm6_i386,
82 lldb_mm7_i386,
83 lldb_xmm0_i386,
84 lldb_xmm1_i386,
85 lldb_xmm2_i386,
86 lldb_xmm3_i386,
87 lldb_xmm4_i386,
88 lldb_xmm5_i386,
89 lldb_xmm6_i386,
90 lldb_xmm7_i386,
91 k_last_fpr_i386 = lldb_xmm7_i386,
92
93 k_first_avx_i386,
94 lldb_ymm0_i386 = k_first_avx_i386,
95 lldb_ymm1_i386,
96 lldb_ymm2_i386,
97 lldb_ymm3_i386,
98 lldb_ymm4_i386,
99 lldb_ymm5_i386,
100 lldb_ymm6_i386,
101 lldb_ymm7_i386,
102 k_last_avx_i386 = lldb_ymm7_i386,
103
104 k_first_mpxr_i386,
105 lldb_bnd0_i386 = k_first_mpxr_i386,
106 lldb_bnd1_i386,
107 lldb_bnd2_i386,
108 lldb_bnd3_i386,
109 k_last_mpxr_i386 = lldb_bnd3_i386,
110
111 k_first_mpxc_i386,
112 lldb_bndcfgu_i386 = k_first_mpxc_i386,
113 lldb_bndstatus_i386,
114 k_last_mpxc_i386 = lldb_bndstatus_i386,
115
116 k_first_dbr_i386,
117 lldb_dr0_i386 = k_first_dbr_i386,
118 lldb_dr1_i386,
119 lldb_dr2_i386,
120 lldb_dr3_i386,
121 lldb_dr4_i386,
122 lldb_dr5_i386,
123 lldb_dr6_i386,
124 lldb_dr7_i386,
125 k_last_dbr_i386 = lldb_dr7_i386,
126
127 k_num_registers_i386,
128 k_num_gpr_registers_i386 = k_last_gpr_i386 - k_first_gpr_i386 + 1,
129 k_num_fpr_registers_i386 = k_last_fpr_i386 - k_first_fpr_i386 + 1,
130 k_num_avx_registers_i386 = k_last_avx_i386 - k_first_avx_i386 + 1,
131 k_num_mpx_registers_i386 = k_last_mpxc_i386 - k_first_mpxr_i386 + 1,
132 k_num_user_registers_i386 = k_num_gpr_registers_i386 +
133 k_num_fpr_registers_i386 +
134 k_num_avx_registers_i386 +
135 k_num_mpx_registers_i386,
136 k_num_dbr_registers_i386 = k_last_dbr_i386 - k_first_dbr_i386 + 1,
137};
138
139// Internal codes for all x86_64 registers.
140enum {
141 k_first_gpr_x86_64,
142 lldb_rax_x86_64 = k_first_gpr_x86_64,
143 lldb_rbx_x86_64,
144 lldb_rcx_x86_64,
145 lldb_rdx_x86_64,
146 lldb_rdi_x86_64,
147 lldb_rsi_x86_64,
148 lldb_rbp_x86_64,
149 lldb_rsp_x86_64,
150 lldb_r8_x86_64,
151 lldb_r9_x86_64,
152 lldb_r10_x86_64,
153 lldb_r11_x86_64,
154 lldb_r12_x86_64,
155 lldb_r13_x86_64,
156 lldb_r14_x86_64,
157 lldb_r15_x86_64,
158 lldb_rip_x86_64,
159 lldb_rflags_x86_64,
160 lldb_cs_x86_64,
161 lldb_fs_x86_64,
162 lldb_gs_x86_64,
163 lldb_ss_x86_64,
164 lldb_ds_x86_64,
165 lldb_es_x86_64,
166
167 k_first_alias_x86_64,
168 lldb_eax_x86_64 = k_first_alias_x86_64,
169 lldb_ebx_x86_64,
170 lldb_ecx_x86_64,
171 lldb_edx_x86_64,
172 lldb_edi_x86_64,
173 lldb_esi_x86_64,
174 lldb_ebp_x86_64,
175 lldb_esp_x86_64,
176 lldb_r8d_x86_64, // Low 32 bits of r8
177 lldb_r9d_x86_64, // Low 32 bits of r9
178 lldb_r10d_x86_64, // Low 32 bits of r10
179 lldb_r11d_x86_64, // Low 32 bits of r11
180 lldb_r12d_x86_64, // Low 32 bits of r12
181 lldb_r13d_x86_64, // Low 32 bits of r13
182 lldb_r14d_x86_64, // Low 32 bits of r14
183 lldb_r15d_x86_64, // Low 32 bits of r15
184 lldb_ax_x86_64,
185 lldb_bx_x86_64,
186 lldb_cx_x86_64,
187 lldb_dx_x86_64,
188 lldb_di_x86_64,
189 lldb_si_x86_64,
190 lldb_bp_x86_64,
191 lldb_sp_x86_64,
192 lldb_r8w_x86_64, // Low 16 bits of r8
193 lldb_r9w_x86_64, // Low 16 bits of r9
194 lldb_r10w_x86_64, // Low 16 bits of r10
195 lldb_r11w_x86_64, // Low 16 bits of r11
196 lldb_r12w_x86_64, // Low 16 bits of r12
197 lldb_r13w_x86_64, // Low 16 bits of r13
198 lldb_r14w_x86_64, // Low 16 bits of r14
199 lldb_r15w_x86_64, // Low 16 bits of r15
200 lldb_ah_x86_64,
201 lldb_bh_x86_64,
202 lldb_ch_x86_64,
203 lldb_dh_x86_64,
204 lldb_al_x86_64,
205 lldb_bl_x86_64,
206 lldb_cl_x86_64,
207 lldb_dl_x86_64,
208 lldb_dil_x86_64,
209 lldb_sil_x86_64,
210 lldb_bpl_x86_64,
211 lldb_spl_x86_64,
212 lldb_r8l_x86_64, // Low 8 bits of r8
213 lldb_r9l_x86_64, // Low 8 bits of r9
214 lldb_r10l_x86_64, // Low 8 bits of r10
215 lldb_r11l_x86_64, // Low 8 bits of r11
216 lldb_r12l_x86_64, // Low 8 bits of r12
217 lldb_r13l_x86_64, // Low 8 bits of r13
218 lldb_r14l_x86_64, // Low 8 bits of r14
219 lldb_r15l_x86_64, // Low 8 bits of r15
220 k_last_alias_x86_64 = lldb_r15l_x86_64,
221
222 k_last_gpr_x86_64 = k_last_alias_x86_64,
223
224 k_first_fpr_x86_64,
225 lldb_fctrl_x86_64 = k_first_fpr_x86_64,
226 lldb_fstat_x86_64,
227 lldb_ftag_x86_64,
228 lldb_fop_x86_64,
229 lldb_fiseg_x86_64,
230 lldb_fioff_x86_64,
231 lldb_fip_x86_64,
232 lldb_foseg_x86_64,
233 lldb_fooff_x86_64,
234 lldb_fdp_x86_64,
235 lldb_mxcsr_x86_64,
236 lldb_mxcsrmask_x86_64,
237 lldb_st0_x86_64,
238 lldb_st1_x86_64,
239 lldb_st2_x86_64,
240 lldb_st3_x86_64,
241 lldb_st4_x86_64,
242 lldb_st5_x86_64,
243 lldb_st6_x86_64,
244 lldb_st7_x86_64,
245 lldb_mm0_x86_64,
246 lldb_mm1_x86_64,
247 lldb_mm2_x86_64,
248 lldb_mm3_x86_64,
249 lldb_mm4_x86_64,
250 lldb_mm5_x86_64,
251 lldb_mm6_x86_64,
252 lldb_mm7_x86_64,
253 lldb_xmm0_x86_64,
254 lldb_xmm1_x86_64,
255 lldb_xmm2_x86_64,
256 lldb_xmm3_x86_64,
257 lldb_xmm4_x86_64,
258 lldb_xmm5_x86_64,
259 lldb_xmm6_x86_64,
260 lldb_xmm7_x86_64,
261 lldb_xmm8_x86_64,
262 lldb_xmm9_x86_64,
263 lldb_xmm10_x86_64,
264 lldb_xmm11_x86_64,
265 lldb_xmm12_x86_64,
266 lldb_xmm13_x86_64,
267 lldb_xmm14_x86_64,
268 lldb_xmm15_x86_64,
269 k_last_fpr_x86_64 = lldb_xmm15_x86_64,
270
271 k_first_avx_x86_64,
272 lldb_ymm0_x86_64 = k_first_avx_x86_64,
273 lldb_ymm1_x86_64,
274 lldb_ymm2_x86_64,
275 lldb_ymm3_x86_64,
276 lldb_ymm4_x86_64,
277 lldb_ymm5_x86_64,
278 lldb_ymm6_x86_64,
279 lldb_ymm7_x86_64,
280 lldb_ymm8_x86_64,
281 lldb_ymm9_x86_64,
282 lldb_ymm10_x86_64,
283 lldb_ymm11_x86_64,
284 lldb_ymm12_x86_64,
285 lldb_ymm13_x86_64,
286 lldb_ymm14_x86_64,
287 lldb_ymm15_x86_64,
288 k_last_avx_x86_64 = lldb_ymm15_x86_64,
289
290 k_first_mpxr_x86_64,
291 lldb_bnd0_x86_64 = k_first_mpxr_x86_64,
292 lldb_bnd1_x86_64,
293 lldb_bnd2_x86_64,
294 lldb_bnd3_x86_64,
295 k_last_mpxr_x86_64 = lldb_bnd3_x86_64,
296
297 k_first_mpxc_x86_64,
298 lldb_bndcfgu_x86_64 = k_first_mpxc_x86_64,
299 lldb_bndstatus_x86_64,
300 k_last_mpxc_x86_64 = lldb_bndstatus_x86_64,
301
302 k_first_dbr_x86_64,
303 lldb_dr0_x86_64 = k_first_dbr_x86_64,
304 lldb_dr1_x86_64,
305 lldb_dr2_x86_64,
306 lldb_dr3_x86_64,
307 lldb_dr4_x86_64,
308 lldb_dr5_x86_64,
309 lldb_dr6_x86_64,
310 lldb_dr7_x86_64,
311 k_last_dbr_x86_64 = lldb_dr7_x86_64,
312
313 k_num_registers_x86_64,
314 k_num_gpr_registers_x86_64 = k_last_gpr_x86_64 - k_first_gpr_x86_64 + 1,
315 k_num_fpr_registers_x86_64 = k_last_fpr_x86_64 - k_first_fpr_x86_64 + 1,
316 k_num_avx_registers_x86_64 = k_last_avx_x86_64 - k_first_avx_x86_64 + 1,
317 k_num_mpx_registers_x86_64 = k_last_mpxc_x86_64 - k_first_mpxr_x86_64 + 1,
318 k_num_user_registers_x86_64 = k_num_gpr_registers_x86_64 +
319 k_num_fpr_registers_x86_64 +
320 k_num_avx_registers_x86_64 +
321 k_num_mpx_registers_x86_64,
322 k_num_dbr_registers_x86_64 = k_last_dbr_x86_64 - k_first_dbr_x86_64 + 1,
323};
324
325// For platform that supports fs_base/gs_base registers.
326namespace x86_64_with_base {
327enum {
328 k_first_gpr,
329 lldb_rax = k_first_gpr,
330 lldb_rbx,
331 lldb_rcx,
332 lldb_rdx,
333 lldb_rdi,
334 lldb_rsi,
335 lldb_rbp,
336 lldb_rsp,
337 lldb_r8,
338 lldb_r9,
339 lldb_r10,
340 lldb_r11,
341 lldb_r12,
342 lldb_r13,
343 lldb_r14,
344 lldb_r15,
345 lldb_rip,
346 lldb_rflags,
347 lldb_cs,
348 lldb_fs,
349 lldb_gs,
350 lldb_ss,
351 lldb_fs_base,
352 lldb_gs_base,
353 lldb_ds,
354 lldb_es,
355
356 k_first_alias,
357 lldb_eax = k_first_alias,
358 lldb_ebx,
359 lldb_ecx,
360 lldb_edx,
361 lldb_edi,
362 lldb_esi,
363 lldb_ebp,
364 lldb_esp,
365 lldb_r8d, // Low 32 bits of r8
366 lldb_r9d, // Low 32 bits of r9
367 lldb_r10d, // Low 32 bits of r10
368 lldb_r11d, // Low 32 bits of r11
369 lldb_r12d, // Low 32 bits of r12
370 lldb_r13d, // Low 32 bits of r13
371 lldb_r14d, // Low 32 bits of r14
372 lldb_r15d, // Low 32 bits of r15
373 lldb_ax,
374 lldb_bx,
375 lldb_cx,
376 lldb_dx,
377 lldb_di,
378 lldb_si,
379 lldb_bp,
380 lldb_sp,
381 lldb_r8w, // Low 16 bits of r8
382 lldb_r9w, // Low 16 bits of r9
383 lldb_r10w, // Low 16 bits of r10
384 lldb_r11w, // Low 16 bits of r11
385 lldb_r12w, // Low 16 bits of r12
386 lldb_r13w, // Low 16 bits of r13
387 lldb_r14w, // Low 16 bits of r14
388 lldb_r15w, // Low 16 bits of r15
389 lldb_ah,
390 lldb_bh,
391 lldb_ch,
392 lldb_dh,
393 lldb_al,
394 lldb_bl,
395 lldb_cl,
396 lldb_dl,
397 lldb_dil,
398 lldb_sil,
399 lldb_bpl,
400 lldb_spl,
401 lldb_r8l, // Low 8 bits of r8
402 lldb_r9l, // Low 8 bits of r9
403 lldb_r10l, // Low 8 bits of r10
404 lldb_r11l, // Low 8 bits of r11
405 lldb_r12l, // Low 8 bits of r12
406 lldb_r13l, // Low 8 bits of r13
407 lldb_r14l, // Low 8 bits of r14
408 lldb_r15l, // Low 8 bits of r15
409 k_last_alias = lldb_r15l,
410
411 k_last_gpr = k_last_alias,
412
413 k_first_fpr,
414 lldb_fctrl = k_first_fpr,
415 lldb_fstat,
416 lldb_ftag,
417 lldb_fop,
418 lldb_fiseg,
419 lldb_fioff,
420 lldb_fip,
421 lldb_foseg,
422 lldb_fooff,
423 lldb_fdp,
424 lldb_mxcsr,
425 lldb_mxcsrmask,
426 lldb_st0,
427 lldb_st1,
428 lldb_st2,
429 lldb_st3,
430 lldb_st4,
431 lldb_st5,
432 lldb_st6,
433 lldb_st7,
434 lldb_mm0,
435 lldb_mm1,
436 lldb_mm2,
437 lldb_mm3,
438 lldb_mm4,
439 lldb_mm5,
440 lldb_mm6,
441 lldb_mm7,
442 lldb_xmm0,
443 lldb_xmm1,
444 lldb_xmm2,
445 lldb_xmm3,
446 lldb_xmm4,
447 lldb_xmm5,
448 lldb_xmm6,
449 lldb_xmm7,
450 lldb_xmm8,
451 lldb_xmm9,
452 lldb_xmm10,
453 lldb_xmm11,
454 lldb_xmm12,
455 lldb_xmm13,
456 lldb_xmm14,
457 lldb_xmm15,
458 k_last_fpr = lldb_xmm15,
459
460 k_first_avx,
461 lldb_ymm0 = k_first_avx,
462 lldb_ymm1,
463 lldb_ymm2,
464 lldb_ymm3,
465 lldb_ymm4,
466 lldb_ymm5,
467 lldb_ymm6,
468 lldb_ymm7,
469 lldb_ymm8,
470 lldb_ymm9,
471 lldb_ymm10,
472 lldb_ymm11,
473 lldb_ymm12,
474 lldb_ymm13,
475 lldb_ymm14,
476 lldb_ymm15,
477 k_last_avx = lldb_ymm15,
478
479 k_first_mpxr,
480 lldb_bnd0 = k_first_mpxr,
481 lldb_bnd1,
482 lldb_bnd2,
483 lldb_bnd3,
484 k_last_mpxr = lldb_bnd3,
485
486 k_first_mpxc,
487 lldb_bndcfgu = k_first_mpxc,
488 lldb_bndstatus,
489 k_last_mpxc = lldb_bndstatus,
490
491 k_first_dbr,
492 lldb_dr0 = k_first_dbr,
493 lldb_dr1,
494 lldb_dr2,
495 lldb_dr3,
496 lldb_dr4,
497 lldb_dr5,
498 lldb_dr6,
499 lldb_dr7,
500 k_last_dbr = lldb_dr7,
501
502 k_num_registers,
503 k_num_gpr_registers = k_last_gpr - k_first_gpr + 1,
504 k_num_fpr_registers = k_last_fpr - k_first_fpr + 1,
505 k_num_avx_registers = k_last_avx - k_first_avx + 1,
506 k_num_mpx_registers = k_last_mpxc - k_first_mpxr + 1,
507 k_num_user_registers = k_num_gpr_registers +
508 k_num_fpr_registers +
509 k_num_avx_registers +
510 k_num_mpx_registers,
511 k_num_dbr_registers = k_last_dbr - k_first_dbr + 1,
512};
513} // namespace x86_64_with_base
514
515}
516
517#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_LLDB_X86_REGISTER_ENUMS_H
518

source code of lldb/source/Plugins/Process/Utility/lldb-x86-register-enums.h