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.


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