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