Make your own free website on Tripod.com
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

x86table.h

Go to the documentation of this file.
00001 /*
00002 PeRdr - PE file disassembler
00003 Copyright (C) 1999-2002 Frediano Ziglio
00004 -----
00005 
00006 This program is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 -----
00020 
00021 INFORMATION
00022   www: http://freddy77.tripod.com/perdr/
00023   e-mail: freddy77@angelfire.com
00024 */
00025 #include "x86instr.h"
00026 
00027 struct inst_3DNow {
00028     int     instruction;
00029 };
00030 typedef struct inst_3DNow INST_3DNOW;
00031 
00032 struct inst_f3Xmm {
00033     int     special;
00034     int     instruction;
00035 };
00036 typedef struct inst_f3Xmm INST_F3XMM;
00037 
00038 enum Regs 
00039 {
00040         regNone = 0,
00041         
00042         regAL,
00043         regCL,
00044         regDL,
00045         regBL,
00046         regAH,
00047         regCH,
00048         regDH,
00049         regBH,
00050 
00051         regAX,   // Or EAX, etc. as may arise
00052         regCX,
00053         regDX,
00054         regBX,
00055         regSP,
00056         regBP,
00057         regSI,
00058         regDI,
00059 
00060         regES,   // Segment register identifiers
00061         regCS,
00062         regSS,
00063         regDS,
00064         regFS,
00065         regGS
00066 };
00067 
00068 
00069 enum Modreg
00070 {
00071 // flag per MOD_REG operands
00072 // bits 2-0 size of registry or memory (if not specified)
00073         modregSize           =7,
00074         modregByte           =0,
00075         modregVar            =1,
00076         modregDword          =2,
00077         modregMmx            =3,
00078 // !!! warning: conflict with some memory type, not use now !!!
00079         modregXmm            =4,
00080 
00081 // bits 6-3 puntatori vari e tipo (solo per mem)
00082         modregMemStartBit    =3,
00083         modregMemType        =15<<modregMemStartBit,
00084         modregMemByte        =1<<modregMemStartBit,
00085         modregMemWord        =2<<modregMemStartBit,
00086         modregMemDword       =3<<modregMemStartBit,
00087         modregMemQword       =4<<modregMemStartBit,
00088         modregMemPacketDword =5<<modregMemStartBit, // MMX or 32bit memory
00089         modregMemPointer     =6<<modregMemStartBit,
00090         modregMemBound       =7<<modregMemStartBit,
00091         modregMemDescriptor  =8<<modregMemStartBit,
00092 // only a pointer (LEA & INVLPG)
00093         modregMemNone        =9<<modregMemStartBit,
00094         modregMemPacket      =10<<modregMemStartBit,
00095         modregMemFPacket     =11<<modregMemStartBit, // XMM or 32bit float
00096         modregMem2FPacket    =12<<modregMemStartBit,
00097         modregMem4FPacket    =13<<modregMemStartBit,
00098 
00099 // bits 8-7 mem/reg, reg/mem or mem only
00100         modregTypeStartBit   =7,
00101         modregType           =3<<modregTypeStartBit,
00102         modregMemReg         =0<<modregTypeStartBit,
00103         modregRegMem         =1<<modregTypeStartBit,
00104         modregMem            =2<<modregTypeStartBit,
00105         modregReg            =3<<modregTypeStartBit,
00106 
00107 // bits 11-9 third operand
00108         modregThirdStartBit  =9,
00109         modregThird          =7<<modregThirdStartBit,
00110         modregIsb            =1<<modregThirdStartBit,
00111         modregIub            =2<<modregThirdStartBit,
00112         modregIv             =3<<modregThirdStartBit,
00113         modreg1              =4<<modregThirdStartBit,
00114         modregCL             =5<<modregThirdStartBit,
00115 
00116 // Manca Mp
00117 // per CR, DR e TR altra funzione
00118 // per EwsW SwEw altra funzione
00119 
00120 // gruppi: funzione gruppo in instr passo numero gruppo, special il tipo
00121 // se non ha tipo passo -indice ad un vettore per i tipi
00122 // sdoppio mod_reg per passare il primo byte
00123 
00124         modregEbGb    =modregByte|modregMemReg,
00125         modregEvGv    =modregVar |modregMemReg,
00126         modregGbEb    =modregByte|modregRegMem,
00127         modregGvEv    =modregVar |modregRegMem,
00128 
00129 // segment
00130         modregEwSw    =modregVar |modregMemReg|modregMemWord,
00131         modregSwEw    =modregVar |modregRegMem|modregMemWord,
00132 
00133         modregEv      =modregVar |modregMem,
00134         modregEb1     =modregByte|modregMem|modreg1,
00135         modregEv1     =modregVar |modregMem|modreg1,
00136         modregEbCL    =modregByte|modregMem|modregCL,
00137         modregEvCL    =modregVar |modregMem|modregCL,
00138         modregGvMa    =modregVar |modregRegMem|modregMemBound,
00139         modregGvMp    =modregVar |modregRegMem|modregMemPointer,
00140         modregEbIsb   =modregByte|modregMem|modregIsb,
00141         modregEbIub   =modregByte|modregMem|modregIub,
00142         modregEvIv    =modregVar |modregMem|modregIv,
00143         modregGvEvIv  =modregVar |modregRegMem|modregIv,
00144         modregGvEvIsb =modregVar |modregRegMem|modregIsb,
00145         modregGvEvIub =modregVar |modregRegMem|modregIub,
00146         modregEb      =modregByte|modregMem,
00147         modregGvEb    =modregVar |modregRegMem|modregMemByte,
00148         modregGvEw    =modregVar |modregRegMem|modregMemWord,
00149         modregEvGvIsb =modregVar |modregMemReg|modregIsb,
00150         modregEvGvIub =modregVar |modregMemReg|modregIub,
00151         modregEvGvCL  =modregVar |modregMemReg|modregCL,
00152         modregEvIsb   =modregVar |modregMem|modregIsb,
00153         modregEvIub   =modregVar |modregMem|modregIub,
00154 
00155 // Memory only
00156         modregEp      =modregMem|modregMemPointer,
00157         modregEw      =modregMem|modregMemWord,
00158         modregMs      =modregMem|modregMemDescriptor,
00159         modregMn      =modregMem|modregMemNone,
00160         modregMq      =modregMem|modregMemQword,
00161 // LEA
00162         modregGvMn    =modregVar |modregRegMem|modregMemNone,
00163 
00164 // Mmx
00165         modregPqQd    =modregRegMem|modregMmx|modregMemPacketDword,
00166         modregPqQq    =modregRegMem|modregMmx,
00167         modregPqQqIub =modregPqQq|modregIub,
00168         modregQqPq    =modregMemReg|modregMmx,
00169         modregPqIsb   =modregReg|modregMmx|modregIsb,
00170         modregPqIub   =modregReg|modregMmx|modregIub,
00171         modregPdEd    =modregRegMem|modregMmx|modregMemDword,
00172         modregEdPd    =modregMemReg|modregMmx|modregMemDword,
00173         modregPqEdIub =modregPdEd|modregIub,
00174         modregPqEwIub =modregRegMem|modregMmx|modregMemWord|modregIub,
00175         modregGdQq    =modregRegMem|modregDword|modregMemPacket,
00176         modregGdQqIub =modregGdQq|modregIub,
00177 
00178 // Xmm
00179 // difference from ps and ss raise from opcode
00180         modregWpsVps     =modregMemReg|modregXmm,
00181         modregVpsWps     =modregRegMem|modregXmm,
00182         modregVpsWpsIub  =modregRegMem|modregXmm|modregIub,
00183         modregVpsQq      =modregRegMem|modregXmm|modregMemPacket,
00184         modregPqWq       =modregRegMem|modregMmx|modregMem2FPacket,
00185         modregVqWq       =modregRegMem|modregXmm|modregMem2FPacket,
00186         modregWqVq       =modregMemReg|modregXmm|modregMem2FPacket,
00187         modregVssWss     =modregRegMem|modregXmm|modregMemFPacket,
00188         modregVssWssIub  =modregRegMem|modregXmm|modregMemFPacket|modregIub,
00189         modregVssEd      =modregRegMem|modregXmm|modregMemDword,
00190         modregGdWss      =modregRegMem|modregDword|modregMem4FPacket,
00191         modregWssVss     =modregMemReg|modregXmm|modregMemFPacket,
00192         modregEdVps      =modregMemReg|modregXmm|modregMemDword
00193 };
00194 
00195 // special
00196 enum Movcregs
00197 {
00198         movcregR32CRx =0,
00199         movcregCRxr32 =1,
00200         movcregR32DRx =2,
00201         movcregDRxr32 =3,
00202         movcregR32TRx =4,
00203         movcregTRxr32 =5
00204 };
00205 
00206 extern INST_3DNOW  k6_3DNow_instr[];
00207 extern INST_F3XMM  f3Xmm_instr[];
00208 extern uchar       f3Xmm_offsets[];
00209 #define F3XMM(n) f3Xmm_instr[f3Xmm_offsets[n]]
00210 
00211 #define DEFINE_FPI(istr,type) ((istr<<8)|type)
00212 #define FPI_ISTR(i) (i>>8)
00213 #define FPI_TYPE(i) (i&255)
00214 enum FpiTypes
00215 {
00216   fpiTypeWInt=0,fpiTypeSInt,fpiTypeLInt,                  // interi
00217   fpiTypeSingle,fpiTypeDouble,fpiTypeExtended,fpiTypeBCD, // float
00218   fpiTypeWord,fpiTypeEnv,fpiTypeStatus,                   // altri
00219   fpiTypeCount,
00220   fpiTypeImplicitMemory = fpiTypeEnv
00221 };
00222 extern int esc_inst[];
00223 
00224 #define DEFINE_FPIM3(istr,param) DEFINE_FPI(istr,param)
00225 #define FPIM3_ISTR(i) FPI_ISTR(i)
00226 #define FPIM3_PARAM(i) FPI_TYPE(i)
00227 enum FpiParams
00228 {
00229   fpiParamNone,fpiParamStNSt,fpiParamStN,fpiParamStStN
00230 };
00231 extern int esc_inst_mod3[];
00232 extern int esc_inst_special[][8];
00233 
00234 

Generated on Mon Jan 13 22:20:35 2003 for perdr by doxygen1.2.15