i386-opc.h revision 1.1.1.6 1 1.1 skrll /* Declarations for Intel 80386 opcode table
2 1.1.1.6 christos Copyright (C) 2007-2018 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 /* Intel AVX-512 IFMA Instructions support required. */
192 1.1.1.4 christos CpuAVX512IFMA,
193 1.1.1.4 christos /* Intel AVX-512 VBMI Instructions support required. */
194 1.1.1.4 christos CpuAVX512VBMI,
195 1.1.1.6 christos /* Intel AVX-512 4FMAPS Instructions support required. */
196 1.1.1.6 christos CpuAVX512_4FMAPS,
197 1.1.1.6 christos /* Intel AVX-512 4VNNIW Instructions support required. */
198 1.1.1.6 christos CpuAVX512_4VNNIW,
199 1.1.1.6 christos /* Intel AVX-512 VPOPCNTDQ Instructions support required. */
200 1.1.1.6 christos CpuAVX512_VPOPCNTDQ,
201 1.1.1.6 christos /* Intel AVX-512 VBMI2 Instructions support required. */
202 1.1.1.6 christos CpuAVX512_VBMI2,
203 1.1.1.6 christos /* Intel AVX-512 VNNI Instructions support required. */
204 1.1.1.6 christos CpuAVX512_VNNI,
205 1.1.1.6 christos /* Intel AVX-512 BITALG Instructions support required. */
206 1.1.1.6 christos CpuAVX512_BITALG,
207 1.1.1.4 christos /* mwaitx instruction required */
208 1.1.1.4 christos CpuMWAITX,
209 1.1.1.4 christos /* Clzero instruction required */
210 1.1.1.4 christos CpuCLZERO,
211 1.1.1.4 christos /* OSPKE instruction required */
212 1.1.1.4 christos CpuOSPKE,
213 1.1.1.5 christos /* RDPID instruction required */
214 1.1.1.5 christos CpuRDPID,
215 1.1.1.6 christos /* PTWRITE instruction required */
216 1.1.1.6 christos CpuPTWRITE,
217 1.1.1.6 christos /* CET instruction support required */
218 1.1.1.6 christos CpuCET,
219 1.1.1.6 christos /* GFNI instructions required */
220 1.1.1.6 christos CpuGFNI,
221 1.1.1.6 christos /* VAES instructions required */
222 1.1.1.6 christos CpuVAES,
223 1.1.1.6 christos /* VPCLMULQDQ instructions required */
224 1.1.1.6 christos CpuVPCLMULQDQ,
225 1.1.1.5 christos /* MMX register support required */
226 1.1.1.5 christos CpuRegMMX,
227 1.1.1.5 christos /* XMM register support required */
228 1.1.1.5 christos CpuRegXMM,
229 1.1.1.5 christos /* YMM register support required */
230 1.1.1.5 christos CpuRegYMM,
231 1.1.1.5 christos /* ZMM register support required */
232 1.1.1.5 christos CpuRegZMM,
233 1.1.1.5 christos /* Mask register support required */
234 1.1.1.5 christos CpuRegMask,
235 1.1.1.2 christos /* 64bit support required */
236 1.1.1.2 christos Cpu64,
237 1.1.1.2 christos /* Not supported in the 64bit mode */
238 1.1.1.2 christos CpuNo64,
239 1.1.1.2 christos /* The last bitfield in i386_cpu_flags. */
240 1.1.1.2 christos CpuMax = CpuNo64
241 1.1.1.2 christos };
242 1.1 skrll
243 1.1 skrll #define CpuNumOfUints \
244 1.1 skrll (CpuMax / sizeof (unsigned int) / CHAR_BIT + 1)
245 1.1 skrll #define CpuNumOfBits \
246 1.1 skrll (CpuNumOfUints * sizeof (unsigned int) * CHAR_BIT)
247 1.1 skrll
248 1.1 skrll /* If you get a compiler error for zero width of the unused field,
249 1.1 skrll comment it out. */
250 1.1 skrll #define CpuUnused (CpuMax + 1)
251 1.1 skrll
252 1.1 skrll /* We can check if an instruction is available with array instead
253 1.1 skrll of bitfield. */
254 1.1 skrll typedef union i386_cpu_flags
255 1.1 skrll {
256 1.1 skrll struct
257 1.1 skrll {
258 1.1 skrll unsigned int cpui186:1;
259 1.1 skrll unsigned int cpui286:1;
260 1.1 skrll unsigned int cpui386:1;
261 1.1 skrll unsigned int cpui486:1;
262 1.1 skrll unsigned int cpui586:1;
263 1.1 skrll unsigned int cpui686:1;
264 1.1.1.2 christos unsigned int cpuclflush:1;
265 1.1.1.2 christos unsigned int cpunop:1;
266 1.1.1.2 christos unsigned int cpusyscall:1;
267 1.1.1.2 christos unsigned int cpu8087:1;
268 1.1.1.2 christos unsigned int cpu287:1;
269 1.1.1.2 christos unsigned int cpu387:1;
270 1.1.1.2 christos unsigned int cpu687:1;
271 1.1.1.2 christos unsigned int cpufisttp:1;
272 1.1 skrll unsigned int cpummx:1;
273 1.1 skrll unsigned int cpusse:1;
274 1.1 skrll unsigned int cpusse2:1;
275 1.1 skrll unsigned int cpua3dnow:1;
276 1.1 skrll unsigned int cpua3dnowa:1;
277 1.1 skrll unsigned int cpusse3:1;
278 1.1 skrll unsigned int cpupadlock:1;
279 1.1 skrll unsigned int cpusvme:1;
280 1.1 skrll unsigned int cpuvmx:1;
281 1.1 skrll unsigned int cpusmx:1;
282 1.1 skrll unsigned int cpussse3:1;
283 1.1 skrll unsigned int cpusse4a:1;
284 1.1 skrll unsigned int cpuabm:1;
285 1.1 skrll unsigned int cpusse4_1:1;
286 1.1 skrll unsigned int cpusse4_2:1;
287 1.1 skrll unsigned int cpuavx:1;
288 1.1.1.3 christos unsigned int cpuavx2:1;
289 1.1.1.4 christos unsigned int cpuavx512f:1;
290 1.1.1.4 christos unsigned int cpuavx512cd:1;
291 1.1.1.4 christos unsigned int cpuavx512er:1;
292 1.1.1.4 christos unsigned int cpuavx512pf:1;
293 1.1.1.4 christos unsigned int cpuavx512vl:1;
294 1.1.1.4 christos unsigned int cpuavx512dq:1;
295 1.1.1.4 christos unsigned int cpuavx512bw:1;
296 1.1.1.2 christos unsigned int cpul1om:1;
297 1.1.1.3 christos unsigned int cpuk1om:1;
298 1.1.1.4 christos unsigned int cpuiamcu:1;
299 1.1 skrll unsigned int cpuxsave:1;
300 1.1.1.2 christos unsigned int cpuxsaveopt:1;
301 1.1 skrll unsigned int cpuaes:1;
302 1.1 skrll unsigned int cpupclmul:1;
303 1.1 skrll unsigned int cpufma:1;
304 1.1.1.2 christos unsigned int cpufma4:1;
305 1.1.1.2 christos unsigned int cpuxop:1;
306 1.1.1.2 christos unsigned int cpulwp:1;
307 1.1.1.3 christos unsigned int cpubmi:1;
308 1.1.1.3 christos unsigned int cputbm:1;
309 1.1 skrll unsigned int cpumovbe:1;
310 1.1.1.4 christos unsigned int cpucx16:1;
311 1.1 skrll unsigned int cpuept:1;
312 1.1.1.2 christos unsigned int cpurdtscp:1;
313 1.1.1.2 christos unsigned int cpufsgsbase:1;
314 1.1.1.2 christos unsigned int cpurdrnd:1;
315 1.1.1.2 christos unsigned int cpuf16c:1;
316 1.1.1.3 christos unsigned int cpubmi2:1;
317 1.1.1.3 christos unsigned int cpulzcnt:1;
318 1.1.1.3 christos unsigned int cpuhle:1;
319 1.1.1.3 christos unsigned int cpurtm:1;
320 1.1.1.3 christos unsigned int cpuinvpcid:1;
321 1.1.1.3 christos unsigned int cpuvmfunc:1;
322 1.1.1.4 christos unsigned int cpumpx:1;
323 1.1 skrll unsigned int cpulm:1;
324 1.1.1.3 christos unsigned int cpurdseed:1;
325 1.1.1.3 christos unsigned int cpuadx:1;
326 1.1.1.3 christos unsigned int cpuprfchw:1;
327 1.1.1.4 christos unsigned int cpusmap:1;
328 1.1.1.4 christos unsigned int cpusha:1;
329 1.1.1.4 christos unsigned int cpuvrex:1;
330 1.1.1.4 christos unsigned int cpuclflushopt:1;
331 1.1.1.4 christos unsigned int cpuxsaves:1;
332 1.1.1.4 christos unsigned int cpuxsavec:1;
333 1.1.1.4 christos unsigned int cpuprefetchwt1:1;
334 1.1.1.4 christos unsigned int cpuse1:1;
335 1.1.1.4 christos unsigned int cpuclwb:1;
336 1.1.1.4 christos unsigned int cpuavx512ifma:1;
337 1.1.1.4 christos unsigned int cpuavx512vbmi:1;
338 1.1.1.6 christos unsigned int cpuavx512_4fmaps:1;
339 1.1.1.6 christos unsigned int cpuavx512_4vnniw:1;
340 1.1.1.6 christos unsigned int cpuavx512_vpopcntdq:1;
341 1.1.1.6 christos unsigned int cpuavx512_vbmi2:1;
342 1.1.1.6 christos unsigned int cpuavx512_vnni:1;
343 1.1.1.6 christos unsigned int cpuavx512_bitalg:1;
344 1.1.1.4 christos unsigned int cpumwaitx:1;
345 1.1.1.4 christos unsigned int cpuclzero:1;
346 1.1.1.4 christos unsigned int cpuospke:1;
347 1.1.1.5 christos unsigned int cpurdpid:1;
348 1.1.1.6 christos unsigned int cpuptwrite:1;
349 1.1.1.6 christos unsigned int cpucet:1;
350 1.1.1.6 christos unsigned int cpugfni:1;
351 1.1.1.6 christos unsigned int cpuvaes:1;
352 1.1.1.6 christos unsigned int cpuvpclmulqdq:1;
353 1.1.1.5 christos unsigned int cpuregmmx:1;
354 1.1.1.5 christos unsigned int cpuregxmm:1;
355 1.1.1.5 christos unsigned int cpuregymm:1;
356 1.1.1.5 christos unsigned int cpuregzmm:1;
357 1.1.1.5 christos unsigned int cpuregmask:1;
358 1.1 skrll unsigned int cpu64:1;
359 1.1 skrll unsigned int cpuno64:1;
360 1.1 skrll #ifdef CpuUnused
361 1.1 skrll unsigned int unused:(CpuNumOfBits - CpuUnused);
362 1.1 skrll #endif
363 1.1 skrll } bitfield;
364 1.1 skrll unsigned int array[CpuNumOfUints];
365 1.1 skrll } i386_cpu_flags;
366 1.1 skrll
367 1.1 skrll /* Position of opcode_modifier bits. */
368 1.1 skrll
369 1.1.1.2 christos enum
370 1.1.1.2 christos {
371 1.1.1.2 christos /* has direction bit. */
372 1.1.1.2 christos D = 0,
373 1.1.1.2 christos /* set if operands can be words or dwords encoded the canonical way */
374 1.1.1.2 christos W,
375 1.1.1.6 christos /* load form instruction. Must be placed before store form. */
376 1.1.1.6 christos Load,
377 1.1.1.2 christos /* insn has a modrm byte. */
378 1.1.1.2 christos Modrm,
379 1.1.1.2 christos /* register is in low 3 bits of opcode */
380 1.1.1.2 christos ShortForm,
381 1.1.1.2 christos /* special case for jump insns. */
382 1.1.1.2 christos Jump,
383 1.1.1.2 christos /* call and jump */
384 1.1.1.2 christos JumpDword,
385 1.1.1.2 christos /* loop and jecxz */
386 1.1.1.2 christos JumpByte,
387 1.1.1.2 christos /* special case for intersegment leaps/calls */
388 1.1.1.2 christos JumpInterSegment,
389 1.1.1.2 christos /* FP insn memory format bit, sized by 0x4 */
390 1.1.1.2 christos FloatMF,
391 1.1.1.2 christos /* src/dest swap for floats. */
392 1.1.1.2 christos FloatR,
393 1.1.1.2 christos /* has float insn direction bit. */
394 1.1.1.2 christos FloatD,
395 1.1.1.2 christos /* needs size prefix if in 32-bit mode */
396 1.1.1.2 christos Size16,
397 1.1.1.2 christos /* needs size prefix if in 16-bit mode */
398 1.1.1.2 christos Size32,
399 1.1.1.2 christos /* needs size prefix if in 64-bit mode */
400 1.1.1.2 christos Size64,
401 1.1.1.2 christos /* check register size. */
402 1.1.1.2 christos CheckRegSize,
403 1.1.1.2 christos /* instruction ignores operand size prefix and in Intel mode ignores
404 1.1.1.2 christos mnemonic size suffix check. */
405 1.1.1.2 christos IgnoreSize,
406 1.1.1.2 christos /* default insn size depends on mode */
407 1.1.1.2 christos DefaultSize,
408 1.1.1.2 christos /* b suffix on instruction illegal */
409 1.1.1.2 christos No_bSuf,
410 1.1.1.2 christos /* w suffix on instruction illegal */
411 1.1.1.2 christos No_wSuf,
412 1.1.1.2 christos /* l suffix on instruction illegal */
413 1.1.1.2 christos No_lSuf,
414 1.1.1.2 christos /* s suffix on instruction illegal */
415 1.1.1.2 christos No_sSuf,
416 1.1.1.2 christos /* q suffix on instruction illegal */
417 1.1.1.2 christos No_qSuf,
418 1.1.1.2 christos /* long double suffix on instruction illegal */
419 1.1.1.2 christos No_ldSuf,
420 1.1.1.2 christos /* instruction needs FWAIT */
421 1.1.1.2 christos FWait,
422 1.1.1.2 christos /* quick test for string instructions */
423 1.1.1.2 christos IsString,
424 1.1.1.4 christos /* quick test if branch instruction is MPX supported */
425 1.1.1.4 christos BNDPrefixOk,
426 1.1.1.6 christos /* quick test if NOTRACK prefix is supported */
427 1.1.1.6 christos NoTrackPrefixOk,
428 1.1.1.2 christos /* quick test for lockable instructions */
429 1.1.1.2 christos IsLockable,
430 1.1.1.2 christos /* fake an extra reg operand for clr, imul and special register
431 1.1.1.2 christos processing for some instructions. */
432 1.1.1.2 christos RegKludge,
433 1.1.1.2 christos /* An implicit xmm0 as the first operand */
434 1.1.1.2 christos Implicit1stXmm0,
435 1.1.1.3 christos /* The HLE prefix is OK:
436 1.1.1.3 christos 1. With a LOCK prefix.
437 1.1.1.3 christos 2. With or without a LOCK prefix.
438 1.1.1.3 christos 3. With a RELEASE (0xf3) prefix.
439 1.1.1.3 christos */
440 1.1.1.3 christos #define HLEPrefixNone 0
441 1.1.1.3 christos #define HLEPrefixLock 1
442 1.1.1.3 christos #define HLEPrefixAny 2
443 1.1.1.3 christos #define HLEPrefixRelease 3
444 1.1.1.3 christos HLEPrefixOk,
445 1.1.1.3 christos /* An instruction on which a "rep" prefix is acceptable. */
446 1.1.1.3 christos RepPrefixOk,
447 1.1.1.2 christos /* Convert to DWORD */
448 1.1.1.2 christos ToDword,
449 1.1.1.2 christos /* Convert to QWORD */
450 1.1.1.2 christos ToQword,
451 1.1.1.2 christos /* Address prefix changes operand 0 */
452 1.1.1.2 christos AddrPrefixOp0,
453 1.1.1.2 christos /* opcode is a prefix */
454 1.1.1.2 christos IsPrefix,
455 1.1.1.2 christos /* instruction has extension in 8 bit imm */
456 1.1.1.2 christos ImmExt,
457 1.1.1.2 christos /* instruction don't need Rex64 prefix. */
458 1.1.1.2 christos NoRex64,
459 1.1.1.2 christos /* instruction require Rex64 prefix. */
460 1.1.1.2 christos Rex64,
461 1.1.1.2 christos /* deprecated fp insn, gets a warning */
462 1.1.1.2 christos Ugh,
463 1.1.1.2 christos /* insn has VEX prefix:
464 1.1.1.6 christos 1: 128bit VEX prefix (or operand dependent).
465 1.1.1.2 christos 2: 256bit VEX prefix.
466 1.1.1.2 christos 3: Scalar VEX prefix.
467 1.1.1.2 christos */
468 1.1.1.2 christos #define VEX128 1
469 1.1.1.2 christos #define VEX256 2
470 1.1.1.2 christos #define VEXScalar 3
471 1.1.1.2 christos Vex,
472 1.1.1.2 christos /* How to encode VEX.vvvv:
473 1.1.1.2 christos 0: VEX.vvvv must be 1111b.
474 1.1.1.2 christos 1: VEX.NDS. Register-only source is encoded in VEX.vvvv where
475 1.1.1.2 christos the content of source registers will be preserved.
476 1.1.1.3 christos VEX.DDS. The second register operand is encoded in VEX.vvvv
477 1.1.1.2 christos where the content of first source register will be overwritten
478 1.1.1.2 christos by the result.
479 1.1.1.3 christos VEX.NDD2. The second destination register operand is encoded in
480 1.1.1.3 christos VEX.vvvv for instructions with 2 destination register operands.
481 1.1.1.3 christos For assembler, there are no difference between VEX.NDS, VEX.DDS
482 1.1.1.3 christos and VEX.NDD2.
483 1.1.1.3 christos 2. VEX.NDD. Register destination is encoded in VEX.vvvv for
484 1.1.1.3 christos instructions with 1 destination register operand.
485 1.1.1.2 christos 3. VEX.LWP. Register destination is encoded in VEX.vvvv and one
486 1.1.1.2 christos of the operands can access a memory location.
487 1.1.1.2 christos */
488 1.1.1.2 christos #define VEXXDS 1
489 1.1.1.2 christos #define VEXNDD 2
490 1.1.1.2 christos #define VEXLWP 3
491 1.1.1.2 christos VexVVVV,
492 1.1.1.2 christos /* How the VEX.W bit is used:
493 1.1.1.2 christos 0: Set by the REX.W bit.
494 1.1.1.2 christos 1: VEX.W0. Should always be 0.
495 1.1.1.2 christos 2: VEX.W1. Should always be 1.
496 1.1.1.2 christos */
497 1.1.1.2 christos #define VEXW0 1
498 1.1.1.2 christos #define VEXW1 2
499 1.1.1.2 christos VexW,
500 1.1.1.2 christos /* VEX opcode prefix:
501 1.1.1.2 christos 0: VEX 0x0F opcode prefix.
502 1.1.1.2 christos 1: VEX 0x0F38 opcode prefix.
503 1.1.1.2 christos 2: VEX 0x0F3A opcode prefix
504 1.1.1.2 christos 3: XOP 0x08 opcode prefix.
505 1.1.1.2 christos 4: XOP 0x09 opcode prefix
506 1.1.1.2 christos 5: XOP 0x0A opcode prefix.
507 1.1.1.2 christos */
508 1.1.1.2 christos #define VEX0F 0
509 1.1.1.2 christos #define VEX0F38 1
510 1.1.1.2 christos #define VEX0F3A 2
511 1.1.1.2 christos #define XOP08 3
512 1.1.1.2 christos #define XOP09 4
513 1.1.1.2 christos #define XOP0A 5
514 1.1.1.2 christos VexOpcode,
515 1.1.1.2 christos /* number of VEX source operands:
516 1.1.1.2 christos 0: <= 2 source operands.
517 1.1.1.2 christos 1: 2 XOP source operands.
518 1.1.1.2 christos 2: 3 source operands.
519 1.1.1.2 christos */
520 1.1.1.2 christos #define XOP2SOURCES 1
521 1.1.1.2 christos #define VEX3SOURCES 2
522 1.1.1.2 christos VexSources,
523 1.1.1.2 christos /* instruction has VEX 8 bit imm */
524 1.1.1.2 christos VexImmExt,
525 1.1.1.3 christos /* Instruction with vector SIB byte:
526 1.1.1.3 christos 1: 128bit vector register.
527 1.1.1.3 christos 2: 256bit vector register.
528 1.1.1.4 christos 3: 512bit vector register.
529 1.1.1.3 christos */
530 1.1.1.3 christos #define VecSIB128 1
531 1.1.1.3 christos #define VecSIB256 2
532 1.1.1.4 christos #define VecSIB512 3
533 1.1.1.3 christos VecSIB,
534 1.1.1.2 christos /* SSE to AVX support required */
535 1.1.1.2 christos SSE2AVX,
536 1.1.1.2 christos /* No AVX equivalent */
537 1.1.1.2 christos NoAVX,
538 1.1.1.4 christos
539 1.1.1.4 christos /* insn has EVEX prefix:
540 1.1.1.4 christos 1: 512bit EVEX prefix.
541 1.1.1.4 christos 2: 128bit EVEX prefix.
542 1.1.1.4 christos 3: 256bit EVEX prefix.
543 1.1.1.4 christos 4: Length-ignored (LIG) EVEX prefix.
544 1.1.1.4 christos */
545 1.1.1.4 christos #define EVEX512 1
546 1.1.1.4 christos #define EVEX128 2
547 1.1.1.4 christos #define EVEX256 3
548 1.1.1.4 christos #define EVEXLIG 4
549 1.1.1.4 christos EVex,
550 1.1.1.4 christos
551 1.1.1.4 christos /* AVX512 masking support:
552 1.1.1.4 christos 1: Zeroing-masking.
553 1.1.1.4 christos 2: Merging-masking.
554 1.1.1.4 christos 3: Both zeroing and merging masking.
555 1.1.1.4 christos */
556 1.1.1.4 christos #define ZEROING_MASKING 1
557 1.1.1.4 christos #define MERGING_MASKING 2
558 1.1.1.4 christos #define BOTH_MASKING 3
559 1.1.1.4 christos Masking,
560 1.1.1.4 christos
561 1.1.1.4 christos /* Input element size of vector insn:
562 1.1.1.4 christos 0: 32bit.
563 1.1.1.4 christos 1: 64bit.
564 1.1.1.4 christos */
565 1.1.1.4 christos VecESize,
566 1.1.1.4 christos
567 1.1.1.4 christos /* Broadcast factor.
568 1.1.1.4 christos 0: No broadcast.
569 1.1.1.4 christos 1: 1to16 broadcast.
570 1.1.1.4 christos 2: 1to8 broadcast.
571 1.1.1.4 christos */
572 1.1.1.4 christos #define NO_BROADCAST 0
573 1.1.1.4 christos #define BROADCAST_1TO16 1
574 1.1.1.4 christos #define BROADCAST_1TO8 2
575 1.1.1.4 christos #define BROADCAST_1TO4 3
576 1.1.1.4 christos #define BROADCAST_1TO2 4
577 1.1.1.4 christos Broadcast,
578 1.1.1.4 christos
579 1.1.1.4 christos /* Static rounding control is supported. */
580 1.1.1.4 christos StaticRounding,
581 1.1.1.4 christos
582 1.1.1.4 christos /* Supress All Exceptions is supported. */
583 1.1.1.4 christos SAE,
584 1.1.1.4 christos
585 1.1.1.4 christos /* Copressed Disp8*N attribute. */
586 1.1.1.4 christos Disp8MemShift,
587 1.1.1.4 christos
588 1.1.1.4 christos /* Default mask isn't allowed. */
589 1.1.1.4 christos NoDefMask,
590 1.1.1.4 christos
591 1.1.1.6 christos /* The second operand must be a vector register, {x,y,z}mmN, where N is a multiple of 4.
592 1.1.1.6 christos It implicitly denotes the register group of {x,y,z}mmN - {x,y,z}mm(N + 3).
593 1.1.1.6 christos */
594 1.1.1.6 christos ImplicitQuadGroup,
595 1.1.1.6 christos
596 1.1.1.2 christos /* Compatible with old (<= 2.8.1) versions of gcc */
597 1.1.1.2 christos OldGcc,
598 1.1.1.2 christos /* AT&T mnemonic. */
599 1.1.1.2 christos ATTMnemonic,
600 1.1.1.2 christos /* AT&T syntax. */
601 1.1.1.2 christos ATTSyntax,
602 1.1.1.2 christos /* Intel syntax. */
603 1.1.1.2 christos IntelSyntax,
604 1.1.1.5 christos /* AMD64. */
605 1.1.1.5 christos AMD64,
606 1.1.1.5 christos /* Intel64. */
607 1.1.1.5 christos Intel64,
608 1.1.1.2 christos /* The last bitfield in i386_opcode_modifier. */
609 1.1.1.2 christos Opcode_Modifier_Max
610 1.1.1.2 christos };
611 1.1 skrll
612 1.1 skrll typedef struct i386_opcode_modifier
613 1.1 skrll {
614 1.1 skrll unsigned int d:1;
615 1.1 skrll unsigned int w:1;
616 1.1.1.6 christos unsigned int load:1;
617 1.1 skrll unsigned int modrm:1;
618 1.1 skrll unsigned int shortform:1;
619 1.1 skrll unsigned int jump:1;
620 1.1 skrll unsigned int jumpdword:1;
621 1.1 skrll unsigned int jumpbyte:1;
622 1.1 skrll unsigned int jumpintersegment:1;
623 1.1 skrll unsigned int floatmf:1;
624 1.1 skrll unsigned int floatr:1;
625 1.1 skrll unsigned int floatd:1;
626 1.1 skrll unsigned int size16:1;
627 1.1 skrll unsigned int size32:1;
628 1.1 skrll unsigned int size64:1;
629 1.1.1.2 christos unsigned int checkregsize:1;
630 1.1 skrll unsigned int ignoresize:1;
631 1.1 skrll unsigned int defaultsize:1;
632 1.1 skrll unsigned int no_bsuf:1;
633 1.1 skrll unsigned int no_wsuf:1;
634 1.1 skrll unsigned int no_lsuf:1;
635 1.1 skrll unsigned int no_ssuf:1;
636 1.1 skrll unsigned int no_qsuf:1;
637 1.1 skrll unsigned int no_ldsuf:1;
638 1.1 skrll unsigned int fwait:1;
639 1.1 skrll unsigned int isstring:1;
640 1.1.1.4 christos unsigned int bndprefixok:1;
641 1.1.1.6 christos unsigned int notrackprefixok:1;
642 1.1.1.2 christos unsigned int islockable:1;
643 1.1 skrll unsigned int regkludge:1;
644 1.1 skrll unsigned int implicit1stxmm0:1;
645 1.1.1.3 christos unsigned int hleprefixok:2;
646 1.1.1.3 christos unsigned int repprefixok:1;
647 1.1 skrll unsigned int todword:1;
648 1.1 skrll unsigned int toqword:1;
649 1.1 skrll unsigned int addrprefixop0:1;
650 1.1 skrll unsigned int isprefix:1;
651 1.1 skrll unsigned int immext:1;
652 1.1 skrll unsigned int norex64:1;
653 1.1 skrll unsigned int rex64:1;
654 1.1 skrll unsigned int ugh:1;
655 1.1.1.2 christos unsigned int vex:2;
656 1.1.1.2 christos unsigned int vexvvvv:2;
657 1.1.1.2 christos unsigned int vexw:2;
658 1.1.1.2 christos unsigned int vexopcode:3;
659 1.1.1.2 christos unsigned int vexsources:2;
660 1.1 skrll unsigned int veximmext:1;
661 1.1.1.3 christos unsigned int vecsib:2;
662 1.1 skrll unsigned int sse2avx:1;
663 1.1 skrll unsigned int noavx:1;
664 1.1.1.4 christos unsigned int evex:3;
665 1.1.1.4 christos unsigned int masking:2;
666 1.1.1.4 christos unsigned int vecesize:1;
667 1.1.1.4 christos unsigned int broadcast:3;
668 1.1.1.4 christos unsigned int staticrounding:1;
669 1.1.1.4 christos unsigned int sae:1;
670 1.1.1.4 christos unsigned int disp8memshift:3;
671 1.1.1.4 christos unsigned int nodefmask:1;
672 1.1.1.6 christos unsigned int implicitquadgroup:1;
673 1.1 skrll unsigned int oldgcc:1;
674 1.1 skrll unsigned int attmnemonic:1;
675 1.1 skrll unsigned int attsyntax:1;
676 1.1 skrll unsigned int intelsyntax:1;
677 1.1.1.5 christos unsigned int amd64:1;
678 1.1.1.5 christos unsigned int intel64:1;
679 1.1 skrll } i386_opcode_modifier;
680 1.1 skrll
681 1.1 skrll /* Position of operand_type bits. */
682 1.1 skrll
683 1.1.1.2 christos enum
684 1.1.1.2 christos {
685 1.1.1.6 christos /* Register (qualified by Byte, Word, etc) */
686 1.1.1.6 christos Reg = 0,
687 1.1.1.2 christos /* MMX register */
688 1.1.1.2 christos RegMMX,
689 1.1.1.6 christos /* Vector registers */
690 1.1.1.6 christos RegSIMD,
691 1.1.1.4 christos /* Vector Mask registers */
692 1.1.1.4 christos RegMask,
693 1.1.1.2 christos /* Control register */
694 1.1.1.2 christos Control,
695 1.1.1.2 christos /* Debug register */
696 1.1.1.2 christos Debug,
697 1.1.1.2 christos /* Test register */
698 1.1.1.2 christos Test,
699 1.1.1.2 christos /* 2 bit segment register */
700 1.1.1.2 christos SReg2,
701 1.1.1.2 christos /* 3 bit segment register */
702 1.1.1.2 christos SReg3,
703 1.1.1.2 christos /* 1 bit immediate */
704 1.1.1.2 christos Imm1,
705 1.1.1.2 christos /* 8 bit immediate */
706 1.1.1.2 christos Imm8,
707 1.1.1.2 christos /* 8 bit immediate sign extended */
708 1.1.1.2 christos Imm8S,
709 1.1.1.2 christos /* 16 bit immediate */
710 1.1.1.2 christos Imm16,
711 1.1.1.2 christos /* 32 bit immediate */
712 1.1.1.2 christos Imm32,
713 1.1.1.2 christos /* 32 bit immediate sign extended */
714 1.1.1.2 christos Imm32S,
715 1.1.1.2 christos /* 64 bit immediate */
716 1.1.1.2 christos Imm64,
717 1.1.1.2 christos /* 8bit/16bit/32bit displacements are used in different ways,
718 1.1.1.2 christos depending on the instruction. For jumps, they specify the
719 1.1.1.2 christos size of the PC relative displacement, for instructions with
720 1.1.1.2 christos memory operand, they specify the size of the offset relative
721 1.1.1.2 christos to the base register, and for instructions with memory offset
722 1.1.1.2 christos such as `mov 1234,%al' they specify the size of the offset
723 1.1.1.2 christos relative to the segment base. */
724 1.1.1.2 christos /* 8 bit displacement */
725 1.1.1.2 christos Disp8,
726 1.1.1.2 christos /* 16 bit displacement */
727 1.1.1.2 christos Disp16,
728 1.1.1.2 christos /* 32 bit displacement */
729 1.1.1.2 christos Disp32,
730 1.1.1.2 christos /* 32 bit signed displacement */
731 1.1.1.2 christos Disp32S,
732 1.1.1.2 christos /* 64 bit displacement */
733 1.1.1.2 christos Disp64,
734 1.1.1.6 christos /* Accumulator %al/%ax/%eax/%rax/%st(0)/%xmm0 */
735 1.1.1.2 christos Acc,
736 1.1.1.2 christos /* Register which can be used for base or index in memory operand. */
737 1.1.1.2 christos BaseIndex,
738 1.1.1.2 christos /* Register to hold in/out port addr = dx */
739 1.1.1.2 christos InOutPortReg,
740 1.1.1.2 christos /* Register to hold shift count = cl */
741 1.1.1.2 christos ShiftCount,
742 1.1.1.2 christos /* Absolute address for jump. */
743 1.1.1.2 christos JumpAbsolute,
744 1.1.1.2 christos /* String insn operand with fixed es segment */
745 1.1.1.2 christos EsSeg,
746 1.1.1.2 christos /* RegMem is for instructions with a modrm byte where the register
747 1.1.1.2 christos destination operand should be encoded in the mod and regmem fields.
748 1.1.1.2 christos Normally, it will be encoded in the reg field. We add a RegMem
749 1.1.1.2 christos flag to the destination register operand to indicate that it should
750 1.1.1.2 christos be encoded in the regmem field. */
751 1.1.1.2 christos RegMem,
752 1.1.1.2 christos /* Memory. */
753 1.1.1.2 christos Mem,
754 1.1.1.2 christos /* BYTE memory. */
755 1.1.1.2 christos Byte,
756 1.1.1.2 christos /* WORD memory. 2 byte */
757 1.1.1.2 christos Word,
758 1.1.1.2 christos /* DWORD memory. 4 byte */
759 1.1.1.2 christos Dword,
760 1.1.1.2 christos /* FWORD memory. 6 byte */
761 1.1.1.2 christos Fword,
762 1.1.1.2 christos /* QWORD memory. 8 byte */
763 1.1.1.2 christos Qword,
764 1.1.1.2 christos /* TBYTE memory. 10 byte */
765 1.1.1.2 christos Tbyte,
766 1.1.1.2 christos /* XMMWORD memory. */
767 1.1.1.2 christos Xmmword,
768 1.1.1.2 christos /* YMMWORD memory. */
769 1.1.1.2 christos Ymmword,
770 1.1.1.4 christos /* ZMMWORD memory. */
771 1.1.1.4 christos Zmmword,
772 1.1.1.2 christos /* Unspecified memory size. */
773 1.1.1.2 christos Unspecified,
774 1.1.1.2 christos /* Any memory size. */
775 1.1.1.2 christos Anysize,
776 1.1.1.2 christos
777 1.1.1.2 christos /* Vector 4 bit immediate. */
778 1.1.1.2 christos Vec_Imm4,
779 1.1.1.2 christos
780 1.1.1.4 christos /* Bound register. */
781 1.1.1.4 christos RegBND,
782 1.1.1.4 christos
783 1.1.1.2 christos /* The last bitfield in i386_operand_type. */
784 1.1.1.2 christos OTMax
785 1.1.1.2 christos };
786 1.1 skrll
787 1.1 skrll #define OTNumOfUints \
788 1.1 skrll (OTMax / sizeof (unsigned int) / CHAR_BIT + 1)
789 1.1 skrll #define OTNumOfBits \
790 1.1 skrll (OTNumOfUints * sizeof (unsigned int) * CHAR_BIT)
791 1.1 skrll
792 1.1 skrll /* If you get a compiler error for zero width of the unused field,
793 1.1 skrll comment it out. */
794 1.1 skrll #define OTUnused (OTMax + 1)
795 1.1 skrll
796 1.1 skrll typedef union i386_operand_type
797 1.1 skrll {
798 1.1 skrll struct
799 1.1 skrll {
800 1.1.1.6 christos unsigned int reg:1;
801 1.1 skrll unsigned int regmmx:1;
802 1.1.1.6 christos unsigned int regsimd:1;
803 1.1.1.4 christos unsigned int regmask:1;
804 1.1 skrll unsigned int control:1;
805 1.1 skrll unsigned int debug:1;
806 1.1 skrll unsigned int test:1;
807 1.1 skrll unsigned int sreg2:1;
808 1.1 skrll unsigned int sreg3:1;
809 1.1 skrll unsigned int imm1:1;
810 1.1 skrll unsigned int imm8:1;
811 1.1 skrll unsigned int imm8s:1;
812 1.1 skrll unsigned int imm16:1;
813 1.1 skrll unsigned int imm32:1;
814 1.1 skrll unsigned int imm32s:1;
815 1.1 skrll unsigned int imm64:1;
816 1.1 skrll unsigned int disp8:1;
817 1.1 skrll unsigned int disp16:1;
818 1.1 skrll unsigned int disp32:1;
819 1.1 skrll unsigned int disp32s:1;
820 1.1 skrll unsigned int disp64:1;
821 1.1 skrll unsigned int acc:1;
822 1.1 skrll unsigned int baseindex:1;
823 1.1 skrll unsigned int inoutportreg:1;
824 1.1 skrll unsigned int shiftcount:1;
825 1.1 skrll unsigned int jumpabsolute:1;
826 1.1 skrll unsigned int esseg:1;
827 1.1 skrll unsigned int regmem:1;
828 1.1 skrll unsigned int mem:1;
829 1.1 skrll unsigned int byte:1;
830 1.1 skrll unsigned int word:1;
831 1.1 skrll unsigned int dword:1;
832 1.1 skrll unsigned int fword:1;
833 1.1 skrll unsigned int qword:1;
834 1.1 skrll unsigned int tbyte:1;
835 1.1 skrll unsigned int xmmword:1;
836 1.1 skrll unsigned int ymmword:1;
837 1.1.1.4 christos unsigned int zmmword:1;
838 1.1 skrll unsigned int unspecified:1;
839 1.1 skrll unsigned int anysize:1;
840 1.1.1.2 christos unsigned int vec_imm4:1;
841 1.1.1.4 christos unsigned int regbnd:1;
842 1.1 skrll #ifdef OTUnused
843 1.1 skrll unsigned int unused:(OTNumOfBits - OTUnused);
844 1.1 skrll #endif
845 1.1 skrll } bitfield;
846 1.1 skrll unsigned int array[OTNumOfUints];
847 1.1 skrll } i386_operand_type;
848 1.1 skrll
849 1.1.1.2 christos typedef struct insn_template
850 1.1 skrll {
851 1.1 skrll /* instruction name sans width suffix ("mov" for movl insns) */
852 1.1 skrll char *name;
853 1.1 skrll
854 1.1 skrll /* how many operands */
855 1.1 skrll unsigned int operands;
856 1.1 skrll
857 1.1 skrll /* base_opcode is the fundamental opcode byte without optional
858 1.1 skrll prefix(es). */
859 1.1 skrll unsigned int base_opcode;
860 1.1 skrll #define Opcode_D 0x2 /* Direction bit:
861 1.1 skrll set if Reg --> Regmem;
862 1.1 skrll unset if Regmem --> Reg. */
863 1.1 skrll #define Opcode_FloatR 0x8 /* Bit to swap src/dest for float insns. */
864 1.1 skrll #define Opcode_FloatD 0x400 /* Direction bit for float insns. */
865 1.1 skrll
866 1.1 skrll /* extension_opcode is the 3 bit extension for group <n> insns.
867 1.1 skrll This field is also used to store the 8-bit opcode suffix for the
868 1.1 skrll AMD 3DNow! instructions.
869 1.1.1.3 christos If this template has no extension opcode (the usual case) use None
870 1.1.1.2 christos Instructions */
871 1.1 skrll unsigned int extension_opcode;
872 1.1 skrll #define None 0xffff /* If no extension_opcode is possible. */
873 1.1 skrll
874 1.1 skrll /* Opcode length. */
875 1.1 skrll unsigned char opcode_length;
876 1.1 skrll
877 1.1 skrll /* cpu feature flags */
878 1.1 skrll i386_cpu_flags cpu_flags;
879 1.1 skrll
880 1.1 skrll /* the bits in opcode_modifier are used to generate the final opcode from
881 1.1 skrll the base_opcode. These bits also are used to detect alternate forms of
882 1.1 skrll the same instruction */
883 1.1 skrll i386_opcode_modifier opcode_modifier;
884 1.1 skrll
885 1.1 skrll /* operand_types[i] describes the type of operand i. This is made
886 1.1 skrll by OR'ing together all of the possible type masks. (e.g.
887 1.1 skrll 'operand_types[i] = Reg|Imm' specifies that operand i can be
888 1.1 skrll either a register or an immediate operand. */
889 1.1 skrll i386_operand_type operand_types[MAX_OPERANDS];
890 1.1 skrll }
891 1.1.1.2 christos insn_template;
892 1.1 skrll
893 1.1.1.2 christos extern const insn_template i386_optab[];
894 1.1 skrll
895 1.1 skrll /* these are for register name --> number & type hash lookup */
896 1.1 skrll typedef struct
897 1.1 skrll {
898 1.1 skrll char *reg_name;
899 1.1 skrll i386_operand_type reg_type;
900 1.1 skrll unsigned char reg_flags;
901 1.1 skrll #define RegRex 0x1 /* Extended register. */
902 1.1 skrll #define RegRex64 0x2 /* Extended 8 bit register. */
903 1.1.1.4 christos #define RegVRex 0x4 /* Extended vector register. */
904 1.1 skrll unsigned char reg_num;
905 1.1 skrll #define RegRip ((unsigned char ) ~0)
906 1.1 skrll #define RegEip (RegRip - 1)
907 1.1 skrll /* EIZ and RIZ are fake index registers. */
908 1.1 skrll #define RegEiz (RegEip - 1)
909 1.1 skrll #define RegRiz (RegEiz - 1)
910 1.1 skrll /* FLAT is a fake segment register (Intel mode). */
911 1.1 skrll #define RegFlat ((unsigned char) ~0)
912 1.1 skrll signed char dw2_regnum[2];
913 1.1 skrll #define Dw2Inval (-1)
914 1.1 skrll }
915 1.1 skrll reg_entry;
916 1.1 skrll
917 1.1 skrll /* Entries in i386_regtab. */
918 1.1 skrll #define REGNAM_AL 1
919 1.1 skrll #define REGNAM_AX 25
920 1.1 skrll #define REGNAM_EAX 41
921 1.1 skrll
922 1.1 skrll extern const reg_entry i386_regtab[];
923 1.1 skrll extern const unsigned int i386_regtab_size;
924 1.1 skrll
925 1.1 skrll typedef struct
926 1.1 skrll {
927 1.1 skrll char *seg_name;
928 1.1 skrll unsigned int seg_prefix;
929 1.1 skrll }
930 1.1 skrll seg_entry;
931 1.1 skrll
932 1.1 skrll extern const seg_entry cs;
933 1.1 skrll extern const seg_entry ds;
934 1.1 skrll extern const seg_entry ss;
935 1.1 skrll extern const seg_entry es;
936 1.1 skrll extern const seg_entry fs;
937 1.1 skrll extern const seg_entry gs;
938