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_x86_register_enums_h
10 #define 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 = 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   lldb_dr0_i386,
117   lldb_dr1_i386,
118   lldb_dr2_i386,
119   lldb_dr3_i386,
120   lldb_dr4_i386,
121   lldb_dr5_i386,
122   lldb_dr6_i386,
123   lldb_dr7_i386,
124 
125   k_num_registers_i386,
126   k_num_gpr_registers_i386 = k_last_gpr_i386 - k_first_gpr_i386 + 1,
127   k_num_fpr_registers_i386 = k_last_fpr_i386 - k_first_fpr_i386 + 1,
128   k_num_avx_registers_i386 = k_last_avx_i386 - k_first_avx_i386 + 1,
129   k_num_mpx_registers_i386 = k_last_mpxc_i386 - k_first_mpxr_i386 + 1,
130   k_num_user_registers_i386 = k_num_gpr_registers_i386 +
131                               k_num_fpr_registers_i386 +
132                               k_num_avx_registers_i386 +
133                               k_num_mpx_registers_i386,
134 };
135 
136 // Internal codes for all x86_64 registers.
137 enum {
138   k_first_gpr_x86_64,
139   lldb_rax_x86_64 = k_first_gpr_x86_64,
140   lldb_rbx_x86_64,
141   lldb_rcx_x86_64,
142   lldb_rdx_x86_64,
143   lldb_rdi_x86_64,
144   lldb_rsi_x86_64,
145   lldb_rbp_x86_64,
146   lldb_rsp_x86_64,
147   lldb_r8_x86_64,
148   lldb_r9_x86_64,
149   lldb_r10_x86_64,
150   lldb_r11_x86_64,
151   lldb_r12_x86_64,
152   lldb_r13_x86_64,
153   lldb_r14_x86_64,
154   lldb_r15_x86_64,
155   lldb_rip_x86_64,
156   lldb_rflags_x86_64,
157   lldb_cs_x86_64,
158   lldb_fs_x86_64,
159   lldb_gs_x86_64,
160   lldb_ss_x86_64,
161   lldb_ds_x86_64,
162   lldb_es_x86_64,
163 
164   k_first_alias_x86_64,
165   lldb_eax_x86_64 = k_first_alias_x86_64,
166   lldb_ebx_x86_64,
167   lldb_ecx_x86_64,
168   lldb_edx_x86_64,
169   lldb_edi_x86_64,
170   lldb_esi_x86_64,
171   lldb_ebp_x86_64,
172   lldb_esp_x86_64,
173   lldb_r8d_x86_64,  // Low 32 bits of r8
174   lldb_r9d_x86_64,  // Low 32 bits of r9
175   lldb_r10d_x86_64, // Low 32 bits of r10
176   lldb_r11d_x86_64, // Low 32 bits of r11
177   lldb_r12d_x86_64, // Low 32 bits of r12
178   lldb_r13d_x86_64, // Low 32 bits of r13
179   lldb_r14d_x86_64, // Low 32 bits of r14
180   lldb_r15d_x86_64, // Low 32 bits of r15
181   lldb_ax_x86_64,
182   lldb_bx_x86_64,
183   lldb_cx_x86_64,
184   lldb_dx_x86_64,
185   lldb_di_x86_64,
186   lldb_si_x86_64,
187   lldb_bp_x86_64,
188   lldb_sp_x86_64,
189   lldb_r8w_x86_64,  // Low 16 bits of r8
190   lldb_r9w_x86_64,  // Low 16 bits of r9
191   lldb_r10w_x86_64, // Low 16 bits of r10
192   lldb_r11w_x86_64, // Low 16 bits of r11
193   lldb_r12w_x86_64, // Low 16 bits of r12
194   lldb_r13w_x86_64, // Low 16 bits of r13
195   lldb_r14w_x86_64, // Low 16 bits of r14
196   lldb_r15w_x86_64, // Low 16 bits of r15
197   lldb_ah_x86_64,
198   lldb_bh_x86_64,
199   lldb_ch_x86_64,
200   lldb_dh_x86_64,
201   lldb_al_x86_64,
202   lldb_bl_x86_64,
203   lldb_cl_x86_64,
204   lldb_dl_x86_64,
205   lldb_dil_x86_64,
206   lldb_sil_x86_64,
207   lldb_bpl_x86_64,
208   lldb_spl_x86_64,
209   lldb_r8l_x86_64,  // Low 8 bits of r8
210   lldb_r9l_x86_64,  // Low 8 bits of r9
211   lldb_r10l_x86_64, // Low 8 bits of r10
212   lldb_r11l_x86_64, // Low 8 bits of r11
213   lldb_r12l_x86_64, // Low 8 bits of r12
214   lldb_r13l_x86_64, // Low 8 bits of r13
215   lldb_r14l_x86_64, // Low 8 bits of r14
216   lldb_r15l_x86_64, // Low 8 bits of r15
217   k_last_alias_x86_64 = lldb_r15l_x86_64,
218 
219   k_last_gpr_x86_64 = k_last_alias_x86_64,
220 
221   k_first_fpr_x86_64,
222   lldb_fctrl_x86_64 = k_first_fpr_x86_64,
223   lldb_fstat_x86_64,
224   lldb_ftag_x86_64,
225   lldb_fop_x86_64,
226   lldb_fiseg_x86_64,
227   lldb_fioff_x86_64,
228   lldb_foseg_x86_64,
229   lldb_fooff_x86_64,
230   lldb_mxcsr_x86_64,
231   lldb_mxcsrmask_x86_64,
232   lldb_st0_x86_64,
233   lldb_st1_x86_64,
234   lldb_st2_x86_64,
235   lldb_st3_x86_64,
236   lldb_st4_x86_64,
237   lldb_st5_x86_64,
238   lldb_st6_x86_64,
239   lldb_st7_x86_64,
240   lldb_mm0_x86_64,
241   lldb_mm1_x86_64,
242   lldb_mm2_x86_64,
243   lldb_mm3_x86_64,
244   lldb_mm4_x86_64,
245   lldb_mm5_x86_64,
246   lldb_mm6_x86_64,
247   lldb_mm7_x86_64,
248   lldb_xmm0_x86_64,
249   lldb_xmm1_x86_64,
250   lldb_xmm2_x86_64,
251   lldb_xmm3_x86_64,
252   lldb_xmm4_x86_64,
253   lldb_xmm5_x86_64,
254   lldb_xmm6_x86_64,
255   lldb_xmm7_x86_64,
256   lldb_xmm8_x86_64,
257   lldb_xmm9_x86_64,
258   lldb_xmm10_x86_64,
259   lldb_xmm11_x86_64,
260   lldb_xmm12_x86_64,
261   lldb_xmm13_x86_64,
262   lldb_xmm14_x86_64,
263   lldb_xmm15_x86_64,
264   k_last_fpr_x86_64 = lldb_xmm15_x86_64,
265 
266   k_first_avx_x86_64,
267   lldb_ymm0_x86_64 = k_first_avx_x86_64,
268   lldb_ymm1_x86_64,
269   lldb_ymm2_x86_64,
270   lldb_ymm3_x86_64,
271   lldb_ymm4_x86_64,
272   lldb_ymm5_x86_64,
273   lldb_ymm6_x86_64,
274   lldb_ymm7_x86_64,
275   lldb_ymm8_x86_64,
276   lldb_ymm9_x86_64,
277   lldb_ymm10_x86_64,
278   lldb_ymm11_x86_64,
279   lldb_ymm12_x86_64,
280   lldb_ymm13_x86_64,
281   lldb_ymm14_x86_64,
282   lldb_ymm15_x86_64,
283   k_last_avx_x86_64 = lldb_ymm15_x86_64,
284 
285   k_first_mpxr_x86_64,
286   lldb_bnd0_x86_64 = k_first_mpxr_x86_64,
287   lldb_bnd1_x86_64,
288   lldb_bnd2_x86_64,
289   lldb_bnd3_x86_64,
290   k_last_mpxr_x86_64 = lldb_bnd3_x86_64,
291 
292   k_first_mpxc_x86_64,
293   lldb_bndcfgu_x86_64 = k_first_mpxc_x86_64,
294   lldb_bndstatus_x86_64,
295   k_last_mpxc_x86_64 = lldb_bndstatus_x86_64,
296 
297   k_first_dbr_x86_64,
298   lldb_dr0_x86_64 = k_first_dbr_x86_64,
299   lldb_dr1_x86_64,
300   lldb_dr2_x86_64,
301   lldb_dr3_x86_64,
302   lldb_dr4_x86_64,
303   lldb_dr5_x86_64,
304   lldb_dr6_x86_64,
305   lldb_dr7_x86_64,
306   k_last_dbr_x86_64 = lldb_dr7_x86_64,
307 
308   k_num_registers_x86_64,
309   k_num_gpr_registers_x86_64 = k_last_gpr_x86_64 - k_first_gpr_x86_64 + 1,
310   k_num_fpr_registers_x86_64 = k_last_fpr_x86_64 - k_first_fpr_x86_64 + 1,
311   k_num_avx_registers_x86_64 = k_last_avx_x86_64 - k_first_avx_x86_64 + 1,
312   k_num_mpx_registers_x86_64 = k_last_mpxc_x86_64 - k_first_mpxr_x86_64 + 1,
313   k_num_user_registers_x86_64 = k_num_gpr_registers_x86_64 +
314                                 k_num_fpr_registers_x86_64 +
315                                 k_num_avx_registers_x86_64 +
316                                 k_num_mpx_registers_x86_64,
317   k_num_dbr_registers_x86_64 = k_last_dbr_x86_64 - k_first_dbr_x86_64 + 1,
318 };
319 }
320 
321 #endif // #ifndef lldb_x86_register_enums_h
322