i386-opc.h revision 1.1.1.5 1 1.1 skrll /* Declarations for Intel 80386 opcode table
2 1.1.1.5 christos Copyright (C) 2007-2016 Free Software Foundation, Inc.
3 1.1 skrll
4 1.1 skrll This file is part of the GNU opcodes library.
5 1.1 skrll
6 1.1 skrll This library is free software; you can redistribute it and/or modify
7 1.1 skrll it under the terms of the GNU General Public License as published by
8 1.1 skrll the Free Software Foundation; either version 3, or (at your option)
9 1.1 skrll any later version.
10 1.1 skrll
11 1.1 skrll It is distributed in the hope that it will be useful, but WITHOUT
12 1.1 skrll ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 1.1 skrll or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 1.1 skrll License for more details.
15 1.1 skrll
16 1.1 skrll You should have received a copy of the GNU General Public License
17 1.1 skrll along with GAS; see the file COPYING. If not, write to the Free
18 1.1 skrll Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19 1.1 skrll 02110-1301, USA. */
20 1.1 skrll
21 1.1 skrll #include "opcode/i386.h"
22 1.1 skrll #ifdef HAVE_LIMITS_H
23 1.1 skrll #include <limits.h>
24 1.1 skrll #endif
25 1.1 skrll
26 1.1 skrll #ifndef CHAR_BIT
27 1.1 skrll #define CHAR_BIT 8
28 1.1 skrll #endif
29 1.1 skrll
30 1.1 skrll /* Position of cpu flags bitfiled. */
31 1.1 skrll
32 1.1.1.2 christos enum
33 1.1.1.2 christos {
34 1.1.1.2 christos /* i186 or better required */
35 1.1.1.2 christos Cpu186 = 0,
36 1.1.1.2 christos /* i286 or better required */
37 1.1.1.2 christos Cpu286,
38 1.1.1.2 christos /* i386 or better required */
39 1.1.1.2 christos Cpu386,
40 1.1.1.2 christos /* i486 or better required */
41 1.1.1.2 christos Cpu486,
42 1.1.1.2 christos /* i585 or better required */
43 1.1.1.2 christos Cpu586,
44 1.1.1.2 christos /* i686 or better required */
45 1.1.1.2 christos Cpu686,
46 1.1.1.2 christos /* CLFLUSH Instruction support required */
47 1.1.1.2 christos CpuClflush,
48 1.1.1.2 christos /* NOP Instruction support required */
49 1.1.1.2 christos CpuNop,
50 1.1.1.2 christos /* SYSCALL Instructions support required */
51 1.1.1.2 christos CpuSYSCALL,
52 1.1.1.2 christos /* Floating point support required */
53 1.1.1.2 christos Cpu8087,
54 1.1.1.2 christos /* i287 support required */
55 1.1.1.2 christos Cpu287,
56 1.1.1.2 christos /* i387 support required */
57 1.1.1.2 christos Cpu387,
58 1.1.1.2 christos /* i686 and floating point support required */
59 1.1.1.2 christos Cpu687,
60 1.1.1.2 christos /* SSE3 and floating point support required */
61 1.1.1.2 christos CpuFISTTP,
62 1.1.1.2 christos /* MMX support required */
63 1.1.1.2 christos CpuMMX,
64 1.1.1.2 christos /* SSE support required */
65 1.1.1.2 christos CpuSSE,
66 1.1.1.2 christos /* SSE2 support required */
67 1.1.1.2 christos CpuSSE2,
68 1.1.1.2 christos /* 3dnow! support required */
69 1.1.1.2 christos Cpu3dnow,
70 1.1.1.2 christos /* 3dnow! Extensions support required */
71 1.1.1.2 christos Cpu3dnowA,
72 1.1.1.2 christos /* SSE3 support required */
73 1.1.1.2 christos CpuSSE3,
74 1.1.1.2 christos /* VIA PadLock required */
75 1.1.1.2 christos CpuPadLock,
76 1.1.1.2 christos /* AMD Secure Virtual Machine Ext-s required */
77 1.1.1.2 christos CpuSVME,
78 1.1.1.2 christos /* VMX Instructions required */
79 1.1.1.2 christos CpuVMX,
80 1.1.1.2 christos /* SMX Instructions required */
81 1.1.1.2 christos CpuSMX,
82 1.1.1.2 christos /* SSSE3 support required */
83 1.1.1.2 christos CpuSSSE3,
84 1.1.1.2 christos /* SSE4a support required */
85 1.1.1.2 christos CpuSSE4a,
86 1.1.1.2 christos /* ABM New Instructions required */
87 1.1.1.2 christos CpuABM,
88 1.1.1.2 christos /* SSE4.1 support required */
89 1.1.1.2 christos CpuSSE4_1,
90 1.1.1.2 christos /* SSE4.2 support required */
91 1.1.1.2 christos CpuSSE4_2,
92 1.1.1.2 christos /* AVX support required */
93 1.1.1.2 christos CpuAVX,
94 1.1.1.3 christos /* AVX2 support required */
95 1.1.1.3 christos CpuAVX2,
96 1.1.1.4 christos /* Intel AVX-512 Foundation Instructions support required */
97 1.1.1.4 christos CpuAVX512F,
98 1.1.1.4 christos /* Intel AVX-512 Conflict Detection Instructions support required */
99 1.1.1.4 christos CpuAVX512CD,
100 1.1.1.4 christos /* Intel AVX-512 Exponential and Reciprocal Instructions support
101 1.1.1.4 christos required */
102 1.1.1.4 christos CpuAVX512ER,
103 1.1.1.4 christos /* Intel AVX-512 Prefetch Instructions support required */
104 1.1.1.4 christos CpuAVX512PF,
105 1.1.1.4 christos /* Intel AVX-512 VL Instructions support required. */
106 1.1.1.4 christos CpuAVX512VL,
107 1.1.1.4 christos /* Intel AVX-512 DQ Instructions support required. */
108 1.1.1.4 christos CpuAVX512DQ,
109 1.1.1.4 christos /* Intel AVX-512 BW Instructions support required. */
110 1.1.1.4 christos CpuAVX512BW,
111 1.1.1.2 christos /* Intel L1OM support required */
112 1.1.1.2 christos CpuL1OM,
113 1.1.1.3 christos /* Intel K1OM support required */
114 1.1.1.3 christos CpuK1OM,
115 1.1.1.4 christos /* Intel IAMCU support required */
116 1.1.1.4 christos CpuIAMCU,
117 1.1.1.2 christos /* Xsave/xrstor New Instructions support required */
118 1.1.1.2 christos CpuXsave,
119 1.1.1.2 christos /* Xsaveopt New Instructions support required */
120 1.1.1.2 christos CpuXsaveopt,
121 1.1.1.2 christos /* AES support required */
122 1.1.1.2 christos CpuAES,
123 1.1.1.2 christos /* PCLMUL support required */
124 1.1.1.2 christos CpuPCLMUL,
125 1.1.1.2 christos /* FMA support required */
126 1.1.1.2 christos CpuFMA,
127 1.1.1.2 christos /* FMA4 support required */
128 1.1.1.2 christos CpuFMA4,
129 1.1.1.2 christos /* XOP support required */
130 1.1.1.2 christos CpuXOP,
131 1.1.1.2 christos /* LWP support required */
132 1.1.1.2 christos CpuLWP,
133 1.1.1.3 christos /* BMI support required */
134 1.1.1.3 christos CpuBMI,
135 1.1.1.3 christos /* TBM support required */
136 1.1.1.3 christos CpuTBM,
137 1.1.1.2 christos /* MOVBE Instruction support required */
138 1.1.1.2 christos CpuMovbe,
139 1.1.1.4 christos /* CMPXCHG16B instruction support required. */
140 1.1.1.4 christos CpuCX16,
141 1.1.1.2 christos /* EPT Instructions required */
142 1.1.1.2 christos CpuEPT,
143 1.1.1.2 christos /* RDTSCP Instruction support required */
144 1.1.1.2 christos CpuRdtscp,
145 1.1.1.2 christos /* FSGSBASE Instructions required */
146 1.1.1.2 christos CpuFSGSBase,
147 1.1.1.2 christos /* RDRND Instructions required */
148 1.1.1.2 christos CpuRdRnd,
149 1.1.1.2 christos /* F16C Instructions required */
150 1.1.1.2 christos CpuF16C,
151 1.1.1.3 christos /* Intel BMI2 support required */
152 1.1.1.3 christos CpuBMI2,
153 1.1.1.3 christos /* LZCNT support required */
154 1.1.1.3 christos CpuLZCNT,
155 1.1.1.3 christos /* HLE support required */
156 1.1.1.3 christos CpuHLE,
157 1.1.1.3 christos /* RTM support required */
158 1.1.1.3 christos CpuRTM,
159 1.1.1.3 christos /* INVPCID Instructions required */
160 1.1.1.3 christos CpuINVPCID,
161 1.1.1.3 christos /* VMFUNC Instruction required */
162 1.1.1.3 christos CpuVMFUNC,
163 1.1.1.4 christos /* Intel MPX Instructions required */
164 1.1.1.4 christos CpuMPX,
165 1.1.1.2 christos /* 64bit support available, used by -march= in assembler. */
166 1.1.1.2 christos CpuLM,
167 1.1.1.3 christos /* RDRSEED instruction required. */
168 1.1.1.3 christos CpuRDSEED,
169 1.1.1.3 christos /* Multi-presisionn add-carry instructions are required. */
170 1.1.1.3 christos CpuADX,
171 1.1.1.3 christos /* Supports prefetchw and prefetch instructions. */
172 1.1.1.3 christos CpuPRFCHW,
173 1.1.1.4 christos /* SMAP instructions required. */
174 1.1.1.4 christos CpuSMAP,
175 1.1.1.4 christos /* SHA instructions required. */
176 1.1.1.4 christos CpuSHA,
177 1.1.1.4 christos /* VREX support required */
178 1.1.1.4 christos CpuVREX,
179 1.1.1.4 christos /* CLFLUSHOPT instruction required */
180 1.1.1.4 christos CpuClflushOpt,
181 1.1.1.4 christos /* XSAVES/XRSTORS instruction required */
182 1.1.1.4 christos CpuXSAVES,
183 1.1.1.4 christos /* XSAVEC instruction required */
184 1.1.1.4 christos CpuXSAVEC,
185 1.1.1.4 christos /* PREFETCHWT1 instruction required */
186 1.1.1.4 christos CpuPREFETCHWT1,
187 1.1.1.4 christos /* SE1 instruction required */
188 1.1.1.4 christos CpuSE1,
189 1.1.1.4 christos /* CLWB instruction required */
190 1.1.1.4 christos CpuCLWB,
191 1.1.1.4 christos /* PCOMMIT instruction required */
192 1.1.1.4 christos CpuPCOMMIT,
193 1.1.1.4 christos /* Intel AVX-512 IFMA Instructions support required. */
194 1.1.1.4 christos CpuAVX512IFMA,
195 1.1.1.4 christos /* Intel AVX-512 VBMI Instructions support required. */
196 1.1.1.4 christos CpuAVX512VBMI,
197 1.1.1.4 christos /* mwaitx instruction required */
198 1.1.1.4 christos CpuMWAITX,
199 1.1.1.4 christos /* Clzero instruction required */
200 1.1.1.4 christos CpuCLZERO,
201 1.1.1.4 christos /* OSPKE instruction required */
202 1.1.1.4 christos CpuOSPKE,
203 1.1.1.5 christos /* RDPID instruction required */
204 1.1.1.5 christos CpuRDPID,
205 1.1.1.5 christos /* MMX register support required */
206 1.1.1.5 christos CpuRegMMX,
207 1.1.1.5 christos /* XMM register support required */
208 1.1.1.5 christos CpuRegXMM,
209 1.1.1.5 christos /* YMM register support required */
210 1.1.1.5 christos CpuRegYMM,
211 1.1.1.5 christos /* ZMM register support required */
212 1.1.1.5 christos CpuRegZMM,
213 1.1.1.5 christos /* Mask register support required */
214 1.1.1.5 christos CpuRegMask,
215 1.1.1.2 christos /* 64bit support required */
216 1.1.1.2 christos Cpu64,
217 1.1.1.2 christos /* Not supported in the 64bit mode */
218 1.1.1.2 christos CpuNo64,
219 1.1.1.2 christos /* The last bitfield in i386_cpu_flags. */
220 1.1.1.2 christos CpuMax = CpuNo64
221 1.1.1.2 christos };
222 1.1 skrll
223 1.1 skrll #define CpuNumOfUints \
224 1.1 skrll (CpuMax / sizeof (unsigned int) / CHAR_BIT + 1)
225 1.1 skrll #define CpuNumOfBits \
226 1.1 skrll (CpuNumOfUints * sizeof (unsigned int) * CHAR_BIT)
227 1.1 skrll
228 1.1 skrll /* If you get a compiler error for zero width of the unused field,
229 1.1 skrll comment it out. */
230 1.1 skrll #define CpuUnused (CpuMax + 1)
231 1.1 skrll
232 1.1 skrll /* We can check if an instruction is available with array instead
233 1.1 skrll of bitfield. */
234 1.1 skrll typedef union i386_cpu_flags
235 1.1 skrll {
236 1.1 skrll struct
237 1.1 skrll {
238 1.1 skrll unsigned int cpui186:1;
239 1.1 skrll unsigned int cpui286:1;
240 1.1 skrll unsigned int cpui386:1;
241 1.1 skrll unsigned int cpui486:1;
242 1.1 skrll unsigned int cpui586:1;
243 1.1 skrll unsigned int cpui686:1;
244 1.1.1.2 christos unsigned int cpuclflush:1;
245 1.1.1.2 christos unsigned int cpunop:1;
246 1.1.1.2 christos unsigned int cpusyscall:1;
247 1.1.1.2 christos unsigned int cpu8087:1;
248 1.1.1.2 christos unsigned int cpu287:1;
249 1.1.1.2 christos unsigned int cpu387:1;
250 1.1.1.2 christos unsigned int cpu687:1;
251 1.1.1.2 christos unsigned int cpufisttp:1;
252 1.1 skrll unsigned int cpummx:1;
253 1.1 skrll unsigned int cpusse:1;
254 1.1 skrll unsigned int cpusse2:1;
255 1.1 skrll unsigned int cpua3dnow:1;
256 1.1 skrll unsigned int cpua3dnowa:1;
257 1.1 skrll unsigned int cpusse3:1;
258 1.1 skrll unsigned int cpupadlock:1;
259 1.1 skrll unsigned int cpusvme:1;
260 1.1 skrll unsigned int cpuvmx:1;
261 1.1 skrll unsigned int cpusmx:1;
262 1.1 skrll unsigned int cpussse3:1;
263 1.1 skrll unsigned int cpusse4a:1;
264 1.1 skrll unsigned int cpuabm:1;
265 1.1 skrll unsigned int cpusse4_1:1;
266 1.1 skrll unsigned int cpusse4_2:1;
267 1.1 skrll unsigned int cpuavx:1;
268 1.1.1.3 christos unsigned int cpuavx2:1;
269 1.1.1.4 christos unsigned int cpuavx512f:1;
270 1.1.1.4 christos unsigned int cpuavx512cd:1;
271 1.1.1.4 christos unsigned int cpuavx512er:1;
272 1.1.1.4 christos unsigned int cpuavx512pf:1;
273 1.1.1.4 christos unsigned int cpuavx512vl:1;
274 1.1.1.4 christos unsigned int cpuavx512dq:1;
275 1.1.1.4 christos unsigned int cpuavx512bw:1;
276 1.1.1.2 christos unsigned int cpul1om:1;
277 1.1.1.3 christos unsigned int cpuk1om:1;
278 1.1.1.4 christos unsigned int cpuiamcu:1;
279 1.1 skrll unsigned int cpuxsave:1;
280 1.1.1.2 christos unsigned int cpuxsaveopt:1;
281 1.1 skrll unsigned int cpuaes:1;
282 1.1 skrll unsigned int cpupclmul:1;
283 1.1 skrll unsigned int cpufma:1;
284 1.1.1.2 christos unsigned int cpufma4:1;
285 1.1.1.2 christos unsigned int cpuxop:1;
286 1.1.1.2 christos unsigned int cpulwp:1;
287 1.1.1.3 christos unsigned int cpubmi:1;
288 1.1.1.3 christos unsigned int cputbm:1;
289 1.1 skrll unsigned int cpumovbe:1;
290 1.1.1.4 christos unsigned int cpucx16:1;
291 1.1 skrll unsigned int cpuept:1;
292 1.1.1.2 christos unsigned int cpurdtscp:1;
293 1.1.1.2 christos unsigned int cpufsgsbase:1;
294 1.1.1.2 christos unsigned int cpurdrnd:1;
295 1.1.1.2 christos unsigned int cpuf16c:1;
296 1.1.1.3 christos unsigned int cpubmi2:1;
297 1.1.1.3 christos unsigned int cpulzcnt:1;
298 1.1.1.3 christos unsigned int cpuhle:1;
299 1.1.1.3 christos unsigned int cpurtm:1;
300 1.1.1.3 christos unsigned int cpuinvpcid:1;
301 1.1.1.3 christos unsigned int cpuvmfunc:1;
302 1.1.1.4 christos unsigned int cpumpx:1;
303 1.1 skrll unsigned int cpulm:1;
304 1.1.1.3 christos unsigned int cpurdseed:1;
305 1.1.1.3 christos unsigned int cpuadx:1;
306 1.1.1.3 christos unsigned int cpuprfchw:1;
307 1.1.1.4 christos unsigned int cpusmap:1;
308 1.1.1.4 christos unsigned int cpusha:1;
309 1.1.1.4 christos unsigned int cpuvrex:1;
310 1.1.1.4 christos unsigned int cpuclflushopt:1;
311 1.1.1.4 christos unsigned int cpuxsaves:1;
312 1.1.1.4 christos unsigned int cpuxsavec:1;
313 1.1.1.4 christos unsigned int cpuprefetchwt1:1;
314 1.1.1.4 christos unsigned int cpuse1:1;
315 1.1.1.4 christos unsigned int cpuclwb:1;
316 1.1.1.4 christos unsigned int cpupcommit:1;
317 1.1.1.4 christos unsigned int cpuavx512ifma:1;
318 1.1.1.4 christos unsigned int cpuavx512vbmi:1;
319 1.1.1.4 christos unsigned int cpumwaitx:1;
320 1.1.1.4 christos unsigned int cpuclzero:1;
321 1.1.1.4 christos unsigned int cpuospke:1;
322 1.1.1.5 christos unsigned int cpurdpid:1;
323 1.1.1.5 christos unsigned int cpuregmmx:1;
324 1.1.1.5 christos unsigned int cpuregxmm:1;
325 1.1.1.5 christos unsigned int cpuregymm:1;
326 1.1.1.5 christos unsigned int cpuregzmm:1;
327 1.1.1.5 christos unsigned int cpuregmask:1;
328 1.1 skrll unsigned int cpu64:1;
329 1.1 skrll unsigned int cpuno64:1;
330 1.1 skrll #ifdef CpuUnused
331 1.1 skrll unsigned int unused:(CpuNumOfBits - CpuUnused);
332 1.1 skrll #endif
333 1.1 skrll } bitfield;
334 1.1 skrll unsigned int array[CpuNumOfUints];
335 1.1 skrll } i386_cpu_flags;
336 1.1 skrll
337 1.1 skrll /* Position of opcode_modifier bits. */
338 1.1 skrll
339 1.1.1.2 christos enum
340 1.1.1.2 christos {
341 1.1.1.2 christos /* has direction bit. */
342 1.1.1.2 christos D = 0,
343 1.1.1.2 christos /* set if operands can be words or dwords encoded the canonical way */
344 1.1.1.2 christos W,
345 1.1.1.2 christos /* Skip the current insn and use the next insn in i386-opc.tbl to swap
346 1.1.1.2 christos operand in encoding. */
347 1.1.1.2 christos S,
348 1.1.1.2 christos /* insn has a modrm byte. */
349 1.1.1.2 christos Modrm,
350 1.1.1.2 christos /* register is in low 3 bits of opcode */
351 1.1.1.2 christos ShortForm,
352 1.1.1.2 christos /* special case for jump insns. */
353 1.1.1.2 christos Jump,
354 1.1.1.2 christos /* call and jump */
355 1.1.1.2 christos JumpDword,
356 1.1.1.2 christos /* loop and jecxz */
357 1.1.1.2 christos JumpByte,
358 1.1.1.2 christos /* special case for intersegment leaps/calls */
359 1.1.1.2 christos JumpInterSegment,
360 1.1.1.2 christos /* FP insn memory format bit, sized by 0x4 */
361 1.1.1.2 christos FloatMF,
362 1.1.1.2 christos /* src/dest swap for floats. */
363 1.1.1.2 christos FloatR,
364 1.1.1.2 christos /* has float insn direction bit. */
365 1.1.1.2 christos FloatD,
366 1.1.1.2 christos /* needs size prefix if in 32-bit mode */
367 1.1.1.2 christos Size16,
368 1.1.1.2 christos /* needs size prefix if in 16-bit mode */
369 1.1.1.2 christos Size32,
370 1.1.1.2 christos /* needs size prefix if in 64-bit mode */
371 1.1.1.2 christos Size64,
372 1.1.1.2 christos /* check register size. */
373 1.1.1.2 christos CheckRegSize,
374 1.1.1.2 christos /* instruction ignores operand size prefix and in Intel mode ignores
375 1.1.1.2 christos mnemonic size suffix check. */
376 1.1.1.2 christos IgnoreSize,
377 1.1.1.2 christos /* default insn size depends on mode */
378 1.1.1.2 christos DefaultSize,
379 1.1.1.2 christos /* b suffix on instruction illegal */
380 1.1.1.2 christos No_bSuf,
381 1.1.1.2 christos /* w suffix on instruction illegal */
382 1.1.1.2 christos No_wSuf,
383 1.1.1.2 christos /* l suffix on instruction illegal */
384 1.1.1.2 christos No_lSuf,
385 1.1.1.2 christos /* s suffix on instruction illegal */
386 1.1.1.2 christos No_sSuf,
387 1.1.1.2 christos /* q suffix on instruction illegal */
388 1.1.1.2 christos No_qSuf,
389 1.1.1.2 christos /* long double suffix on instruction illegal */
390 1.1.1.2 christos No_ldSuf,
391 1.1.1.2 christos /* instruction needs FWAIT */
392 1.1.1.2 christos FWait,
393 1.1.1.2 christos /* quick test for string instructions */
394 1.1.1.2 christos IsString,
395 1.1.1.4 christos /* quick test if branch instruction is MPX supported */
396 1.1.1.4 christos BNDPrefixOk,
397 1.1.1.2 christos /* quick test for lockable instructions */
398 1.1.1.2 christos IsLockable,
399 1.1.1.2 christos /* fake an extra reg operand for clr, imul and special register
400 1.1.1.2 christos processing for some instructions. */
401 1.1.1.2 christos RegKludge,
402 1.1.1.2 christos /* The first operand must be xmm0 */
403 1.1.1.2 christos FirstXmm0,
404 1.1.1.2 christos /* An implicit xmm0 as the first operand */
405 1.1.1.2 christos Implicit1stXmm0,
406 1.1.1.3 christos /* The HLE prefix is OK:
407 1.1.1.3 christos 1. With a LOCK prefix.
408 1.1.1.3 christos 2. With or without a LOCK prefix.
409 1.1.1.3 christos 3. With a RELEASE (0xf3) prefix.
410 1.1.1.3 christos */
411 1.1.1.3 christos #define HLEPrefixNone 0
412 1.1.1.3 christos #define HLEPrefixLock 1
413 1.1.1.3 christos #define HLEPrefixAny 2
414 1.1.1.3 christos #define HLEPrefixRelease 3
415 1.1.1.3 christos HLEPrefixOk,
416 1.1.1.3 christos /* An instruction on which a "rep" prefix is acceptable. */
417 1.1.1.3 christos RepPrefixOk,
418 1.1.1.2 christos /* Convert to DWORD */
419 1.1.1.2 christos ToDword,
420 1.1.1.2 christos /* Convert to QWORD */
421 1.1.1.2 christos ToQword,
422 1.1.1.2 christos /* Address prefix changes operand 0 */
423 1.1.1.2 christos AddrPrefixOp0,
424 1.1.1.2 christos /* opcode is a prefix */
425 1.1.1.2 christos IsPrefix,
426 1.1.1.2 christos /* instruction has extension in 8 bit imm */
427 1.1.1.2 christos ImmExt,
428 1.1.1.2 christos /* instruction don't need Rex64 prefix. */
429 1.1.1.2 christos NoRex64,
430 1.1.1.2 christos /* instruction require Rex64 prefix. */
431 1.1.1.2 christos Rex64,
432 1.1.1.2 christos /* deprecated fp insn, gets a warning */
433 1.1.1.2 christos Ugh,
434 1.1.1.2 christos /* insn has VEX prefix:
435 1.1.1.2 christos 1: 128bit VEX prefix.
436 1.1.1.2 christos 2: 256bit VEX prefix.
437 1.1.1.2 christos 3: Scalar VEX prefix.
438 1.1.1.2 christos */
439 1.1.1.2 christos #define VEX128 1
440 1.1.1.2 christos #define VEX256 2
441 1.1.1.2 christos #define VEXScalar 3
442 1.1.1.2 christos Vex,
443 1.1.1.2 christos /* How to encode VEX.vvvv:
444 1.1.1.2 christos 0: VEX.vvvv must be 1111b.
445 1.1.1.2 christos 1: VEX.NDS. Register-only source is encoded in VEX.vvvv where
446 1.1.1.2 christos the content of source registers will be preserved.
447 1.1.1.3 christos VEX.DDS. The second register operand is encoded in VEX.vvvv
448 1.1.1.2 christos where the content of first source register will be overwritten
449 1.1.1.2 christos by the result.
450 1.1.1.3 christos VEX.NDD2. The second destination register operand is encoded in
451 1.1.1.3 christos VEX.vvvv for instructions with 2 destination register operands.
452 1.1.1.3 christos For assembler, there are no difference between VEX.NDS, VEX.DDS
453 1.1.1.3 christos and VEX.NDD2.
454 1.1.1.3 christos 2. VEX.NDD. Register destination is encoded in VEX.vvvv for
455 1.1.1.3 christos instructions with 1 destination register operand.
456 1.1.1.2 christos 3. VEX.LWP. Register destination is encoded in VEX.vvvv and one
457 1.1.1.2 christos of the operands can access a memory location.
458 1.1.1.2 christos */
459 1.1.1.2 christos #define VEXXDS 1
460 1.1.1.2 christos #define VEXNDD 2
461 1.1.1.2 christos #define VEXLWP 3
462 1.1.1.2 christos VexVVVV,
463 1.1.1.2 christos /* How the VEX.W bit is used:
464 1.1.1.2 christos 0: Set by the REX.W bit.
465 1.1.1.2 christos 1: VEX.W0. Should always be 0.
466 1.1.1.2 christos 2: VEX.W1. Should always be 1.
467 1.1.1.2 christos */
468 1.1.1.2 christos #define VEXW0 1
469 1.1.1.2 christos #define VEXW1 2
470 1.1.1.2 christos VexW,
471 1.1.1.2 christos /* VEX opcode prefix:
472 1.1.1.2 christos 0: VEX 0x0F opcode prefix.
473 1.1.1.2 christos 1: VEX 0x0F38 opcode prefix.
474 1.1.1.2 christos 2: VEX 0x0F3A opcode prefix
475 1.1.1.2 christos 3: XOP 0x08 opcode prefix.
476 1.1.1.2 christos 4: XOP 0x09 opcode prefix
477 1.1.1.2 christos 5: XOP 0x0A opcode prefix.
478 1.1.1.2 christos */
479 1.1.1.2 christos #define VEX0F 0
480 1.1.1.2 christos #define VEX0F38 1
481 1.1.1.2 christos #define VEX0F3A 2
482 1.1.1.2 christos #define XOP08 3
483 1.1.1.2 christos #define XOP09 4
484 1.1.1.2 christos #define XOP0A 5
485 1.1.1.2 christos VexOpcode,
486 1.1.1.2 christos /* number of VEX source operands:
487 1.1.1.2 christos 0: <= 2 source operands.
488 1.1.1.2 christos 1: 2 XOP source operands.
489 1.1.1.2 christos 2: 3 source operands.
490 1.1.1.2 christos */
491 1.1.1.2 christos #define XOP2SOURCES 1
492 1.1.1.2 christos #define VEX3SOURCES 2
493 1.1.1.2 christos VexSources,
494 1.1.1.2 christos /* instruction has VEX 8 bit imm */
495 1.1.1.2 christos VexImmExt,
496 1.1.1.3 christos /* Instruction with vector SIB byte:
497 1.1.1.3 christos 1: 128bit vector register.
498 1.1.1.3 christos 2: 256bit vector register.
499 1.1.1.4 christos 3: 512bit vector register.
500 1.1.1.3 christos */
501 1.1.1.3 christos #define VecSIB128 1
502 1.1.1.3 christos #define VecSIB256 2
503 1.1.1.4 christos #define VecSIB512 3
504 1.1.1.3 christos VecSIB,
505 1.1.1.2 christos /* SSE to AVX support required */
506 1.1.1.2 christos SSE2AVX,
507 1.1.1.2 christos /* No AVX equivalent */
508 1.1.1.2 christos NoAVX,
509 1.1.1.4 christos
510 1.1.1.4 christos /* insn has EVEX prefix:
511 1.1.1.4 christos 1: 512bit EVEX prefix.
512 1.1.1.4 christos 2: 128bit EVEX prefix.
513 1.1.1.4 christos 3: 256bit EVEX prefix.
514 1.1.1.4 christos 4: Length-ignored (LIG) EVEX prefix.
515 1.1.1.4 christos */
516 1.1.1.4 christos #define EVEX512 1
517 1.1.1.4 christos #define EVEX128 2
518 1.1.1.4 christos #define EVEX256 3
519 1.1.1.4 christos #define EVEXLIG 4
520 1.1.1.4 christos EVex,
521 1.1.1.4 christos
522 1.1.1.4 christos /* AVX512 masking support:
523 1.1.1.4 christos 1: Zeroing-masking.
524 1.1.1.4 christos 2: Merging-masking.
525 1.1.1.4 christos 3: Both zeroing and merging masking.
526 1.1.1.4 christos */
527 1.1.1.4 christos #define ZEROING_MASKING 1
528 1.1.1.4 christos #define MERGING_MASKING 2
529 1.1.1.4 christos #define BOTH_MASKING 3
530 1.1.1.4 christos Masking,
531 1.1.1.4 christos
532 1.1.1.4 christos /* Input element size of vector insn:
533 1.1.1.4 christos 0: 32bit.
534 1.1.1.4 christos 1: 64bit.
535 1.1.1.4 christos */
536 1.1.1.4 christos VecESize,
537 1.1.1.4 christos
538 1.1.1.4 christos /* Broadcast factor.
539 1.1.1.4 christos 0: No broadcast.
540 1.1.1.4 christos 1: 1to16 broadcast.
541 1.1.1.4 christos 2: 1to8 broadcast.
542 1.1.1.4 christos */
543 1.1.1.4 christos #define NO_BROADCAST 0
544 1.1.1.4 christos #define BROADCAST_1TO16 1
545 1.1.1.4 christos #define BROADCAST_1TO8 2
546 1.1.1.4 christos #define BROADCAST_1TO4 3
547 1.1.1.4 christos #define BROADCAST_1TO2 4
548 1.1.1.4 christos Broadcast,
549 1.1.1.4 christos
550 1.1.1.4 christos /* Static rounding control is supported. */
551 1.1.1.4 christos StaticRounding,
552 1.1.1.4 christos
553 1.1.1.4 christos /* Supress All Exceptions is supported. */
554 1.1.1.4 christos SAE,
555 1.1.1.4 christos
556 1.1.1.4 christos /* Copressed Disp8*N attribute. */
557 1.1.1.4 christos Disp8MemShift,
558 1.1.1.4 christos
559 1.1.1.4 christos /* Default mask isn't allowed. */
560 1.1.1.4 christos NoDefMask,
561 1.1.1.4 christos
562 1.1.1.2 christos /* Compatible with old (<= 2.8.1) versions of gcc */
563 1.1.1.2 christos OldGcc,
564 1.1.1.2 christos /* AT&T mnemonic. */
565 1.1.1.2 christos ATTMnemonic,
566 1.1.1.2 christos /* AT&T syntax. */
567 1.1.1.2 christos ATTSyntax,
568 1.1.1.2 christos /* Intel syntax. */
569 1.1.1.2 christos IntelSyntax,
570 1.1.1.5 christos /* AMD64. */
571 1.1.1.5 christos AMD64,
572 1.1.1.5 christos /* Intel64. */
573 1.1.1.5 christos Intel64,
574 1.1.1.2 christos /* The last bitfield in i386_opcode_modifier. */
575 1.1.1.2 christos Opcode_Modifier_Max
576 1.1.1.2 christos };
577 1.1 skrll
578 1.1 skrll typedef struct i386_opcode_modifier
579 1.1 skrll {
580 1.1 skrll unsigned int d:1;
581 1.1 skrll unsigned int w:1;
582 1.1.1.2 christos unsigned int s:1;
583 1.1 skrll unsigned int modrm:1;
584 1.1 skrll unsigned int shortform:1;
585 1.1 skrll unsigned int jump:1;
586 1.1 skrll unsigned int jumpdword:1;
587 1.1 skrll unsigned int jumpbyte:1;
588 1.1 skrll unsigned int jumpintersegment:1;
589 1.1 skrll unsigned int floatmf:1;
590 1.1 skrll unsigned int floatr:1;
591 1.1 skrll unsigned int floatd:1;
592 1.1 skrll unsigned int size16:1;
593 1.1 skrll unsigned int size32:1;
594 1.1 skrll unsigned int size64:1;
595 1.1.1.2 christos unsigned int checkregsize:1;
596 1.1 skrll unsigned int ignoresize:1;
597 1.1 skrll unsigned int defaultsize:1;
598 1.1 skrll unsigned int no_bsuf:1;
599 1.1 skrll unsigned int no_wsuf:1;
600 1.1 skrll unsigned int no_lsuf:1;
601 1.1 skrll unsigned int no_ssuf:1;
602 1.1 skrll unsigned int no_qsuf:1;
603 1.1 skrll unsigned int no_ldsuf:1;
604 1.1 skrll unsigned int fwait:1;
605 1.1 skrll unsigned int isstring:1;
606 1.1.1.4 christos unsigned int bndprefixok:1;
607 1.1.1.2 christos unsigned int islockable:1;
608 1.1 skrll unsigned int regkludge:1;
609 1.1 skrll unsigned int firstxmm0:1;
610 1.1 skrll unsigned int implicit1stxmm0:1;
611 1.1.1.3 christos unsigned int hleprefixok:2;
612 1.1.1.3 christos unsigned int repprefixok:1;
613 1.1 skrll unsigned int todword:1;
614 1.1 skrll unsigned int toqword:1;
615 1.1 skrll unsigned int addrprefixop0:1;
616 1.1 skrll unsigned int isprefix:1;
617 1.1 skrll unsigned int immext:1;
618 1.1 skrll unsigned int norex64:1;
619 1.1 skrll unsigned int rex64:1;
620 1.1 skrll unsigned int ugh:1;
621 1.1.1.2 christos unsigned int vex:2;
622 1.1.1.2 christos unsigned int vexvvvv:2;
623 1.1.1.2 christos unsigned int vexw:2;
624 1.1.1.2 christos unsigned int vexopcode:3;
625 1.1.1.2 christos unsigned int vexsources:2;
626 1.1 skrll unsigned int veximmext:1;
627 1.1.1.3 christos unsigned int vecsib:2;
628 1.1 skrll unsigned int sse2avx:1;
629 1.1 skrll unsigned int noavx:1;
630 1.1.1.4 christos unsigned int evex:3;
631 1.1.1.4 christos unsigned int masking:2;
632 1.1.1.4 christos unsigned int vecesize:1;
633 1.1.1.4 christos unsigned int broadcast:3;
634 1.1.1.4 christos unsigned int staticrounding:1;
635 1.1.1.4 christos unsigned int sae:1;
636 1.1.1.4 christos unsigned int disp8memshift:3;
637 1.1.1.4 christos unsigned int nodefmask:1;
638 1.1 skrll unsigned int oldgcc:1;
639 1.1 skrll unsigned int attmnemonic:1;
640 1.1 skrll unsigned int attsyntax:1;
641 1.1 skrll unsigned int intelsyntax:1;
642 1.1.1.5 christos unsigned int amd64:1;
643 1.1.1.5 christos unsigned int intel64:1;
644 1.1 skrll } i386_opcode_modifier;
645 1.1 skrll
646 1.1 skrll /* Position of operand_type bits. */
647 1.1 skrll
648 1.1.1.2 christos enum
649 1.1.1.2 christos {
650 1.1.1.2 christos /* 8bit register */
651 1.1.1.2 christos Reg8 = 0,
652 1.1.1.2 christos /* 16bit register */
653 1.1.1.2 christos Reg16,
654 1.1.1.2 christos /* 32bit register */
655 1.1.1.2 christos Reg32,
656 1.1.1.2 christos /* 64bit register */
657 1.1.1.2 christos Reg64,
658 1.1.1.2 christos /* Floating pointer stack register */
659 1.1.1.2 christos FloatReg,
660 1.1.1.2 christos /* MMX register */
661 1.1.1.2 christos RegMMX,
662 1.1.1.2 christos /* SSE register */
663 1.1.1.2 christos RegXMM,
664 1.1.1.2 christos /* AVX registers */
665 1.1.1.2 christos RegYMM,
666 1.1.1.4 christos /* AVX512 registers */
667 1.1.1.4 christos RegZMM,
668 1.1.1.4 christos /* Vector Mask registers */
669 1.1.1.4 christos RegMask,
670 1.1.1.2 christos /* Control register */
671 1.1.1.2 christos Control,
672 1.1.1.2 christos /* Debug register */
673 1.1.1.2 christos Debug,
674 1.1.1.2 christos /* Test register */
675 1.1.1.2 christos Test,
676 1.1.1.2 christos /* 2 bit segment register */
677 1.1.1.2 christos SReg2,
678 1.1.1.2 christos /* 3 bit segment register */
679 1.1.1.2 christos SReg3,
680 1.1.1.2 christos /* 1 bit immediate */
681 1.1.1.2 christos Imm1,
682 1.1.1.2 christos /* 8 bit immediate */
683 1.1.1.2 christos Imm8,
684 1.1.1.2 christos /* 8 bit immediate sign extended */
685 1.1.1.2 christos Imm8S,
686 1.1.1.2 christos /* 16 bit immediate */
687 1.1.1.2 christos Imm16,
688 1.1.1.2 christos /* 32 bit immediate */
689 1.1.1.2 christos Imm32,
690 1.1.1.2 christos /* 32 bit immediate sign extended */
691 1.1.1.2 christos Imm32S,
692 1.1.1.2 christos /* 64 bit immediate */
693 1.1.1.2 christos Imm64,
694 1.1.1.2 christos /* 8bit/16bit/32bit displacements are used in different ways,
695 1.1.1.2 christos depending on the instruction. For jumps, they specify the
696 1.1.1.2 christos size of the PC relative displacement, for instructions with
697 1.1.1.2 christos memory operand, they specify the size of the offset relative
698 1.1.1.2 christos to the base register, and for instructions with memory offset
699 1.1.1.2 christos such as `mov 1234,%al' they specify the size of the offset
700 1.1.1.2 christos relative to the segment base. */
701 1.1.1.2 christos /* 8 bit displacement */
702 1.1.1.2 christos Disp8,
703 1.1.1.2 christos /* 16 bit displacement */
704 1.1.1.2 christos Disp16,
705 1.1.1.2 christos /* 32 bit displacement */
706 1.1.1.2 christos Disp32,
707 1.1.1.2 christos /* 32 bit signed displacement */
708 1.1.1.2 christos Disp32S,
709 1.1.1.2 christos /* 64 bit displacement */
710 1.1.1.2 christos Disp64,
711 1.1.1.2 christos /* Accumulator %al/%ax/%eax/%rax */
712 1.1.1.2 christos Acc,
713 1.1.1.2 christos /* Floating pointer top stack register %st(0) */
714 1.1.1.2 christos FloatAcc,
715 1.1.1.2 christos /* Register which can be used for base or index in memory operand. */
716 1.1.1.2 christos BaseIndex,
717 1.1.1.2 christos /* Register to hold in/out port addr = dx */
718 1.1.1.2 christos InOutPortReg,
719 1.1.1.2 christos /* Register to hold shift count = cl */
720 1.1.1.2 christos ShiftCount,
721 1.1.1.2 christos /* Absolute address for jump. */
722 1.1.1.2 christos JumpAbsolute,
723 1.1.1.2 christos /* String insn operand with fixed es segment */
724 1.1.1.2 christos EsSeg,
725 1.1.1.2 christos /* RegMem is for instructions with a modrm byte where the register
726 1.1.1.2 christos destination operand should be encoded in the mod and regmem fields.
727 1.1.1.2 christos Normally, it will be encoded in the reg field. We add a RegMem
728 1.1.1.2 christos flag to the destination register operand to indicate that it should
729 1.1.1.2 christos be encoded in the regmem field. */
730 1.1.1.2 christos RegMem,
731 1.1.1.2 christos /* Memory. */
732 1.1.1.2 christos Mem,
733 1.1.1.2 christos /* BYTE memory. */
734 1.1.1.2 christos Byte,
735 1.1.1.2 christos /* WORD memory. 2 byte */
736 1.1.1.2 christos Word,
737 1.1.1.2 christos /* DWORD memory. 4 byte */
738 1.1.1.2 christos Dword,
739 1.1.1.2 christos /* FWORD memory. 6 byte */
740 1.1.1.2 christos Fword,
741 1.1.1.2 christos /* QWORD memory. 8 byte */
742 1.1.1.2 christos Qword,
743 1.1.1.2 christos /* TBYTE memory. 10 byte */
744 1.1.1.2 christos Tbyte,
745 1.1.1.2 christos /* XMMWORD memory. */
746 1.1.1.2 christos Xmmword,
747 1.1.1.2 christos /* YMMWORD memory. */
748 1.1.1.2 christos Ymmword,
749 1.1.1.4 christos /* ZMMWORD memory. */
750 1.1.1.4 christos Zmmword,
751 1.1.1.2 christos /* Unspecified memory size. */
752 1.1.1.2 christos Unspecified,
753 1.1.1.2 christos /* Any memory size. */
754 1.1.1.2 christos Anysize,
755 1.1.1.2 christos
756 1.1.1.2 christos /* Vector 4 bit immediate. */
757 1.1.1.2 christos Vec_Imm4,
758 1.1.1.2 christos
759 1.1.1.4 christos /* Bound register. */
760 1.1.1.4 christos RegBND,
761 1.1.1.4 christos
762 1.1.1.4 christos /* Vector 8bit displacement */
763 1.1.1.4 christos Vec_Disp8,
764 1.1.1.4 christos
765 1.1.1.2 christos /* The last bitfield in i386_operand_type. */
766 1.1.1.2 christos OTMax
767 1.1.1.2 christos };
768 1.1 skrll
769 1.1 skrll #define OTNumOfUints \
770 1.1 skrll (OTMax / sizeof (unsigned int) / CHAR_BIT + 1)
771 1.1 skrll #define OTNumOfBits \
772 1.1 skrll (OTNumOfUints * sizeof (unsigned int) * CHAR_BIT)
773 1.1 skrll
774 1.1 skrll /* If you get a compiler error for zero width of the unused field,
775 1.1 skrll comment it out. */
776 1.1 skrll #define OTUnused (OTMax + 1)
777 1.1 skrll
778 1.1 skrll typedef union i386_operand_type
779 1.1 skrll {
780 1.1 skrll struct
781 1.1 skrll {
782 1.1 skrll unsigned int reg8:1;
783 1.1 skrll unsigned int reg16:1;
784 1.1 skrll unsigned int reg32:1;
785 1.1 skrll unsigned int reg64:1;
786 1.1 skrll unsigned int floatreg:1;
787 1.1 skrll unsigned int regmmx:1;
788 1.1 skrll unsigned int regxmm:1;
789 1.1 skrll unsigned int regymm:1;
790 1.1.1.4 christos unsigned int regzmm:1;
791 1.1.1.4 christos unsigned int regmask:1;
792 1.1 skrll unsigned int control:1;
793 1.1 skrll unsigned int debug:1;
794 1.1 skrll unsigned int test:1;
795 1.1 skrll unsigned int sreg2:1;
796 1.1 skrll unsigned int sreg3:1;
797 1.1 skrll unsigned int imm1:1;
798 1.1 skrll unsigned int imm8:1;
799 1.1 skrll unsigned int imm8s:1;
800 1.1 skrll unsigned int imm16:1;
801 1.1 skrll unsigned int imm32:1;
802 1.1 skrll unsigned int imm32s:1;
803 1.1 skrll unsigned int imm64:1;
804 1.1 skrll unsigned int disp8:1;
805 1.1 skrll unsigned int disp16:1;
806 1.1 skrll unsigned int disp32:1;
807 1.1 skrll unsigned int disp32s:1;
808 1.1 skrll unsigned int disp64:1;
809 1.1 skrll unsigned int acc:1;
810 1.1 skrll unsigned int floatacc:1;
811 1.1 skrll unsigned int baseindex:1;
812 1.1 skrll unsigned int inoutportreg:1;
813 1.1 skrll unsigned int shiftcount:1;
814 1.1 skrll unsigned int jumpabsolute:1;
815 1.1 skrll unsigned int esseg:1;
816 1.1 skrll unsigned int regmem:1;
817 1.1 skrll unsigned int mem:1;
818 1.1 skrll unsigned int byte:1;
819 1.1 skrll unsigned int word:1;
820 1.1 skrll unsigned int dword:1;
821 1.1 skrll unsigned int fword:1;
822 1.1 skrll unsigned int qword:1;
823 1.1 skrll unsigned int tbyte:1;
824 1.1 skrll unsigned int xmmword:1;
825 1.1 skrll unsigned int ymmword:1;
826 1.1.1.4 christos unsigned int zmmword:1;
827 1.1 skrll unsigned int unspecified:1;
828 1.1 skrll unsigned int anysize:1;
829 1.1.1.2 christos unsigned int vec_imm4:1;
830 1.1.1.4 christos unsigned int regbnd:1;
831 1.1.1.4 christos unsigned int vec_disp8:1;
832 1.1 skrll #ifdef OTUnused
833 1.1 skrll unsigned int unused:(OTNumOfBits - OTUnused);
834 1.1 skrll #endif
835 1.1 skrll } bitfield;
836 1.1 skrll unsigned int array[OTNumOfUints];
837 1.1 skrll } i386_operand_type;
838 1.1 skrll
839 1.1.1.2 christos typedef struct insn_template
840 1.1 skrll {
841 1.1 skrll /* instruction name sans width suffix ("mov" for movl insns) */
842 1.1 skrll char *name;
843 1.1 skrll
844 1.1 skrll /* how many operands */
845 1.1 skrll unsigned int operands;
846 1.1 skrll
847 1.1 skrll /* base_opcode is the fundamental opcode byte without optional
848 1.1 skrll prefix(es). */
849 1.1 skrll unsigned int base_opcode;
850 1.1 skrll #define Opcode_D 0x2 /* Direction bit:
851 1.1 skrll set if Reg --> Regmem;
852 1.1 skrll unset if Regmem --> Reg. */
853 1.1 skrll #define Opcode_FloatR 0x8 /* Bit to swap src/dest for float insns. */
854 1.1 skrll #define Opcode_FloatD 0x400 /* Direction bit for float insns. */
855 1.1 skrll
856 1.1 skrll /* extension_opcode is the 3 bit extension for group <n> insns.
857 1.1 skrll This field is also used to store the 8-bit opcode suffix for the
858 1.1 skrll AMD 3DNow! instructions.
859 1.1.1.3 christos If this template has no extension opcode (the usual case) use None
860 1.1.1.2 christos Instructions */
861 1.1 skrll unsigned int extension_opcode;
862 1.1 skrll #define None 0xffff /* If no extension_opcode is possible. */
863 1.1 skrll
864 1.1 skrll /* Opcode length. */
865 1.1 skrll unsigned char opcode_length;
866 1.1 skrll
867 1.1 skrll /* cpu feature flags */
868 1.1 skrll i386_cpu_flags cpu_flags;
869 1.1 skrll
870 1.1 skrll /* the bits in opcode_modifier are used to generate the final opcode from
871 1.1 skrll the base_opcode. These bits also are used to detect alternate forms of
872 1.1 skrll the same instruction */
873 1.1 skrll i386_opcode_modifier opcode_modifier;
874 1.1 skrll
875 1.1 skrll /* operand_types[i] describes the type of operand i. This is made
876 1.1 skrll by OR'ing together all of the possible type masks. (e.g.
877 1.1 skrll 'operand_types[i] = Reg|Imm' specifies that operand i can be
878 1.1 skrll either a register or an immediate operand. */
879 1.1 skrll i386_operand_type operand_types[MAX_OPERANDS];
880 1.1 skrll }
881 1.1.1.2 christos insn_template;
882 1.1 skrll
883 1.1.1.2 christos extern const insn_template i386_optab[];
884 1.1 skrll
885 1.1 skrll /* these are for register name --> number & type hash lookup */
886 1.1 skrll typedef struct
887 1.1 skrll {
888 1.1 skrll char *reg_name;
889 1.1 skrll i386_operand_type reg_type;
890 1.1 skrll unsigned char reg_flags;
891 1.1 skrll #define RegRex 0x1 /* Extended register. */
892 1.1 skrll #define RegRex64 0x2 /* Extended 8 bit register. */
893 1.1.1.4 christos #define RegVRex 0x4 /* Extended vector register. */
894 1.1 skrll unsigned char reg_num;
895 1.1 skrll #define RegRip ((unsigned char ) ~0)
896 1.1 skrll #define RegEip (RegRip - 1)
897 1.1 skrll /* EIZ and RIZ are fake index registers. */
898 1.1 skrll #define RegEiz (RegEip - 1)
899 1.1 skrll #define RegRiz (RegEiz - 1)
900 1.1 skrll /* FLAT is a fake segment register (Intel mode). */
901 1.1 skrll #define RegFlat ((unsigned char) ~0)
902 1.1 skrll signed char dw2_regnum[2];
903 1.1 skrll #define Dw2Inval (-1)
904 1.1 skrll }
905 1.1 skrll reg_entry;
906 1.1 skrll
907 1.1 skrll /* Entries in i386_regtab. */
908 1.1 skrll #define REGNAM_AL 1
909 1.1 skrll #define REGNAM_AX 25
910 1.1 skrll #define REGNAM_EAX 41
911 1.1 skrll
912 1.1 skrll extern const reg_entry i386_regtab[];
913 1.1 skrll extern const unsigned int i386_regtab_size;
914 1.1 skrll
915 1.1 skrll typedef struct
916 1.1 skrll {
917 1.1 skrll char *seg_name;
918 1.1 skrll unsigned int seg_prefix;
919 1.1 skrll }
920 1.1 skrll seg_entry;
921 1.1 skrll
922 1.1 skrll extern const seg_entry cs;
923 1.1 skrll extern const seg_entry ds;
924 1.1 skrll extern const seg_entry ss;
925 1.1 skrll extern const seg_entry es;
926 1.1 skrll extern const seg_entry fs;
927 1.1 skrll extern const seg_entry gs;
928