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 
12 namespace lldb_private {
13 // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB)
14 
15 // Internal codes for all i386 registers.
16 enum {
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.
140 enum {
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_foseg_x86_64,
232   lldb_fooff_x86_64,
233   lldb_mxcsr_x86_64,
234   lldb_mxcsrmask_x86_64,
235   lldb_st0_x86_64,
236   lldb_st1_x86_64,
237   lldb_st2_x86_64,
238   lldb_st3_x86_64,
239   lldb_st4_x86_64,
240   lldb_st5_x86_64,
241   lldb_st6_x86_64,
242   lldb_st7_x86_64,
243   lldb_mm0_x86_64,
244   lldb_mm1_x86_64,
245   lldb_mm2_x86_64,
246   lldb_mm3_x86_64,
247   lldb_mm4_x86_64,
248   lldb_mm5_x86_64,
249   lldb_mm6_x86_64,
250   lldb_mm7_x86_64,
251   lldb_xmm0_x86_64,
252   lldb_xmm1_x86_64,
253   lldb_xmm2_x86_64,
254   lldb_xmm3_x86_64,
255   lldb_xmm4_x86_64,
256   lldb_xmm5_x86_64,
257   lldb_xmm6_x86_64,
258   lldb_xmm7_x86_64,
259   lldb_xmm8_x86_64,
260   lldb_xmm9_x86_64,
261   lldb_xmm10_x86_64,
262   lldb_xmm11_x86_64,
263   lldb_xmm12_x86_64,
264   lldb_xmm13_x86_64,
265   lldb_xmm14_x86_64,
266   lldb_xmm15_x86_64,
267   k_last_fpr_x86_64 = lldb_xmm15_x86_64,
268 
269   k_first_avx_x86_64,
270   lldb_ymm0_x86_64 = k_first_avx_x86_64,
271   lldb_ymm1_x86_64,
272   lldb_ymm2_x86_64,
273   lldb_ymm3_x86_64,
274   lldb_ymm4_x86_64,
275   lldb_ymm5_x86_64,
276   lldb_ymm6_x86_64,
277   lldb_ymm7_x86_64,
278   lldb_ymm8_x86_64,
279   lldb_ymm9_x86_64,
280   lldb_ymm10_x86_64,
281   lldb_ymm11_x86_64,
282   lldb_ymm12_x86_64,
283   lldb_ymm13_x86_64,
284   lldb_ymm14_x86_64,
285   lldb_ymm15_x86_64,
286   k_last_avx_x86_64 = lldb_ymm15_x86_64,
287 
288   k_first_mpxr_x86_64,
289   lldb_bnd0_x86_64 = k_first_mpxr_x86_64,
290   lldb_bnd1_x86_64,
291   lldb_bnd2_x86_64,
292   lldb_bnd3_x86_64,
293   k_last_mpxr_x86_64 = lldb_bnd3_x86_64,
294 
295   k_first_mpxc_x86_64,
296   lldb_bndcfgu_x86_64 = k_first_mpxc_x86_64,
297   lldb_bndstatus_x86_64,
298   k_last_mpxc_x86_64 = lldb_bndstatus_x86_64,
299 
300   k_first_dbr_x86_64,
301   lldb_dr0_x86_64 = k_first_dbr_x86_64,
302   lldb_dr1_x86_64,
303   lldb_dr2_x86_64,
304   lldb_dr3_x86_64,
305   lldb_dr4_x86_64,
306   lldb_dr5_x86_64,
307   lldb_dr6_x86_64,
308   lldb_dr7_x86_64,
309   k_last_dbr_x86_64 = lldb_dr7_x86_64,
310 
311   k_num_registers_x86_64,
312   k_num_gpr_registers_x86_64 = k_last_gpr_x86_64 - k_first_gpr_x86_64 + 1,
313   k_num_fpr_registers_x86_64 = k_last_fpr_x86_64 - k_first_fpr_x86_64 + 1,
314   k_num_avx_registers_x86_64 = k_last_avx_x86_64 - k_first_avx_x86_64 + 1,
315   k_num_mpx_registers_x86_64 = k_last_mpxc_x86_64 - k_first_mpxr_x86_64 + 1,
316   k_num_user_registers_x86_64 = k_num_gpr_registers_x86_64 +
317                                 k_num_fpr_registers_x86_64 +
318                                 k_num_avx_registers_x86_64 +
319                                 k_num_mpx_registers_x86_64,
320   k_num_dbr_registers_x86_64 = k_last_dbr_x86_64 - k_first_dbr_x86_64 + 1,
321 };
322 }
323 
324 #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_LLDB_X86_REGISTER_ENUMS_H
325