Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Corrected vnet locking with irqsave/restore
[palacios.git] / palacios / include / quix86 / quix86.h
1 /* +------------------------------------------------------------------------+
2    | quix86                                                                 |
3    +------------------------------------------------------------------------+
4    | This file is part of quix86, an x86-64 instruction decoder.            |
5    |                                                                        |
6    | Copyright (C) 2011 Institute for System Programming of Russian Academy |
7    | of Sciences.                                                           |
8    |                                                                        |
9    | Contact e-mail: <unicluster@ispras.ru>.                                |
10    |                                                                        |
11    | quix86 is free software: you can redistribute it and/or modify it      |
12    | under the terms of the GNU Lesser General Public License as published  |
13    | by the Free Software Foundation, either version 3 of the License, or   |
14    | (at your option) any later version.                                    |
15    |                                                                        |
16    | quix86 is distributed in the hope that it will be useful, but WITHOUT  |
17    | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or  |
18    | FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public   |
19    | License for more details.                                              |
20    |                                                                        |
21    | You should have received a copy of the GNU Lesser General Public       |
22    | License along with quix86. If not, see <http://www.gnu.org/licenses/>. |
23    +------------------------------------------------------------------------+ */
24
25 #ifndef QUIX86_H
26 #define QUIX86_H
27
28 /* Provide definitions for INT8..INT64 and UINT8..UINT64.  */
29 #ifdef _MSC_VER
30     /* Definitions for INT8..INT64.  */
31 #   define QX86_INT8                    __int8
32 #   define QX86_INT16                   __int16
33 #   define QX86_INT32                   __int32
34 #   define QX86_INT64                   __int64
35
36     /* Definitions for UINT8..UINT64.  */
37 #   define QX86_UINT8                   unsigned __int8
38 #   define QX86_UINT16                  unsigned __int16
39 #   define QX86_UINT32                  unsigned __int32
40 #   define QX86_UINT64                  unsigned __int64
41 #else
42     /* No built-in types.  See if we have one of the standard headers.  */
43 #   if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
44         /* Prefer <stdint.h> as it's somewhat smaller.  */
45 #       ifdef HAVE_STDINT_H
46             /* Include <stdint.h>.  */
47 #           include <stdint.h>
48 #       else
49             /* Include <inttypes.h> instead.  */
50 #           include <inttypes.h>
51 #       endif
52
53         /* Definitions for INT8..INT64.  */
54 #       define QX86_INT8                int8_t
55 #       define QX86_INT16               int16_t
56 #       define QX86_INT32               int32_t
57 #       define QX86_INT64               int64_t
58
59         /* Definitions for UINT8..UINT64.  */
60 #       define QX86_UINT8               uint8_t
61 #       define QX86_UINT16              uint16_t
62 #       define QX86_UINT32              uint32_t
63 #       define QX86_UINT64              uint64_t
64 #   else
65         /* Likely definitions for INT8..INT64.  */
66 #       define QX86_INT8                signed char
67 #       define QX86_INT16               short
68 #       define QX86_INT32               int
69 #       define QX86_INT64               long long
70
71         /* Likely definitions for UINT8..UINT64.  */
72 #       define QX86_UINT8               unsigned char
73 #       define QX86_UINT16              unsigned short
74 #       define QX86_UINT32              unsigned int
75 #       define QX86_UINT64              unsigned long long
76 #   endif
77 #endif
78
79 /* Provide wrappers around const and inline for compilers that don't support
80    C99.  */
81 #ifdef _MSC_VER
82     /* Microsoft Visual C is not C99-conformant.  Use alternative keywords.  */
83 #   define QX86_CONST                   const
84 #   define QX86_INLINE                  __inline
85 #   define QX86_RESTRICT                /* ILB */
86 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
87     /* C99 supported.  */
88 #   define QX86_CONST                   const
89 #   define QX86_INLINE                  inline
90 #   define QX86_RESTRICT                restrict
91 #elif defined(__GNUC__) && (__GNUC__ >= 4)
92     /* GNU C supported. */
93 #   define QX86_CONST                   const
94 #   define QX86_INLINE                  inline
95 #   define QX86_RESTRICT                restrict
96 #elif defined(__cplusplus)
97     /* C++ mode supports const and inline.  */
98 #   define QX86_CONST                   const
99 #   define QX86_INLINE                  inline
100 #   define QX86_RESTRICT                /* ILB */
101 #else
102     /* Assume none of the qualifiers is supported.  */
103 #   define QX86_CONST                   /* ILB */
104 #   define QX86_INLINE                  /* ILB */
105 #   define QX86_RESTRICT                /* ILB */
106 #endif
107
108 /* Wrap declarations in extern "C" if needed.  */
109 #ifdef __cplusplus
110     /* Need wrapper.  */
111 #   define QX86_EXTERN_C                extern "C"
112 #else
113     /* No wrapper required.  */
114 #   define QX86_EXTERN_C                /* ILB */
115 #endif
116
117 /**
118  * 8-bit signed integer type.
119  *
120  * \author                              icee
121  * \since                               1.0
122  */
123 typedef QX86_INT8                       qx86_int8;
124
125 /**
126  * 16-bit signed integer type.
127  *
128  * \author                              icee
129  * \since                               1.0
130  */
131 typedef QX86_INT16                      qx86_int16;
132
133 /**
134  * 32-bit signed integer type.
135  *
136  * \author                              icee
137  * \since                               1.0
138  */
139 typedef QX86_INT32                      qx86_int32;
140
141 /**
142  * 64-bit signed integer type.
143  *
144  * \author                              icee
145  * \since                               1.0
146  */
147 typedef QX86_INT64                      qx86_int64;
148
149 /**
150  * 8-bit unsigned integer type.
151  *
152  * \author                              icee
153  * \since                               1.0
154  */
155 typedef QX86_UINT8                      qx86_uint8;
156
157 /**
158  * 16-bit unsigned integer type.
159  *
160  * \author                              icee
161  * \since                               1.0
162  */
163 typedef QX86_UINT16                     qx86_uint16;
164
165 /**
166  * 32-bit unsigned integer type.
167  *
168  * \author                              icee
169  * \since                               1.0
170  */
171 typedef QX86_UINT32                     qx86_uint32;
172
173 /**
174  * 64-bit unsigned integer type.
175  *
176  * \author                              icee
177  * \since                               1.0
178  */
179 typedef QX86_UINT64                     qx86_uint64;
180
181 /* Public API structure declarations.  */
182 typedef struct qx86_amode               qx86_amode;
183 typedef struct qx86_ctx                 qx86_ctx;
184 typedef struct qx86_insn                qx86_insn;
185 typedef struct qx86_insn_attributes     qx86_insn_attributes;
186 typedef struct qx86_insn_modifiers      qx86_insn_modifiers;
187 typedef struct qx86_print_options_intel qx86_print_options_intel;
188 typedef struct qx86_mtab_item           qx86_mtab_item;
189 typedef struct qx86_opcode_map          qx86_opcode_map;
190 typedef struct qx86_opcode_map_item     qx86_opcode_map_item;
191 typedef struct qx86_operand             qx86_operand;
192 typedef struct qx86_operand_far_pointer qx86_operand_far_pointer;
193 typedef struct qx86_operand_form        qx86_operand_form;
194 typedef struct qx86_operand_form_amode  qx86_operand_form_amode;
195 typedef struct qx86_operand_form_rtuple qx86_operand_form_rtuple;
196 typedef struct qx86_operand_immediate   qx86_operand_immediate;
197 typedef struct qx86_operand_jump_offset qx86_operand_jump_offset;
198 typedef struct qx86_operand_memory      qx86_operand_memory;
199 typedef struct qx86_operand_register    qx86_operand_register;
200 typedef struct qx86_print_item          qx86_print_item;
201 typedef struct qx86_rtab_item           qx86_rtab_item;
202 typedef struct qx86_rtuple              qx86_rtuple;
203 typedef struct qx86_stuple              qx86_stuple;
204
205 /* Public API union declarations.  */
206 typedef union qx86_operand_union        qx86_operand_union;
207 typedef union qx86_operand_form_union   qx86_operand_form_union;
208
209 /* Public API enumerations.  */
210
211
212 /**
213  * Enumeration of <em>x86</em> instruction defects.
214  *
215  * \author                              icee
216  * \since                               1.0
217  */
218 enum
219 {
220     QX86_DEFECT_NONE                    = 0,
221
222     QX86_DEFECT_MODRM_MOD_NOT_3         = 1 << 0,
223     QX86_DEFECT_MODRM_MOD_3             = 1 << 1
224 };
225
226
227
228 /**
229  * Enumeration of <em>x86</em> displacement sizes.
230  *
231  * \author                              icee
232  * \since                               1.0
233  */
234 enum
235 {
236     QX86_DISP_NONE                      = 0,
237     QX86_DISP_8                         = 1,
238     QX86_DISP_16                        = 2,
239     QX86_DISP_32                        = 4,
240     QX86_DISP_64                        = 8,
241
242     QX86_DISP_INVALID                   = 3
243 };
244
245
246
247 /**
248  * Enumeration of <tt>quix86</tt> error codes.
249  *
250  * \author                              icee
251  * \since                               1.0
252  */
253 enum
254 {
255     QX86_SUCCESS                        = 0,
256
257     QX86_E_INTERNAL                     = 1,
258     QX86_E_API                          = 2,
259
260     QX86_E_INSN_INCOMPLETE              = 3,
261     QX86_E_INSN_UNDEFINED               = 4,
262
263     QX86_E_INSUFFICIENT_BUFFER          = 5,
264     
265     QX86_E_CALLBACK                     = 6,
266
267     QX86_E_COUNT                        = 7
268 };
269
270
271
272 /**
273  * Enumeration of instruction classes.
274  *
275  * An instruction can belong to multiple instruction classes at the same time.
276  *
277  * \author                              icee
278  * \since                               1.0
279  */
280 enum
281 {
282     QX86_ICLASS_NONE                    = 0,
283
284     QX86_ICLASS_CONDITIONAL_EXECUTION   = 1 << 0,
285
286     QX86_ICLASS_TRANSFER                = 1 << 1,
287     QX86_ICLASS_TRANSFER_LINKED         = 1 << 2,
288     QX86_ICLASS_TRANSFER_LINKED_BACK    = 1 << 3,
289     QX86_ICLASS_TRANSFER_SERVICE        = 1 << 4
290 };
291
292
293
294 /**
295  * Architectural limits of the <em>x86</em>.
296  *
297  * \author                              icee
298  * \since                               1.0
299  */
300 enum
301 {
302     QX86_IMMEDIATE_SIZE_MAX             = 8,
303     QX86_INSN_SIZE_MAX                  = 15,
304     QX86_OPERAND_NMAX                   = 4
305 };
306
307
308 /**
309  * Enumeration of <em>x86</em> instruction mnemonics.
310  *
311  * \author                              icee
312  * \since                               1.0
313  */
314 enum qx86_mnemonic
315 {
316     QX86_MNEMONIC_NONE                  = 0,
317
318     /* Enumerators are sorted based on their names.  */
319     QX86_MNEMONIC_AAA                   = 1,
320     QX86_MNEMONIC_AAD                   = 2,
321     QX86_MNEMONIC_AAM                   = 3,
322     QX86_MNEMONIC_AAS                   = 4,
323     QX86_MNEMONIC_ADC                   = 5,
324     QX86_MNEMONIC_ADD                   = 6,
325     QX86_MNEMONIC_ADDPD                 = 7,
326     QX86_MNEMONIC_ADDPS                 = 8,
327     QX86_MNEMONIC_ADDSD                 = 9,
328     QX86_MNEMONIC_ADDSS                 = 10,
329     QX86_MNEMONIC_ADDSUBPD              = 11,
330     QX86_MNEMONIC_ADDSUBPS              = 12,
331     QX86_MNEMONIC_AESDEC                = 13,
332     QX86_MNEMONIC_AESDECLAST            = 14,
333     QX86_MNEMONIC_AESENC                = 15,
334     QX86_MNEMONIC_AESENCLAST            = 16,
335     QX86_MNEMONIC_AESIMC                = 17,
336     QX86_MNEMONIC_AESKEYGENASSIST       = 18,
337     QX86_MNEMONIC_AND                   = 19,
338     QX86_MNEMONIC_ANDNPD                = 20,
339     QX86_MNEMONIC_ANDNPS                = 21,
340     QX86_MNEMONIC_ANDPD                 = 22,
341     QX86_MNEMONIC_ANDPS                 = 23,
342     QX86_MNEMONIC_ARPL                  = 24,
343     QX86_MNEMONIC_BLENDPD               = 25,
344     QX86_MNEMONIC_BLENDPS               = 26,
345     QX86_MNEMONIC_BLENDVPD              = 27,
346     QX86_MNEMONIC_BLENDVPS              = 28,
347     QX86_MNEMONIC_BOUND                 = 29,
348     QX86_MNEMONIC_BSF                   = 30,
349     QX86_MNEMONIC_BSR                   = 31,
350     QX86_MNEMONIC_BSWAP                 = 32,
351     QX86_MNEMONIC_BT                    = 33,
352     QX86_MNEMONIC_BTC                   = 34,
353     QX86_MNEMONIC_BTR                   = 35,
354     QX86_MNEMONIC_BTS                   = 36,
355     QX86_MNEMONIC_CALL                  = 37,
356     QX86_MNEMONIC_CALLF                 = 38,
357     QX86_MNEMONIC_CBW                   = 39,
358     QX86_MNEMONIC_CDQ                   = 40,
359     QX86_MNEMONIC_CDQE                  = 41,
360     QX86_MNEMONIC_CLC                   = 42,
361     QX86_MNEMONIC_CLD                   = 43,
362     QX86_MNEMONIC_CLFLUSH               = 44,
363     QX86_MNEMONIC_CLGI                  = 45,
364     QX86_MNEMONIC_CLI                   = 46,
365     QX86_MNEMONIC_CLTS                  = 47,
366     QX86_MNEMONIC_CMC                   = 48,
367     QX86_MNEMONIC_CMOVA                 = 49,
368     QX86_MNEMONIC_CMOVAE                = 50,
369     QX86_MNEMONIC_CMOVB                 = 51,
370     QX86_MNEMONIC_CMOVBE                = 52,
371     QX86_MNEMONIC_CMOVG                 = 53,
372     QX86_MNEMONIC_CMOVGE                = 54,
373     QX86_MNEMONIC_CMOVL                 = 55,
374     QX86_MNEMONIC_CMOVLE                = 56,
375     QX86_MNEMONIC_CMOVNO                = 57,
376     QX86_MNEMONIC_CMOVNP                = 58,
377     QX86_MNEMONIC_CMOVNS                = 59,
378     QX86_MNEMONIC_CMOVNZ                = 60,
379     QX86_MNEMONIC_CMOVO                 = 61,
380     QX86_MNEMONIC_CMOVP                 = 62,
381     QX86_MNEMONIC_CMOVS                 = 63,
382     QX86_MNEMONIC_CMOVZ                 = 64,
383     QX86_MNEMONIC_CMP                   = 65,
384     QX86_MNEMONIC_CMPPD                 = 66,
385     QX86_MNEMONIC_CMPPS                 = 67,
386     QX86_MNEMONIC_CMPSB                 = 68,
387     QX86_MNEMONIC_CMPSD                 = 69,
388     QX86_MNEMONIC_CMPSD_SSE             = 70,
389     QX86_MNEMONIC_CMPSQ                 = 71,
390     QX86_MNEMONIC_CMPSS                 = 72,
391     QX86_MNEMONIC_CMPSW                 = 73,
392     QX86_MNEMONIC_CMPXCHG               = 74,
393     QX86_MNEMONIC_CMPXCHG16B            = 75,
394     QX86_MNEMONIC_CMPXCHG8B             = 76,
395     QX86_MNEMONIC_COMISD                = 77,
396     QX86_MNEMONIC_COMISS                = 78,
397     QX86_MNEMONIC_CPUID                 = 79,
398     QX86_MNEMONIC_CQO                   = 80,
399     QX86_MNEMONIC_CRC32                 = 81,
400     QX86_MNEMONIC_CVTDQ2PD              = 82,
401     QX86_MNEMONIC_CVTDQ2PS              = 83,
402     QX86_MNEMONIC_CVTPD2DQ              = 84,
403     QX86_MNEMONIC_CVTPD2PI              = 85,
404     QX86_MNEMONIC_CVTPD2PS              = 86,
405     QX86_MNEMONIC_CVTPI2PD              = 87,
406     QX86_MNEMONIC_CVTPI2PS              = 88,
407     QX86_MNEMONIC_CVTPS2DQ              = 89,
408     QX86_MNEMONIC_CVTPS2PD              = 90,
409     QX86_MNEMONIC_CVTPS2PI              = 91,
410     QX86_MNEMONIC_CVTSD2SI              = 92,
411     QX86_MNEMONIC_CVTSD2SS              = 93,
412     QX86_MNEMONIC_CVTSI2SD              = 94,
413     QX86_MNEMONIC_CVTSI2SS              = 95,
414     QX86_MNEMONIC_CVTSS2SD              = 96,
415     QX86_MNEMONIC_CVTSS2SI              = 97,
416     QX86_MNEMONIC_CVTTPD2DQ             = 98,
417     QX86_MNEMONIC_CVTTPD2PI             = 99,
418     QX86_MNEMONIC_CVTTPS2DQ             = 100,
419     QX86_MNEMONIC_CVTTPS2PI             = 101,
420     QX86_MNEMONIC_CVTTSD2SI             = 102,
421     QX86_MNEMONIC_CVTTSS2SI             = 103,
422     QX86_MNEMONIC_CWD                   = 104,
423     QX86_MNEMONIC_CWDE                  = 105,
424     QX86_MNEMONIC_DAA                   = 106,
425     QX86_MNEMONIC_DAS                   = 107,
426     QX86_MNEMONIC_DEC                   = 108,
427     QX86_MNEMONIC_DIV                   = 109,
428     QX86_MNEMONIC_DIVPD                 = 110,
429     QX86_MNEMONIC_DIVPS                 = 111,
430     QX86_MNEMONIC_DIVSD                 = 112,
431     QX86_MNEMONIC_DIVSS                 = 113,
432     QX86_MNEMONIC_DPPD                  = 114,
433     QX86_MNEMONIC_DPPS                  = 115,
434     QX86_MNEMONIC_EMMS                  = 116,
435     QX86_MNEMONIC_ENTER                 = 117,
436     QX86_MNEMONIC_EXTRACTPS             = 118,
437     QX86_MNEMONIC_EXTRQ                 = 119,
438     QX86_MNEMONIC_F2XM1                 = 120,
439     QX86_MNEMONIC_FABS                  = 121,
440     QX86_MNEMONIC_FADD                  = 122,
441     QX86_MNEMONIC_FADDP                 = 123,
442     QX86_MNEMONIC_FBLD                  = 124,
443     QX86_MNEMONIC_FBSTP                 = 125,
444     QX86_MNEMONIC_FCHS                  = 126,
445     QX86_MNEMONIC_FCMOVB                = 127,
446     QX86_MNEMONIC_FCMOVBE               = 128,
447     QX86_MNEMONIC_FCMOVE                = 129,
448     QX86_MNEMONIC_FCMOVNB               = 130,
449     QX86_MNEMONIC_FCMOVNBE              = 131,
450     QX86_MNEMONIC_FCMOVNE               = 132,
451     QX86_MNEMONIC_FCMOVNU               = 133,
452     QX86_MNEMONIC_FCMOVU                = 134,
453     QX86_MNEMONIC_FCOM                  = 135,
454     QX86_MNEMONIC_FCOMI                 = 136,
455     QX86_MNEMONIC_FCOMIP                = 137,
456     QX86_MNEMONIC_FCOMP                 = 138,
457     QX86_MNEMONIC_FCOMPP                = 139,
458     QX86_MNEMONIC_FCOS                  = 140,
459     QX86_MNEMONIC_FDECSTP               = 141,
460     QX86_MNEMONIC_FDIV                  = 142,
461     QX86_MNEMONIC_FDIVP                 = 143,
462     QX86_MNEMONIC_FDIVR                 = 144,
463     QX86_MNEMONIC_FDIVRP                = 145,
464     QX86_MNEMONIC_FEMMS                 = 146,
465     QX86_MNEMONIC_FFREE                 = 147,
466     QX86_MNEMONIC_FIADD                 = 148,
467     QX86_MNEMONIC_FICOM                 = 149,
468     QX86_MNEMONIC_FICOMP                = 150,
469     QX86_MNEMONIC_FIDIV                 = 151,
470     QX86_MNEMONIC_FIDIVR                = 152,
471     QX86_MNEMONIC_FILD                  = 153,
472     QX86_MNEMONIC_FIMUL                 = 154,
473     QX86_MNEMONIC_FINCSTP               = 155,
474     QX86_MNEMONIC_FIST                  = 156,
475     QX86_MNEMONIC_FISTP                 = 157,
476     QX86_MNEMONIC_FISTTP                = 158,
477     QX86_MNEMONIC_FISUB                 = 159,
478     QX86_MNEMONIC_FISUBR                = 160,
479     QX86_MNEMONIC_FLD                   = 161,
480     QX86_MNEMONIC_FLD1                  = 162,
481     QX86_MNEMONIC_FLDCW                 = 163,
482     QX86_MNEMONIC_FLDENV                = 164,
483     QX86_MNEMONIC_FLDL2E                = 165,
484     QX86_MNEMONIC_FLDL2T                = 166,
485     QX86_MNEMONIC_FLDLG2                = 167,
486     QX86_MNEMONIC_FLDLN2                = 168,
487     QX86_MNEMONIC_FLDPI                 = 169,
488     QX86_MNEMONIC_FLDZ                  = 170,
489     QX86_MNEMONIC_FMUL                  = 171,
490     QX86_MNEMONIC_FMULP                 = 172,
491     QX86_MNEMONIC_FNCLEX                = 173,
492     QX86_MNEMONIC_FNINIT                = 174,
493     QX86_MNEMONIC_FNOP                  = 175,
494     QX86_MNEMONIC_FNSAVE                = 176,
495     QX86_MNEMONIC_FNSTCW                = 177,
496     QX86_MNEMONIC_FNSTENV               = 178,
497     QX86_MNEMONIC_FNSTSW                = 179,
498     QX86_MNEMONIC_FPATAN                = 180,
499     QX86_MNEMONIC_FPREM                 = 181,
500     QX86_MNEMONIC_FPREM1                = 182,
501     QX86_MNEMONIC_FPTAN                 = 183,
502     QX86_MNEMONIC_FRNDINT               = 184,
503     QX86_MNEMONIC_FRSTOR                = 185,
504     QX86_MNEMONIC_FSCALE                = 186,
505     QX86_MNEMONIC_FSIN                  = 187,
506     QX86_MNEMONIC_FSINCOS               = 188,
507     QX86_MNEMONIC_FSQRT                 = 189,
508     QX86_MNEMONIC_FST                   = 190,
509     QX86_MNEMONIC_FSTP                  = 191,
510     QX86_MNEMONIC_FSUB                  = 192,
511     QX86_MNEMONIC_FSUBP                 = 193,
512     QX86_MNEMONIC_FSUBR                 = 194,
513     QX86_MNEMONIC_FSUBRP                = 195,
514     QX86_MNEMONIC_FTST                  = 196,
515     QX86_MNEMONIC_FUCOM                 = 197,
516     QX86_MNEMONIC_FUCOMI                = 198,
517     QX86_MNEMONIC_FUCOMIP               = 199,
518     QX86_MNEMONIC_FUCOMP                = 200,
519     QX86_MNEMONIC_FUCOMPP               = 201,
520     QX86_MNEMONIC_FWAIT                 = 202,
521     QX86_MNEMONIC_FXAM                  = 203,
522     QX86_MNEMONIC_FXCH                  = 204,
523     QX86_MNEMONIC_FXRSTOR               = 205,
524     QX86_MNEMONIC_FXSAVE                = 206,
525     QX86_MNEMONIC_FXTRACT               = 207,
526     QX86_MNEMONIC_FYL2X                 = 208,
527     QX86_MNEMONIC_FYL2XP1               = 209,
528     QX86_MNEMONIC_GETSEC                = 210,
529     QX86_MNEMONIC_HADDPD                = 211,
530     QX86_MNEMONIC_HADDPS                = 212,
531     QX86_MNEMONIC_HLT                   = 213,
532     QX86_MNEMONIC_HSUBPD                = 214,
533     QX86_MNEMONIC_HSUBPS                = 215,
534     QX86_MNEMONIC_IDIV                  = 216,
535     QX86_MNEMONIC_IMUL                  = 217,
536     QX86_MNEMONIC_IN                    = 218,
537     QX86_MNEMONIC_INC                   = 219,
538     QX86_MNEMONIC_INSB                  = 220,
539     QX86_MNEMONIC_INSD                  = 221,
540     QX86_MNEMONIC_INSERTPS              = 222,
541     QX86_MNEMONIC_INSERTQ               = 223,
542     QX86_MNEMONIC_INSW                  = 224,
543     QX86_MNEMONIC_INT                   = 225,
544     QX86_MNEMONIC_INT1                  = 226,
545     QX86_MNEMONIC_INT3                  = 227,
546     QX86_MNEMONIC_INTO                  = 228,
547     QX86_MNEMONIC_INVD                  = 229,
548     QX86_MNEMONIC_INVEPT                = 230,
549     QX86_MNEMONIC_INVLPG                = 231,
550     QX86_MNEMONIC_INVLPGA               = 232,
551     QX86_MNEMONIC_INVVPID               = 233,
552     QX86_MNEMONIC_IRET                  = 234,
553     QX86_MNEMONIC_IRETD                 = 235,
554     QX86_MNEMONIC_IRETQ                 = 236,
555     QX86_MNEMONIC_JA                    = 237,
556     QX86_MNEMONIC_JAE                   = 238,
557     QX86_MNEMONIC_JB                    = 239,
558     QX86_MNEMONIC_JBE                   = 240,
559     QX86_MNEMONIC_JCXZ                  = 241,
560     QX86_MNEMONIC_JECXZ                 = 242,
561     QX86_MNEMONIC_JG                    = 243,
562     QX86_MNEMONIC_JGE                   = 244,
563     QX86_MNEMONIC_JL                    = 245,
564     QX86_MNEMONIC_JLE                   = 246,
565     QX86_MNEMONIC_JMP                   = 247,
566     QX86_MNEMONIC_JMPF                  = 248,
567     QX86_MNEMONIC_JNO                   = 249,
568     QX86_MNEMONIC_JNP                   = 250,
569     QX86_MNEMONIC_JNS                   = 251,
570     QX86_MNEMONIC_JNZ                   = 252,
571     QX86_MNEMONIC_JO                    = 253,
572     QX86_MNEMONIC_JP                    = 254,
573     QX86_MNEMONIC_JRCXZ                 = 255,
574     QX86_MNEMONIC_JS                    = 256,
575     QX86_MNEMONIC_JZ                    = 257,
576     QX86_MNEMONIC_LAHF                  = 258,
577     QX86_MNEMONIC_LAR                   = 259,
578     QX86_MNEMONIC_LCS                   = 260,
579     QX86_MNEMONIC_LDDQU                 = 261,
580     QX86_MNEMONIC_LDMXCSR               = 262,
581     QX86_MNEMONIC_LDS                   = 263,
582     QX86_MNEMONIC_LEA                   = 264,
583     QX86_MNEMONIC_LEAVE                 = 265,
584     QX86_MNEMONIC_LES                   = 266,
585     QX86_MNEMONIC_LFENCE                = 267,
586     QX86_MNEMONIC_LFS                   = 268,
587     QX86_MNEMONIC_LGDT                  = 269,
588     QX86_MNEMONIC_LGS                   = 270,
589     QX86_MNEMONIC_LIDT                  = 271,
590     QX86_MNEMONIC_LLDT                  = 272,
591     QX86_MNEMONIC_LMSW                  = 273,
592     QX86_MNEMONIC_LODSB                 = 274,
593     QX86_MNEMONIC_LODSD                 = 275,
594     QX86_MNEMONIC_LODSQ                 = 276,
595     QX86_MNEMONIC_LODSW                 = 277,
596     QX86_MNEMONIC_LOOP                  = 278,
597     QX86_MNEMONIC_LOOPNZ                = 279,
598     QX86_MNEMONIC_LOOPZ                 = 280,
599     QX86_MNEMONIC_LSL                   = 281,
600     QX86_MNEMONIC_LSS                   = 282,
601     QX86_MNEMONIC_LTR                   = 283,
602     QX86_MNEMONIC_LZCNT                 = 284,
603     QX86_MNEMONIC_MASKMOVDQU            = 285,
604     QX86_MNEMONIC_MASKMOVQ              = 286,
605     QX86_MNEMONIC_MAXPD                 = 287,
606     QX86_MNEMONIC_MAXPS                 = 288,
607     QX86_MNEMONIC_MAXSD                 = 289,
608     QX86_MNEMONIC_MAXSS                 = 290,
609     QX86_MNEMONIC_MFENCE                = 291,
610     QX86_MNEMONIC_MINPD                 = 292,
611     QX86_MNEMONIC_MINPS                 = 293,
612     QX86_MNEMONIC_MINSD                 = 294,
613     QX86_MNEMONIC_MINSS                 = 295,
614     QX86_MNEMONIC_MONITOR               = 296,
615     QX86_MNEMONIC_MOV                   = 297,
616     QX86_MNEMONIC_MOVAPD                = 298,
617     QX86_MNEMONIC_MOVAPS                = 299,
618     QX86_MNEMONIC_MOVBE                 = 300,
619     QX86_MNEMONIC_MOVD                  = 301,
620     QX86_MNEMONIC_MOVDDUP               = 302,
621     QX86_MNEMONIC_MOVDQ2Q               = 303,
622     QX86_MNEMONIC_MOVDQA                = 304,
623     QX86_MNEMONIC_MOVDQU                = 305,
624     QX86_MNEMONIC_MOVHLPS               = 306,
625     QX86_MNEMONIC_MOVHPD                = 307,
626     QX86_MNEMONIC_MOVHPS                = 308,
627     QX86_MNEMONIC_MOVLHPS               = 309,
628     QX86_MNEMONIC_MOVLPD                = 310,
629     QX86_MNEMONIC_MOVLPS                = 311,
630     QX86_MNEMONIC_MOVMSKPD              = 312,
631     QX86_MNEMONIC_MOVMSKPS              = 313,
632     QX86_MNEMONIC_MOVNTDQ               = 314,
633     QX86_MNEMONIC_MOVNTDQA              = 315,
634     QX86_MNEMONIC_MOVNTI                = 316,
635     QX86_MNEMONIC_MOVNTPD               = 317,
636     QX86_MNEMONIC_MOVNTPS               = 318,
637     QX86_MNEMONIC_MOVNTQ                = 319,
638     QX86_MNEMONIC_MOVNTSD               = 320,
639     QX86_MNEMONIC_MOVNTSS               = 321,
640     QX86_MNEMONIC_MOVQ                  = 322,
641     QX86_MNEMONIC_MOVQ2DQ               = 323,
642     QX86_MNEMONIC_MOVSB                 = 324,
643     QX86_MNEMONIC_MOVSD                 = 325,
644     QX86_MNEMONIC_MOVSD_SSE             = 326,
645     QX86_MNEMONIC_MOVSHDUP              = 327,
646     QX86_MNEMONIC_MOVSLDUP              = 328,
647     QX86_MNEMONIC_MOVSQ                 = 329,
648     QX86_MNEMONIC_MOVSS                 = 330,
649     QX86_MNEMONIC_MOVSW                 = 331,
650     QX86_MNEMONIC_MOVSX                 = 332,
651     QX86_MNEMONIC_MOVSXD                = 333,
652     QX86_MNEMONIC_MOVUPD                = 334,
653     QX86_MNEMONIC_MOVUPS                = 335,
654     QX86_MNEMONIC_MOVZX                 = 336,
655     QX86_MNEMONIC_MPSADBW               = 337,
656     QX86_MNEMONIC_MUL                   = 338,
657     QX86_MNEMONIC_MULPD                 = 339,
658     QX86_MNEMONIC_MULPS                 = 340,
659     QX86_MNEMONIC_MULSD                 = 341,
660     QX86_MNEMONIC_MULSS                 = 342,
661     QX86_MNEMONIC_MWAIT                 = 343,
662     QX86_MNEMONIC_NEG                   = 344,
663     QX86_MNEMONIC_NOP                   = 345,
664     QX86_MNEMONIC_NOT                   = 346,
665     QX86_MNEMONIC_OR                    = 347,
666     QX86_MNEMONIC_ORPD                  = 348,
667     QX86_MNEMONIC_ORPS                  = 349,
668     QX86_MNEMONIC_OUT                   = 350,
669     QX86_MNEMONIC_OUTSB                 = 351,
670     QX86_MNEMONIC_OUTSD                 = 352,
671     QX86_MNEMONIC_OUTSW                 = 353,
672     QX86_MNEMONIC_PABSB                 = 354,
673     QX86_MNEMONIC_PABSD                 = 355,
674     QX86_MNEMONIC_PABSW                 = 356,
675     QX86_MNEMONIC_PACKSSDW              = 357,
676     QX86_MNEMONIC_PACKSSWB              = 358,
677     QX86_MNEMONIC_PACKUSDW              = 359,
678     QX86_MNEMONIC_PACKUSWB              = 360,
679     QX86_MNEMONIC_PADDB                 = 361,
680     QX86_MNEMONIC_PADDD                 = 362,
681     QX86_MNEMONIC_PADDQ                 = 363,
682     QX86_MNEMONIC_PADDSB                = 364,
683     QX86_MNEMONIC_PADDSW                = 365,
684     QX86_MNEMONIC_PADDUSB               = 366,
685     QX86_MNEMONIC_PADDUSW               = 367,
686     QX86_MNEMONIC_PADDW                 = 368,
687     QX86_MNEMONIC_PALIGNR               = 369,
688     QX86_MNEMONIC_PAND                  = 370,
689     QX86_MNEMONIC_PANDN                 = 371,
690     QX86_MNEMONIC_PAUSE                 = 372,
691     QX86_MNEMONIC_PAVGB                 = 373,
692     QX86_MNEMONIC_PAVGUSB               = 374,
693     QX86_MNEMONIC_PAVGW                 = 375,
694     QX86_MNEMONIC_PBLENDVB              = 376,
695     QX86_MNEMONIC_PBLENDW               = 377,
696     QX86_MNEMONIC_PCLMULQDQ             = 378,
697     QX86_MNEMONIC_PCMPEQB               = 379,
698     QX86_MNEMONIC_PCMPEQD               = 380,
699     QX86_MNEMONIC_PCMPEQQ               = 381,
700     QX86_MNEMONIC_PCMPEQW               = 382,
701     QX86_MNEMONIC_PCMPESTRI             = 383,
702     QX86_MNEMONIC_PCMPESTRM             = 384,
703     QX86_MNEMONIC_PCMPGTB               = 385,
704     QX86_MNEMONIC_PCMPGTD               = 386,
705     QX86_MNEMONIC_PCMPGTQ               = 387,
706     QX86_MNEMONIC_PCMPGTW               = 388,
707     QX86_MNEMONIC_PCMPISTRI             = 389,
708     QX86_MNEMONIC_PCMPISTRM             = 390,
709     QX86_MNEMONIC_PEXTRB                = 391,
710     QX86_MNEMONIC_PEXTRD                = 392,
711     QX86_MNEMONIC_PEXTRQ                = 393,
712     QX86_MNEMONIC_PEXTRW                = 394,
713     QX86_MNEMONIC_PF2ID                 = 395,
714     QX86_MNEMONIC_PF2IW                 = 396,
715     QX86_MNEMONIC_PFACC                 = 397,
716     QX86_MNEMONIC_PFADD                 = 398,
717     QX86_MNEMONIC_PFCMPEQ               = 399,
718     QX86_MNEMONIC_PFCMPGE               = 400,
719     QX86_MNEMONIC_PFCMPGT               = 401,
720     QX86_MNEMONIC_PFMAX                 = 402,
721     QX86_MNEMONIC_PFMIN                 = 403,
722     QX86_MNEMONIC_PFMUL                 = 404,
723     QX86_MNEMONIC_PFNACC                = 405,
724     QX86_MNEMONIC_PFPNACC               = 406,
725     QX86_MNEMONIC_PFRCP                 = 407,
726     QX86_MNEMONIC_PFRCPIT1              = 408,
727     QX86_MNEMONIC_PFRCPIT2              = 409,
728     QX86_MNEMONIC_PFRSQIT1              = 410,
729     QX86_MNEMONIC_PFRSQRT               = 411,
730     QX86_MNEMONIC_PFSUB                 = 412,
731     QX86_MNEMONIC_PFSUBR                = 413,
732     QX86_MNEMONIC_PHADDD                = 414,
733     QX86_MNEMONIC_PHADDSW               = 415,
734     QX86_MNEMONIC_PHADDW                = 416,
735     QX86_MNEMONIC_PHMINPOSUW            = 417,
736     QX86_MNEMONIC_PHSUBD                = 418,
737     QX86_MNEMONIC_PHSUBSW               = 419,
738     QX86_MNEMONIC_PHSUBW                = 420,
739     QX86_MNEMONIC_PI2FD                 = 421,
740     QX86_MNEMONIC_PI2FW                 = 422,
741     QX86_MNEMONIC_PINSRB                = 423,
742     QX86_MNEMONIC_PINSRD                = 424,
743     QX86_MNEMONIC_PINSRQ                = 425,
744     QX86_MNEMONIC_PINSRW                = 426,
745     QX86_MNEMONIC_PMADDUBSW             = 427,
746     QX86_MNEMONIC_PMADDWD               = 428,
747     QX86_MNEMONIC_PMAXSB                = 429,
748     QX86_MNEMONIC_PMAXSD                = 430,
749     QX86_MNEMONIC_PMAXSW                = 431,
750     QX86_MNEMONIC_PMAXUB                = 432,
751     QX86_MNEMONIC_PMAXUD                = 433,
752     QX86_MNEMONIC_PMAXUW                = 434,
753     QX86_MNEMONIC_PMINSB                = 435,
754     QX86_MNEMONIC_PMINSD                = 436,
755     QX86_MNEMONIC_PMINSW                = 437,
756     QX86_MNEMONIC_PMINUB                = 438,
757     QX86_MNEMONIC_PMINUD                = 439,
758     QX86_MNEMONIC_PMINUW                = 440,
759     QX86_MNEMONIC_PMOVMSKB              = 441,
760     QX86_MNEMONIC_PMOVSXBD              = 442,
761     QX86_MNEMONIC_PMOVSXBQ              = 443,
762     QX86_MNEMONIC_PMOVSXBW              = 444,
763     QX86_MNEMONIC_PMOVSXDQ              = 445,
764     QX86_MNEMONIC_PMOVSXWD              = 446,
765     QX86_MNEMONIC_PMOVSXWQ              = 447,
766     QX86_MNEMONIC_PMOVZXBD              = 448,
767     QX86_MNEMONIC_PMOVZXBQ              = 449,
768     QX86_MNEMONIC_PMOVZXBW              = 450,
769     QX86_MNEMONIC_PMOVZXDQ              = 451,
770     QX86_MNEMONIC_PMOVZXWD              = 452,
771     QX86_MNEMONIC_PMOVZXWQ              = 453,
772     QX86_MNEMONIC_PMULDQ                = 454,
773     QX86_MNEMONIC_PMULHRSW              = 455,
774     QX86_MNEMONIC_PMULHRW               = 456,
775     QX86_MNEMONIC_PMULHUW               = 457,
776     QX86_MNEMONIC_PMULHW                = 458,
777     QX86_MNEMONIC_PMULLD                = 459,
778     QX86_MNEMONIC_PMULLW                = 460,
779     QX86_MNEMONIC_PMULUDQ               = 461,
780     QX86_MNEMONIC_POP                   = 462,
781     QX86_MNEMONIC_POPA                  = 463,
782     QX86_MNEMONIC_POPAD                 = 464,
783     QX86_MNEMONIC_POPCNT                = 465,
784     QX86_MNEMONIC_POPF                  = 466,
785     QX86_MNEMONIC_POPFD                 = 467,
786     QX86_MNEMONIC_POPFQ                 = 468,
787     QX86_MNEMONIC_POR                   = 469,
788     QX86_MNEMONIC_PREFETCH              = 470,
789     QX86_MNEMONIC_PREFETCHNTA           = 471,
790     QX86_MNEMONIC_PREFETCHT0            = 472,
791     QX86_MNEMONIC_PREFETCHT1            = 473,
792     QX86_MNEMONIC_PREFETCHT2            = 474,
793     QX86_MNEMONIC_PREFETCHW             = 475,
794     QX86_MNEMONIC_PSADBW                = 476,
795     QX86_MNEMONIC_PSHUFB                = 477,
796     QX86_MNEMONIC_PSHUFD                = 478,
797     QX86_MNEMONIC_PSHUFHW               = 479,
798     QX86_MNEMONIC_PSHUFLW               = 480,
799     QX86_MNEMONIC_PSHUFW                = 481,
800     QX86_MNEMONIC_PSIGNB                = 482,
801     QX86_MNEMONIC_PSIGND                = 483,
802     QX86_MNEMONIC_PSIGNW                = 484,
803     QX86_MNEMONIC_PSLLD                 = 485,
804     QX86_MNEMONIC_PSLLDQ                = 486,
805     QX86_MNEMONIC_PSLLQ                 = 487,
806     QX86_MNEMONIC_PSLLW                 = 488,
807     QX86_MNEMONIC_PSRAD                 = 489,
808     QX86_MNEMONIC_PSRAW                 = 490,
809     QX86_MNEMONIC_PSRLD                 = 491,
810     QX86_MNEMONIC_PSRLDQ                = 492,
811     QX86_MNEMONIC_PSRLQ                 = 493,
812     QX86_MNEMONIC_PSRLW                 = 494,
813     QX86_MNEMONIC_PSUBB                 = 495,
814     QX86_MNEMONIC_PSUBD                 = 496,
815     QX86_MNEMONIC_PSUBQ                 = 497,
816     QX86_MNEMONIC_PSUBSB                = 498,
817     QX86_MNEMONIC_PSUBSW                = 499,
818     QX86_MNEMONIC_PSUBUSB               = 500,
819     QX86_MNEMONIC_PSUBUSW               = 501,
820     QX86_MNEMONIC_PSUBW                 = 502,
821     QX86_MNEMONIC_PSWAPD                = 503,
822     QX86_MNEMONIC_PTEST                 = 504,
823     QX86_MNEMONIC_PUNPCKHBW             = 505,
824     QX86_MNEMONIC_PUNPCKHDQ             = 506,
825     QX86_MNEMONIC_PUNPCKHQDQ            = 507,
826     QX86_MNEMONIC_PUNPCKHWD             = 508,
827     QX86_MNEMONIC_PUNPCKLBW             = 509,
828     QX86_MNEMONIC_PUNPCKLDQ             = 510,
829     QX86_MNEMONIC_PUNPCKLQDQ            = 511,
830     QX86_MNEMONIC_PUNPCKLWD             = 512,
831     QX86_MNEMONIC_PUSH                  = 513,
832     QX86_MNEMONIC_PUSHA                 = 514,
833     QX86_MNEMONIC_PUSHAD                = 515,
834     QX86_MNEMONIC_PUSHF                 = 516,
835     QX86_MNEMONIC_PUSHFD                = 517,
836     QX86_MNEMONIC_PUSHFQ                = 518,
837     QX86_MNEMONIC_PXOR                  = 519,
838     QX86_MNEMONIC_RCL                   = 520,
839     QX86_MNEMONIC_RCPPS                 = 521,
840     QX86_MNEMONIC_RCPSS                 = 522,
841     QX86_MNEMONIC_RCR                   = 523,
842     QX86_MNEMONIC_RDMSR                 = 524,
843     QX86_MNEMONIC_RDPMC                 = 525,
844     QX86_MNEMONIC_RDTSC                 = 526,
845     QX86_MNEMONIC_RDTSCP                = 527,
846     QX86_MNEMONIC_RET                   = 528,
847     QX86_MNEMONIC_RETF                  = 529,
848     QX86_MNEMONIC_ROL                   = 530,
849     QX86_MNEMONIC_ROR                   = 531,
850     QX86_MNEMONIC_ROUNDPD               = 532,
851     QX86_MNEMONIC_ROUNDPS               = 533,
852     QX86_MNEMONIC_ROUNDSD               = 534,
853     QX86_MNEMONIC_ROUNDSS               = 535,
854     QX86_MNEMONIC_RSM                   = 536,
855     QX86_MNEMONIC_RSQRTPS               = 537,
856     QX86_MNEMONIC_RSQRTSS               = 538,
857     QX86_MNEMONIC_SAHF                  = 539,
858     QX86_MNEMONIC_SALC                  = 540,
859     QX86_MNEMONIC_SAR                   = 541,
860     QX86_MNEMONIC_SBB                   = 542,
861     QX86_MNEMONIC_SCASB                 = 543,
862     QX86_MNEMONIC_SCASD                 = 544,
863     QX86_MNEMONIC_SCASQ                 = 545,
864     QX86_MNEMONIC_SCASW                 = 546,
865     QX86_MNEMONIC_SETA                  = 547,
866     QX86_MNEMONIC_SETAE                 = 548,
867     QX86_MNEMONIC_SETB                  = 549,
868     QX86_MNEMONIC_SETBE                 = 550,
869     QX86_MNEMONIC_SETG                  = 551,
870     QX86_MNEMONIC_SETGE                 = 552,
871     QX86_MNEMONIC_SETL                  = 553,
872     QX86_MNEMONIC_SETLE                 = 554,
873     QX86_MNEMONIC_SETNO                 = 555,
874     QX86_MNEMONIC_SETNP                 = 556,
875     QX86_MNEMONIC_SETNS                 = 557,
876     QX86_MNEMONIC_SETNZ                 = 558,
877     QX86_MNEMONIC_SETO                  = 559,
878     QX86_MNEMONIC_SETP                  = 560,
879     QX86_MNEMONIC_SETS                  = 561,
880     QX86_MNEMONIC_SETZ                  = 562,
881     QX86_MNEMONIC_SFENCE                = 563,
882     QX86_MNEMONIC_SGDT                  = 564,
883     QX86_MNEMONIC_SHL                   = 565,
884     QX86_MNEMONIC_SHLD                  = 566,
885     QX86_MNEMONIC_SHR                   = 567,
886     QX86_MNEMONIC_SHRD                  = 568,
887     QX86_MNEMONIC_SHUFPD                = 569,
888     QX86_MNEMONIC_SHUFPS                = 570,
889     QX86_MNEMONIC_SIDT                  = 571,
890     QX86_MNEMONIC_SKINIT                = 572,
891     QX86_MNEMONIC_SLDT                  = 573,
892     QX86_MNEMONIC_SMSW                  = 574,
893     QX86_MNEMONIC_SQRTPD                = 575,
894     QX86_MNEMONIC_SQRTPS                = 576,
895     QX86_MNEMONIC_SQRTSD                = 577,
896     QX86_MNEMONIC_SQRTSS                = 578,
897     QX86_MNEMONIC_STC                   = 579,
898     QX86_MNEMONIC_STD                   = 580,
899     QX86_MNEMONIC_STGI                  = 581,
900     QX86_MNEMONIC_STI                   = 582,
901     QX86_MNEMONIC_STMXCSR               = 583,
902     QX86_MNEMONIC_STOSB                 = 584,
903     QX86_MNEMONIC_STOSD                 = 585,
904     QX86_MNEMONIC_STOSQ                 = 586,
905     QX86_MNEMONIC_STOSW                 = 587,
906     QX86_MNEMONIC_STR                   = 588,
907     QX86_MNEMONIC_SUB                   = 589,
908     QX86_MNEMONIC_SUBPD                 = 590,
909     QX86_MNEMONIC_SUBPS                 = 591,
910     QX86_MNEMONIC_SUBSD                 = 592,
911     QX86_MNEMONIC_SUBSS                 = 593,
912     QX86_MNEMONIC_SWAPGS                = 594,
913     QX86_MNEMONIC_SYSCALL               = 595,
914     QX86_MNEMONIC_SYSENTER              = 596,
915     QX86_MNEMONIC_SYSEXIT               = 597,
916     QX86_MNEMONIC_SYSRET                = 598,
917     QX86_MNEMONIC_TEST                  = 599,
918     QX86_MNEMONIC_UCOMISD               = 600,
919     QX86_MNEMONIC_UCOMISS               = 601,
920     QX86_MNEMONIC_UD2                   = 602,
921     QX86_MNEMONIC_UNPCKHPD              = 603,
922     QX86_MNEMONIC_UNPCKHPS              = 604,
923     QX86_MNEMONIC_UNPCKLPD              = 605,
924     QX86_MNEMONIC_UNPCKLPS              = 606,
925     QX86_MNEMONIC_VERR                  = 607,
926     QX86_MNEMONIC_VERW                  = 608,
927     QX86_MNEMONIC_VMCALL                = 609,
928     QX86_MNEMONIC_VMCLEAR               = 610,
929     QX86_MNEMONIC_VMLAUNCH              = 611,
930     QX86_MNEMONIC_VMLOAD                = 612,
931     QX86_MNEMONIC_VMMCALL               = 613,
932     QX86_MNEMONIC_VMPTRLD               = 614,
933     QX86_MNEMONIC_VMPTRST               = 615,
934     QX86_MNEMONIC_VMREAD                = 616,
935     QX86_MNEMONIC_VMRESUME              = 617,
936     QX86_MNEMONIC_VMRUN                 = 618,
937     QX86_MNEMONIC_VMSAVE                = 619,
938     QX86_MNEMONIC_VMWRITE               = 620,
939     QX86_MNEMONIC_VMXOFF                = 621,
940     QX86_MNEMONIC_VMXON                 = 622,
941     QX86_MNEMONIC_WBINVD                = 623,
942     QX86_MNEMONIC_WRMSR                 = 624,
943     QX86_MNEMONIC_XADD                  = 625,
944     QX86_MNEMONIC_XCHG                  = 626,
945     QX86_MNEMONIC_XGETBV                = 627,
946     QX86_MNEMONIC_XLAT                  = 628,
947     QX86_MNEMONIC_XOR                   = 629,
948     QX86_MNEMONIC_XORPD                 = 630,
949     QX86_MNEMONIC_XORPS                 = 631,
950     QX86_MNEMONIC_XRSTOR                = 632,
951     QX86_MNEMONIC_XSAVE                 = 633,
952     QX86_MNEMONIC_XSETBV                = 634,
953
954     QX86_MNEMONIC_COUNT                 = 635
955 };
956
957
958 /**
959  * Enumeration of mnemonic attributes.
960  *
961  * \author                              icee
962  * \since                               1.0
963  */
964 enum
965 {
966     QX86_MATTRIBUTE_NONE                = 0,
967     QX86_MATTRIBUTE_REP                 = 1 << 0,
968     QX86_MATTRIBUTE_REPZ                = 1 << 1,
969     QX86_MATTRIBUTE_DEFAULT_SIZE_64     = 1 << 2,
970     QX86_MATTRIBUTE_FIXED_SIZE_64       = 1 << 3,
971     QX86_MATTRIBUTE_INTERLOCKABLE       = 1 << 4,
972     QX86_MATTRIBUTE_IMPLICIT_LOCK       = 1 << 5
973 };
974
975
976
977 /**
978  * Enumeration of ModRM fields.
979  *
980  * \author                              icee
981  * \since                               1.0
982  */
983 enum
984 {
985     QX86_MODRM_FIELD_NONE               = 0,
986
987     QX86_MODRM_FIELD_MOD                = 1 << 0,
988     QX86_MODRM_FIELD_REG                = 1 << 2,
989     QX86_MODRM_FIELD_RM                 = 1 << 3
990 };
991
992
993
994 /**
995  * Enumeration of <em>x86</em> opcode escapes.
996  *
997  * \author                              icee
998  * \since                               1.0
999  */
1000 enum
1001 {
1002     QX86_OPCODE_ESCAPE_NONE             = 0,
1003
1004     QX86_OPCODE_ESCAPE_0F               = 1,
1005     QX86_OPCODE_ESCAPE_0F_38            = 2,
1006     QX86_OPCODE_ESCAPE_0F_3A            = 3,
1007
1008     QX86_OPCODE_ESCAPE_COUNT            = 4
1009 };
1010
1011
1012
1013 /**
1014  * Enumeration of opcode map indexes.
1015  *
1016  * \author                              icee
1017  * \since                               1.0
1018  */
1019 enum
1020 {
1021     QX86_OPCODE_MAP_INDEX_NONE          = 0,
1022
1023     QX86_OPCODE_MAP_INDEX_NB            = 1,
1024     QX86_OPCODE_MAP_INDEX_PB            = 2,
1025
1026     QX86_OPCODE_MAP_INDEX_AS            = 3,
1027     QX86_OPCODE_MAP_INDEX_CS            = 4,
1028     QX86_OPCODE_MAP_INDEX_OS            = 5,
1029
1030     QX86_OPCODE_MAP_INDEX_SP            = 6,
1031
1032     QX86_OPCODE_MAP_INDEX_MOD           = 7,
1033     QX86_OPCODE_MAP_INDEX_REG           = 8,
1034     QX86_OPCODE_MAP_INDEX_RM            = 9,
1035
1036     QX86_OPCODE_MAP_INDEX_COUNT         = 10
1037 };
1038
1039
1040
1041 /**
1042  * Enumeration of opcode map item codes.
1043  *
1044  * \author                              icee
1045  * \since                               1.0
1046  */
1047 enum
1048 {
1049     QX86_OPCODE_MAP_ITEM_CODE_NONE      = -0,
1050     QX86_OPCODE_MAP_ITEM_CODE_LINK      = -1,
1051     QX86_OPCODE_MAP_ITEM_CODE_PREFIX    = -2
1052 };
1053
1054
1055
1056 /**
1057  * Enumeration of <em>x86</em> operand attributes.
1058  *
1059  * \author                              icee
1060  * \since                               1.0
1061  */
1062 enum
1063 {
1064     QX86_OPERAND_ATTRIBUTE_NONE         = 0,
1065
1066     QX86_OPERAND_ATTRIBUTE_READ         = 1,
1067     QX86_OPERAND_ATTRIBUTE_WRITTEN      = 2,
1068     QX86_OPERAND_ATTRIBUTE_READWRITTEN  = 3,
1069
1070     QX86_OPERAND_ATTRIBUTE_RW_CERTAIN   = 4
1071 };
1072
1073
1074
1075 /**
1076  * Enumeration of <em>x86</em> operand form types.
1077  *
1078  * \author                              icee
1079  * \since                               1.0
1080  */
1081 enum
1082 {
1083     QX86_OPERAND_FORM_TYPE_NONE         = 0,
1084
1085     QX86_OPERAND_FORM_TYPE_AMODE        = 1,
1086     QX86_OPERAND_FORM_TYPE_IMPLICIT_1   = 2,
1087     QX86_OPERAND_FORM_TYPE_RTUPLE       = 3,
1088
1089     QX86_OPERAND_FORM_COUNT             = 4
1090 };
1091
1092
1093
1094 /**
1095  * Enumeration of <em>x86</em> operand types.
1096  *
1097  * \author                              icee
1098  * \since                               1.0
1099  */
1100 enum
1101 {
1102     QX86_OPERAND_TYPE_NONE              = 0,
1103
1104     QX86_OPERAND_TYPE_FAR_POINTER       = 1,
1105     QX86_OPERAND_TYPE_IMMEDIATE         = 2,
1106     QX86_OPERAND_TYPE_JUMP_OFFSET       = 3,
1107     QX86_OPERAND_TYPE_MEMORY            = 4,
1108     QX86_OPERAND_TYPE_REGISTER          = 5,
1109
1110     QX86_OPERAND_TYPE_COUNT             = 6
1111 };
1112
1113
1114
1115 /**
1116  * Enumeration of <em>x86</em> register classes.
1117  *
1118  * \author                              icee
1119  * \since                               1.0
1120  */
1121 enum
1122 {
1123     QX86_RCLASS_NONE                    = 0,
1124     QX86_RCLASS_IP                      = 1,
1125     QX86_RCLASS_FLAGS                   = 2,
1126     QX86_RCLASS_RESERVED_3              = 3,
1127
1128     QX86_RCLASS_REG8                    = 4,
1129     QX86_RCLASS_REG16                   = 5,
1130     QX86_RCLASS_REG32                   = 6,
1131     QX86_RCLASS_REG64                   = 7,
1132
1133     QX86_RCLASS_CREG                    = 8,
1134     QX86_RCLASS_DREG                    = 9,
1135     QX86_RCLASS_SREG                    = 10,
1136     QX86_RCLASS_RESERVED_11             = 11,
1137
1138     QX86_RCLASS_X87                     = 12,
1139     QX86_RCLASS_MMX                     = 13,
1140     QX86_RCLASS_XMM                     = 14,
1141     QX86_RCLASS_YMM                     = 15,
1142
1143     QX86_RCLASS_COUNT                   = 16
1144 };
1145
1146
1147
1148 /**
1149  * Enumeration of <em>x86</em> registers.
1150  *
1151  * \author                              icee
1152  * \since                               1.0
1153  */
1154 enum
1155 {
1156     QX86_REGISTER_NONE                  = 0,
1157     QX86_REGISTER_INVALID               = 1,
1158     QX86_REGISTER_SPECIAL               = 2,
1159     QX86_REGISTER_RESERVED_3            = 3,
1160
1161     QX86_REGISTER_RESERVED_4            = 4,
1162     QX86_REGISTER_IP                    = 5,
1163     QX86_REGISTER_EIP                   = 6,
1164     QX86_REGISTER_RIP                   = 7,
1165
1166     QX86_REGISTER_RESERVED_8            = 8,
1167     QX86_REGISTER_FLAGS                 = 9,
1168     QX86_REGISTER_EFLAGS                = 10,
1169     QX86_REGISTER_RFLAGS                = 11,
1170
1171     QX86_REGISTER_AH                    = 12,
1172     QX86_REGISTER_CH                    = 13,
1173     QX86_REGISTER_DH                    = 14,
1174     QX86_REGISTER_BH                    = 15,
1175
1176     QX86_REGISTER_AL                    = 16,
1177     QX86_REGISTER_CL                    = 17,
1178     QX86_REGISTER_DL                    = 18,
1179     QX86_REGISTER_BL                    = 19,
1180     QX86_REGISTER_SPL                   = 20,
1181     QX86_REGISTER_BPL                   = 21,
1182     QX86_REGISTER_SIL                   = 22,
1183     QX86_REGISTER_DIL                   = 23,
1184     QX86_REGISTER_R8B                   = 24,
1185     QX86_REGISTER_R9B                   = 25,
1186     QX86_REGISTER_R10B                  = 26,
1187     QX86_REGISTER_R11B                  = 27,
1188     QX86_REGISTER_R12B                  = 28,
1189     QX86_REGISTER_R13B                  = 29,
1190     QX86_REGISTER_R14B                  = 30,
1191     QX86_REGISTER_R15B                  = 31,
1192
1193     QX86_REGISTER_AX                    = 32,
1194     QX86_REGISTER_CX                    = 33,
1195     QX86_REGISTER_DX                    = 34,
1196     QX86_REGISTER_BX                    = 35,
1197     QX86_REGISTER_SP                    = 36,
1198     QX86_REGISTER_BP                    = 37,
1199     QX86_REGISTER_SI                    = 38,
1200     QX86_REGISTER_DI                    = 39,
1201     QX86_REGISTER_R8W                   = 40,
1202     QX86_REGISTER_R9W                   = 41,
1203     QX86_REGISTER_R10W                  = 42,
1204     QX86_REGISTER_R11W                  = 43,
1205     QX86_REGISTER_R12W                  = 44,
1206     QX86_REGISTER_R13W                  = 45,
1207     QX86_REGISTER_R14W                  = 46,
1208     QX86_REGISTER_R15W                  = 47,
1209
1210     QX86_REGISTER_EAX                   = 48,
1211     QX86_REGISTER_ECX                   = 49,
1212     QX86_REGISTER_EDX                   = 50,
1213     QX86_REGISTER_EBX                   = 51,
1214     QX86_REGISTER_ESP                   = 52,
1215     QX86_REGISTER_EBP                   = 53,
1216     QX86_REGISTER_ESI                   = 54,
1217     QX86_REGISTER_EDI                   = 55,
1218     QX86_REGISTER_R8D                   = 56,
1219     QX86_REGISTER_R9D                   = 57,
1220     QX86_REGISTER_R10D                  = 58,
1221     QX86_REGISTER_R11D                  = 59,
1222     QX86_REGISTER_R12D                  = 60,
1223     QX86_REGISTER_R13D                  = 61,
1224     QX86_REGISTER_R14D                  = 62,
1225     QX86_REGISTER_R15D                  = 63,
1226
1227     QX86_REGISTER_RAX                   = 64,
1228     QX86_REGISTER_RCX                   = 65,
1229     QX86_REGISTER_RDX                   = 66,
1230     QX86_REGISTER_RBX                   = 67,
1231     QX86_REGISTER_RSP                   = 68,
1232     QX86_REGISTER_RBP                   = 69,
1233     QX86_REGISTER_RSI                   = 70,
1234     QX86_REGISTER_RDI                   = 71,
1235     QX86_REGISTER_R8                    = 72,
1236     QX86_REGISTER_R9                    = 73,
1237     QX86_REGISTER_R10                   = 74,
1238     QX86_REGISTER_R11                   = 75,
1239     QX86_REGISTER_R12                   = 76,
1240     QX86_REGISTER_R13                   = 77,
1241     QX86_REGISTER_R14                   = 78,
1242     QX86_REGISTER_R15                   = 79,
1243
1244     QX86_REGISTER_CR0                   = 80,
1245     QX86_REGISTER_CR1                   = 81,
1246     QX86_REGISTER_CR2                   = 82,
1247     QX86_REGISTER_CR3                   = 83,
1248     QX86_REGISTER_CR4                   = 84,
1249     QX86_REGISTER_CR5                   = 85,
1250     QX86_REGISTER_CR6                   = 86,
1251     QX86_REGISTER_CR7                   = 87,
1252     QX86_REGISTER_CR8                   = 88,
1253     QX86_REGISTER_CR9                   = 89,
1254     QX86_REGISTER_CR10                  = 90,
1255     QX86_REGISTER_CR11                  = 91,
1256     QX86_REGISTER_CR12                  = 92,
1257     QX86_REGISTER_CR13                  = 93,
1258     QX86_REGISTER_CR14                  = 94,
1259     QX86_REGISTER_CR15                  = 95,
1260
1261     QX86_REGISTER_DR0                   = 96,
1262     QX86_REGISTER_DR1                   = 97,
1263     QX86_REGISTER_DR2                   = 98,
1264     QX86_REGISTER_DR3                   = 99,
1265     QX86_REGISTER_DR4                   = 100,
1266     QX86_REGISTER_DR5                   = 101,
1267     QX86_REGISTER_DR6                   = 102,
1268     QX86_REGISTER_DR7                   = 103,
1269     QX86_REGISTER_DR8                   = 104,
1270     QX86_REGISTER_DR9                   = 105,
1271     QX86_REGISTER_DR10                  = 106,
1272     QX86_REGISTER_DR11                  = 107,
1273     QX86_REGISTER_DR12                  = 108,
1274     QX86_REGISTER_DR13                  = 109,
1275     QX86_REGISTER_DR14                  = 110,
1276     QX86_REGISTER_DR15                  = 111,
1277
1278     QX86_REGISTER_ES                    = 112,
1279     QX86_REGISTER_CS                    = 113,
1280     QX86_REGISTER_SS                    = 114,
1281     QX86_REGISTER_DS                    = 115,
1282     QX86_REGISTER_FS                    = 116,
1283     QX86_REGISTER_GS                    = 117,
1284     QX86_REGISTER_SR6                   = 118,
1285     QX86_REGISTER_SR7                   = 119,
1286
1287     QX86_REGISTER_ST0                   = 120,
1288     QX86_REGISTER_ST1                   = 121,
1289     QX86_REGISTER_ST2                   = 122,
1290     QX86_REGISTER_ST3                   = 123,
1291     QX86_REGISTER_ST4                   = 124,
1292     QX86_REGISTER_ST5                   = 125,
1293     QX86_REGISTER_ST6                   = 126,
1294     QX86_REGISTER_ST7                   = 127,
1295
1296     QX86_REGISTER_FPR0                  = 128,
1297     QX86_REGISTER_FPR1                  = 129,
1298     QX86_REGISTER_FPR2                  = 130,
1299     QX86_REGISTER_FPR3                  = 131,
1300     QX86_REGISTER_FPR4                  = 132,
1301     QX86_REGISTER_FPR5                  = 133,
1302     QX86_REGISTER_FPR6                  = 134,
1303     QX86_REGISTER_FPR7                  = 135,
1304
1305     QX86_REGISTER_MMX0                  = 136,
1306     QX86_REGISTER_MMX1                  = 137,
1307     QX86_REGISTER_MMX2                  = 138,
1308     QX86_REGISTER_MMX3                  = 139,
1309     QX86_REGISTER_MMX4                  = 140,
1310     QX86_REGISTER_MMX5                  = 141,
1311     QX86_REGISTER_MMX6                  = 142,
1312     QX86_REGISTER_MMX7                  = 143,
1313
1314     QX86_REGISTER_XMM0                  = 144,
1315     QX86_REGISTER_XMM1                  = 145,
1316     QX86_REGISTER_XMM2                  = 146,
1317     QX86_REGISTER_XMM3                  = 147,
1318     QX86_REGISTER_XMM4                  = 148,
1319     QX86_REGISTER_XMM5                  = 149,
1320     QX86_REGISTER_XMM6                  = 150,
1321     QX86_REGISTER_XMM7                  = 151,
1322     QX86_REGISTER_XMM8                  = 152,
1323     QX86_REGISTER_XMM9                  = 153,
1324     QX86_REGISTER_XMM10                 = 154,
1325     QX86_REGISTER_XMM11                 = 155,
1326     QX86_REGISTER_XMM12                 = 156,
1327     QX86_REGISTER_XMM13                 = 157,
1328     QX86_REGISTER_XMM14                 = 158,
1329     QX86_REGISTER_XMM15                 = 159,
1330
1331     QX86_REGISTER_YMM0                  = 160,
1332     QX86_REGISTER_YMM1                  = 161,
1333     QX86_REGISTER_YMM2                  = 162,
1334     QX86_REGISTER_YMM3                  = 163,
1335     QX86_REGISTER_YMM4                  = 164,
1336     QX86_REGISTER_YMM5                  = 165,
1337     QX86_REGISTER_YMM6                  = 166,
1338     QX86_REGISTER_YMM7                  = 167,
1339     QX86_REGISTER_YMM8                  = 168,
1340     QX86_REGISTER_YMM9                  = 169,
1341     QX86_REGISTER_YMM10                 = 170,
1342     QX86_REGISTER_YMM11                 = 171,
1343     QX86_REGISTER_YMM12                 = 172,
1344     QX86_REGISTER_YMM13                 = 173,
1345     QX86_REGISTER_YMM14                 = 174,
1346     QX86_REGISTER_YMM15                 = 175,
1347
1348     QX86_REGISTER_COUNT                 = 176
1349 };
1350
1351
1352
1353 /**
1354  * Enumeration of ModRM and SIB <em>scale</em> values.
1355  *
1356  * \author                              icee
1357  * \since                               1.0
1358  */
1359 enum
1360 {
1361     QX86_SCALE_NONE                     = 0,
1362     QX86_SCALE_X2                       = 1,
1363     QX86_SCALE_X4                       = 2,
1364     QX86_SCALE_X8                       = 3,
1365     QX86_SCALE_INVALID                  = 4
1366 };
1367
1368
1369
1370 /**
1371  * Enumeration of <em>x86</em> code, address, operand, and stack sizes.
1372  *
1373  * \author                              icee
1374  * \since                               1.0
1375  */
1376 enum
1377 {
1378     QX86_SIZE_16                        = 0,
1379     QX86_SIZE_32                        = 1,
1380     QX86_SIZE_64                        = 2,
1381     QX86_SIZE_INVALID                   = 3,
1382     QX86_SIZE_MASK                      = 3
1383 };
1384
1385
1386
1387 /**
1388  * Enumeration of <em>x86</em> subregisters.
1389  *
1390  * \author                              icee
1391  * \since                               1.0
1392  */
1393 enum
1394 {
1395     QX86_SUBREG_NONE                    = 0,
1396
1397     QX86_SUBREG_BASE                    = 1,
1398     QX86_SUBREG_LIMIT                   = 2,
1399     QX86_SUBREG_FLAGS                   = 3,
1400
1401     QX86_SUBREG_COUNT                   = 4
1402 };
1403
1404
1405 /* Public API structures.  */
1406
1407
1408 /**
1409  * Addressing mode definition structure.
1410  *
1411  * \author                              icee
1412  * \since                               1.0
1413  */
1414 struct qx86_amode
1415 {
1416     QX86_CONST char *                   referenceName;
1417     QX86_CONST char *                   name;
1418
1419     qx86_uint8                          modrmField;
1420     qx86_uint8                          rclass;
1421
1422     int                                 (*decodeFunc)(qx86_insn *, int);
1423 };
1424
1425
1426
1427 /**
1428  * Callback function definition.
1429  *
1430  * \author                              icee
1431  * \since                               1.0
1432  */
1433 typedef int                             (*qx86_callback)(void *data, int rindex, int subreg, unsigned char *value);
1434
1435
1436
1437 /**
1438  * Decode context structure.
1439  *
1440  * \author                              icee
1441  * \since                               1.0
1442  */
1443 struct qx86_ctx
1444 {
1445     qx86_uint8 *                        ptr;
1446     int                                 ptrSize;
1447
1448     int                                 pumpIndex;
1449 };
1450
1451
1452
1453
1454
1455 /**
1456  * Instruction attributes definition structure.
1457  *
1458  * \author                              icee
1459  * \since                               1.0
1460  */
1461 struct qx86_insn_attributes
1462 {
1463     qx86_uint8                          addressSize;
1464     qx86_uint8                          addressSizeOverridden;
1465
1466     qx86_uint8                          operandSize;
1467     qx86_uint8                          operandSizeOverridden;
1468
1469     qx86_uint8                          interlocked;
1470 };
1471
1472
1473
1474 /**
1475  * Instruction modifiers definition structure.
1476  *
1477  * \author                              icee
1478  * \since                               1.0
1479  */
1480 struct qx86_insn_modifiers
1481 {
1482     qx86_uint8                          modrm;
1483     qx86_int8                           modrmIndex;
1484
1485     qx86_uint8                          sib;
1486     qx86_int8                           sibIndex;
1487
1488     qx86_uint8                          rex;
1489     qx86_int8                           rexIndex;
1490
1491     qx86_uint8                          prefixSize;
1492
1493     qx86_uint8                          escape;
1494     qx86_uint8                          opcodePrefix;
1495
1496     /* XXX: values 0x00, 0xF2, 0xF3.  */
1497     qx86_uint8                          repeatPrefix;
1498
1499     int                                 sriOverride;
1500
1501     qx86_uint8                          extendedB;
1502     qx86_uint8                          extendedR;
1503     qx86_uint8                          extendedX;
1504 };
1505
1506
1507
1508
1509
1510
1511
1512 /**
1513  * Far pointer instruction operand definition structure.
1514  *
1515  * \author                              icee
1516  * \since                               1.0
1517  */
1518 struct qx86_operand_far_pointer
1519 {
1520     qx86_uint8                          offset[QX86_IMMEDIATE_SIZE_MAX];
1521     qx86_uint8                          offsetSize;
1522
1523     qx86_uint8                          selector[2];
1524 };
1525
1526
1527
1528 /**
1529  * Immediate instruction operand definition structure.
1530  *
1531  * \author                              icee
1532  * \since                               1.0
1533  */
1534 struct qx86_operand_immediate
1535 {
1536     qx86_uint8                          value[QX86_IMMEDIATE_SIZE_MAX];
1537     qx86_uint8                          valueSize;
1538 };
1539
1540
1541
1542 /**
1543  * Jump offset instruction operand definition structure.
1544  *
1545  * \author                              icee
1546  * \since                               1.0
1547  */
1548 struct qx86_operand_jump_offset
1549 {
1550     qx86_uint8                          offset[QX86_IMMEDIATE_SIZE_MAX];
1551     qx86_uint8                          offsetSize;
1552 };
1553
1554
1555
1556 /**
1557  * Memory instruction operand definition structure.
1558  *
1559  * \author                              icee
1560  * \since                               1.0
1561  */
1562 struct qx86_operand_memory
1563 {
1564     int                                 sri;
1565     int                                 bri;
1566     int                                 iri;
1567
1568     int                                 scale;
1569
1570     qx86_uint8                          disp[QX86_IMMEDIATE_SIZE_MAX];
1571     qx86_uint8                          dispSize;
1572 };
1573
1574
1575
1576 /**
1577  * Register instruction operand definition structure.
1578  *
1579  * \author                              icee
1580  * \since                               1.0
1581  */
1582 struct qx86_operand_register
1583 {
1584     int                                 rindex;
1585 };
1586
1587
1588 /**
1589  * Instruction operand definition union.
1590  *
1591  * \author                              icee
1592  * \since                               1.0
1593  */
1594 union qx86_operand_union
1595 {
1596     qx86_operand_far_pointer            f;
1597     qx86_operand_immediate              i;
1598     qx86_operand_jump_offset            j;
1599     qx86_operand_memory                 m;
1600     qx86_operand_register               r;
1601 };
1602
1603
1604 /**
1605  * Instruction operand definition structure.
1606  *
1607  * \author                              icee
1608  * \since                               1.0
1609  */
1610 struct qx86_operand
1611 {
1612     qx86_uint8                          ot;
1613
1614     int                                 attributes;
1615     int                                 size;
1616
1617     qx86_operand_union                  u;
1618 };
1619
1620
1621 /**
1622  * Instruction definition structure.
1623  *
1624  * \author                              icee
1625  * \since                               1.0
1626  */
1627 struct qx86_insn
1628 {
1629     qx86_uint8                          rawSize;
1630     qx86_uint8                          raw[QX86_INSN_SIZE_MAX];
1631
1632     int                                 processorMode;
1633
1634     int                                 mnemonic;
1635     qx86_int8                           operandCount;
1636
1637     qx86_operand                        operands[QX86_OPERAND_NMAX];
1638     qx86_operand_form *                 operandForms[QX86_OPERAND_NMAX];
1639
1640     qx86_insn_attributes                attributes;
1641     qx86_insn_modifiers                 modifiers;
1642
1643     qx86_uint8                          iclass;
1644     qx86_uint8                          defects;
1645
1646     qx86_callback                       callback;
1647     void *                              data;
1648 };
1649
1650
1651
1652 /**
1653  * Mnemonic table item definition structure.
1654  *
1655  * \author                              icee
1656  * \since                               1.0
1657  */
1658 struct qx86_mtab_item
1659 {
1660     QX86_CONST char *                   referenceName;
1661     QX86_CONST char *                   name;
1662
1663     qx86_uint8                          attributes;
1664     qx86_uint8                          iclass;
1665
1666     int                                 demoted;
1667     int                                 promoted;
1668
1669     // TODO: AT&T print.
1670 };
1671
1672
1673
1674 /**
1675  * Opcode map definition structure.
1676  *
1677  * \author                              icee
1678  * \since                               1.0
1679  */
1680 struct qx86_opcode_map
1681 {
1682     qx86_uint8                          index;
1683     qx86_uint8                          limit;
1684
1685     qx86_opcode_map_item *              items;
1686 };
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696 /**
1697  * Addressing mode instruction operand form definition structure.
1698  *
1699  * \author                              icee
1700  * \since                               1.0
1701  */
1702 struct qx86_operand_form_amode
1703 {
1704     qx86_amode *                        amode;
1705     qx86_stuple *                       stuple;
1706 };
1707
1708
1709
1710 /**
1711  * Register tuple instruction operand form definition structure.
1712  *
1713  * \author                              icee
1714  * \since                               1.0
1715  */
1716 struct qx86_operand_form_rtuple
1717 {
1718     qx86_rtuple *                       rtuple;
1719 };
1720
1721
1722 /**
1723  * Instruction operand form definition union.
1724  *
1725  * \author                              icee
1726  * \since                               1.0
1727  */
1728 union qx86_operand_form_union
1729 {
1730     QX86_CONST void *                   initializer[2];
1731
1732     qx86_operand_form_amode             a;
1733     qx86_operand_form_rtuple            r;
1734 };
1735
1736
1737 /**
1738  * Instruction operand form definition structure.
1739  *
1740  * \author                              icee
1741  * \since                               1.0
1742  */
1743 struct qx86_operand_form
1744 {
1745     int                                 ft;
1746     int                                 attributes;
1747     qx86_operand_form_union             u;
1748 };
1749
1750
1751 /**
1752  * Opcode map item definition structure.
1753  *
1754  * \author                              icee
1755  * \since                               1.0
1756  */
1757 struct qx86_opcode_map_item
1758 {
1759     int                                 code;
1760     qx86_opcode_map *                   link;
1761
1762     int                                 operandCount;
1763     qx86_operand_form                   operandForms[QX86_OPERAND_NMAX];
1764 };
1765
1766
1767
1768 /**
1769  * Print item definition structure.
1770  *
1771  * \author                              icee
1772  * \since                               1.0
1773  */
1774 struct qx86_print_item
1775 {
1776     QX86_CONST qx86_uint8 *             number;
1777     int                                 numberSize;
1778
1779     QX86_CONST char *                   string;
1780 };
1781
1782
1783
1784 /**
1785  * Intel print options structure.
1786  *
1787  * \author                              icee
1788  * \since                               1.0
1789  */
1790 struct qx86_print_options_intel
1791 {
1792     int                                 flipCase : 1;
1793 };
1794
1795
1796
1797 /**
1798  * Register table item definition structure.
1799  *
1800  * \author                              icee
1801  * \since                               1.0
1802  */
1803 struct qx86_rtab_item
1804 {
1805     QX86_CONST char *                   referenceName;
1806     QX86_CONST char *                   name;
1807
1808     qx86_uint8                          rclass;
1809     qx86_uint8                          size;
1810 };
1811
1812
1813
1814 /**
1815  * Register tuple definition structure.
1816  *
1817  * \author                              icee
1818  * \since                               1.0
1819  */
1820 struct qx86_rtuple
1821 {
1822     QX86_CONST char *                   referenceName;
1823     QX86_CONST char *                   name;
1824
1825     int                                 rindexes[12];
1826 };
1827
1828
1829
1830 /**
1831  * Size tuple definition structure.
1832  *
1833  * \author                              icee
1834  * \since                               1.0
1835  */
1836 struct qx86_stuple
1837 {
1838     QX86_CONST char *                   referenceName;
1839     QX86_CONST char *                   name;
1840
1841     QX86_CONST char *                   atoms[4];
1842     int                                 sizes[4];
1843 };
1844
1845
1846 /**
1847  * Extract the <em>mod</em> ModRM field value.
1848  *
1849  * \param                               modrm
1850  *                                      ModRM octet value.
1851  *
1852  * \return                              ModRM <em>mod</em> field value.
1853  *
1854  * \author                              icee
1855  * \since                               1.0
1856  */
1857 #define QX86_MODRM_MOD(modrm)           ((qx86_uint8) ((modrm) >> 6))
1858
1859 /**
1860  * Extract the <em>reg</em> ModRM field value.
1861  *
1862  * \param                               modrm
1863  *                                      ModRM octet value.
1864  *
1865  * \return                              ModRM <em>reg</em> field value.
1866  *
1867  * \author                              icee
1868  * \since                               1.0
1869  */
1870 #define QX86_MODRM_REG(modrm)           ((qx86_uint8) (((modrm) >> 3) & 7))
1871
1872 /**
1873  * Extract the <em>r/m</em> ModRM field value.
1874  *
1875  * \param                               modrm
1876  *                                      ModRM octet value.
1877  *
1878  * \return                              ModRM <em>rm</em> field value.
1879  *
1880  * \author                              icee
1881  * \since                               1.0
1882  */
1883 #define QX86_MODRM_RM(modrm)            ((qx86_uint8) ((modrm) & 7))
1884
1885 /**
1886  * Extract the <em>b</em> REX field value.
1887  *
1888  * \param                               rex
1889  *                                      REX octet value.
1890  *
1891  * \return                              REX <em>b</em> field value.
1892  *
1893  * \author                              icee
1894  * \since                               1.0
1895  */
1896 #define QX86_REX_B(rex)                 ((qx86_uint8) (0 != ((rex) & 1)))
1897
1898 /**
1899  * Extract the <em>r</em> REX field value.
1900  *
1901  * \param                               rex
1902  *                                      REX octet value.
1903  *
1904  * \return                              REX <em>r</em> field value.
1905  *
1906  * \author                              icee
1907  * \since                               1.0
1908  */
1909 #define QX86_REX_R(rex)                 ((qx86_uint8) (0 != ((rex) & 4)))
1910
1911 /**
1912  * Extract the <em>w</em> REX field value.
1913  *
1914  * \param                               rex
1915  *                                      REX octet value.
1916  *
1917  * \return                              REX <em>w</em> field value.
1918  *
1919  * \author                              icee
1920  * \since                               1.0
1921  */
1922 #define QX86_REX_W(rex)                 ((qx86_uint8) (0 != ((rex) & 8)))
1923
1924 /**
1925  * Extract the <em>x</em> REX field value.
1926  *
1927  * \param                               rex
1928  *                                      REX octet value.
1929  *
1930  * \return                              REX <em>x</em> field value.
1931  *
1932  * \author                              icee
1933  * \since                               1.0
1934  */
1935 #define QX86_REX_X(rex)                 ((qx86_uint8) (0 != ((rex) & 2)))
1936
1937 /**
1938  * Extract the <em>base</em> SIB field value.
1939  *
1940  * \param                               sib
1941  *                                      SIB octet value.
1942  *
1943  * \return                              SIB <em>base</em> field value.
1944  *
1945  * \author                              icee
1946  * \since                               1.0
1947  */
1948 #define QX86_SIB_BASE(sib)              ((qx86_uint8) ((sib) & 7))
1949
1950 /**
1951  * Extract the <em>index</em> SIB field value.
1952  *
1953  * \param                               sib
1954  *                                      SIB octet value.
1955  *
1956  * \return                              SIB <em>index</em> field value.
1957  *
1958  * \author                              icee
1959  * \since                               1.0
1960  */
1961 #define QX86_SIB_INDEX(sib)             ((qx86_uint8) (((sib) >> 3) & 7))
1962
1963 /**
1964  * Extract the <em>scale</em> SIB field value.
1965  *
1966  * \param                               sib
1967  *                                      SIB octet value.
1968  *
1969  * \return                              SIB <em>scale</em> field value.
1970  *
1971  * \author                              icee
1972  * \since                               1.0
1973  */
1974 #define QX86_SIB_SCALE(sib)             ((qx86_uint8) ((sib) >> 6))
1975
1976 /**
1977  * Convert a #qx86_size enumerator to number of octets.  The \a size value must
1978  * be valid.
1979  *
1980  * \param                               size
1981  *                                      A #qx86_size enumerator.
1982  *
1983  * \return                              Number of octets.
1984  *
1985  * \author                              icee
1986  * \since                               1.0
1987  */
1988 #define QX86_SIZE_OCTETS(size)          (2 << (size))
1989
1990 /* XXX XXX XXX */
1991 extern QX86_CONST qx86_mtab_item        qx86_mtab[QX86_MNEMONIC_COUNT];
1992 extern QX86_CONST qx86_rtab_item        qx86_rtab[QX86_REGISTER_COUNT];
1993
1994 /**
1995  * Calculate effective address of an <em>x86</em> memory operand.
1996  *
1997  * TODO: documentation.
1998  *
1999  * \author                              icee
2000  * \since                               1.0
2001  */
2002 QX86_EXTERN_C int
2003 qx86_calculate_effective_address(QX86_CONST qx86_insn *insn, int operandIndex, qx86_uint64 *address);
2004
2005 /**
2006  * Calculate linear address of an <em>x86</em> memory operand.
2007  *
2008  * TODO: documentation.
2009  *
2010  * \author                              icee
2011  * \since                               1.0
2012  */
2013 QX86_EXTERN_C int
2014 qx86_calculate_linear_address(QX86_CONST qx86_insn *insn, int operandIndex, qx86_uint64 *address);
2015
2016 /**
2017  * Decode an <em>x86</em> instruction.
2018  *
2019  * TODO: documentation.
2020  *
2021  * \author                              icee
2022  * \since                               1.0
2023  */
2024 QX86_EXTERN_C int
2025 qx86_decode(qx86_insn *insn, int processorMode, QX86_CONST void *ptr, int ptrSize);
2026
2027 /**
2028  * Print a decoded <em>x86</em> instruction using the Intel format.
2029  *
2030  * TODO: documentation.
2031  *
2032  * \param                               insn
2033  *                                      Instruction to print.
2034  * \param                               options
2035  *                                      Printer options.
2036  * \param[out]                          buffer
2037  *                                      Pre-allocated buffer to print to.
2038  * \param[in,out]                       bufferSize
2039  *                                      TODO.
2040  *
2041  * \return                              TODO.
2042  *
2043  * \author                              icee
2044  * \since                               1.0
2045  */
2046 QX86_EXTERN_C int
2047 qx86_print_intel(QX86_CONST qx86_insn *insn, QX86_CONST qx86_print_options_intel *options, char *buffer, int *bufferSize);
2048
2049 #endif