327 lines
7.1 KiB
C
327 lines
7.1 KiB
C
/****************************************************************
|
|
* *
|
|
* Copyright 2007 Fidelity Information Services, Inc *
|
|
* *
|
|
* This source code contains the intellectual property *
|
|
* of its copyright holder(s), and is made available *
|
|
* under a license. If you do not know the terms of *
|
|
* the license, please stop and do not read further. *
|
|
* *
|
|
****************************************************************/
|
|
|
|
/* Opcodes: */
|
|
I386_OP(ADD,Eb_Gb,0x00)
|
|
I386_OP(ADD,Ev_Gv,0x01)
|
|
I386_OP(ADD,Gb_Eb,0x02)
|
|
I386_OP(ADD,Gv_Ev,0x03)
|
|
I386_OP(ADD,AL_Ib,0x04)
|
|
I386_OP(ADD,eAX_Iv,0x05)
|
|
I386_OP(PUSH,ES,0x06)
|
|
I386_OP(POP,ES,0x07)
|
|
|
|
I386_OP(OR,Eb_Gb,0x08)
|
|
I386_OP(OR,Ev_Gv,0x09)
|
|
I386_OP(OR,Gb_Eb,0x0a)
|
|
I386_OP(OR,Gv_Ev,0x0b)
|
|
I386_OP(OR,AL_Ib,0x0c)
|
|
I386_OP(OR,eAX_Iv,0x0d)
|
|
I386_OP(PUSH,CS,0x0e)
|
|
I386_OP(Two_Byte_Escape,Prefix,0x0f)
|
|
|
|
I386_OP(ADC,Eb_Gb,0x10)
|
|
I386_OP(ADC,Ev_Gv,0x11)
|
|
I386_OP(ADC,Gb_Eb,0x12)
|
|
I386_OP(ADC,Gv_Ev,0x13)
|
|
I386_OP(ADC,AL_Ib,0x14)
|
|
I386_OP(ADC,eAX_Iv,0x15)
|
|
I386_OP(PUSH,SS,0x16)
|
|
I386_OP(POP,SS,0x17)
|
|
|
|
I386_OP(SBB,Eb_Gb,0x18)
|
|
I386_OP(SBB,Ev_Gv,0x19)
|
|
I386_OP(SBB,Gb_Eb,0x1a)
|
|
I386_OP(SBB,Gv_Ev,0x1b)
|
|
I386_OP(SBB,AL_Ib,0x1c)
|
|
I386_OP(SBB,eAX_Iv,0x1d)
|
|
I386_OP(PUSH,DS,0x1e)
|
|
I386_OP(POP,DS,0x1f)
|
|
|
|
I386_OP(AND,Eb_Gb,0x20)
|
|
I386_OP(AND,Ev_Gv,0x21)
|
|
I386_OP(AND,Gb_Eb,0x22)
|
|
I386_OP(AND,Gv_Ev,0x23)
|
|
I386_OP(AND,AL_Ib,0x24)
|
|
I386_OP(AND,eAX_Iv,0x25)
|
|
I386_OP(SEG,ES,0x26)
|
|
I386_OP(DAA,_,0x27)
|
|
|
|
I386_OP(SUB,Eb_Gb,0x28)
|
|
I386_OP(SUB,Ev_Gv,0x29)
|
|
I386_OP(SUB,Gb_Eb,0x2a)
|
|
I386_OP(SUB,Gv_Ev,0x2b)
|
|
I386_OP(SUB,AL_Ib,0x2c)
|
|
I386_OP(SUB,eAX_Iv,0x2d)
|
|
I386_OP(SEG,CS,0x2e)
|
|
I386_OP(DAS,_,0x2f)
|
|
|
|
I386_OP(XOR,Eb_Gb,0x30)
|
|
I386_OP(XOR,Ev_Gv,0x31)
|
|
I386_OP(XOR,Gb_Eb,0x32)
|
|
I386_OP(XOR,Gv_Ev,0x33)
|
|
I386_OP(XOR,AL_Ib,0x34)
|
|
I386_OP(XOR,eAX_Iv,0x35)
|
|
I386_OP(SEG,SS,0x36)
|
|
I386_OP(AAA,_,0x37)
|
|
|
|
I386_OP(CMP,Eb_Gb,0x38)
|
|
I386_OP(CMP,Ev_Gv,0x39)
|
|
I386_OP(CMP,Gb_Eb,0x3a)
|
|
I386_OP(CMP,Gv_Ev,0x3b)
|
|
I386_OP(CMP,AL_Ib,0x3c)
|
|
I386_OP(CMP,eAX_Iv,0x3d)
|
|
I386_OP(SEG,DS,0x3e)
|
|
I386_OP(AAS,_,0x3f)
|
|
/* On x86-64, these opcodes are used as REX Prefixes.. *
|
|
* the one byte INC and DEC instructions are not there in the 64 bit mode !!! *
|
|
*/
|
|
#ifndef __x86_64
|
|
I386_OP(INC,eAX,0x40)
|
|
I386_OP(INC,eCX,0x41)
|
|
I386_OP(INC,eDX,0x42)
|
|
I386_OP(INC,eBX,0x43)
|
|
I386_OP(INC,eSP,0x44)
|
|
I386_OP(INC,eBP,0x45)
|
|
I386_OP(INC,eSI,0x46)
|
|
I386_OP(INC,eDI,0x47)
|
|
|
|
I386_OP(DEC,eAX,0x48)
|
|
I386_OP(DEC,eCX,0x49)
|
|
I386_OP(DEC,eDX,0x4a)
|
|
I386_OP(DEC,eBX,0x4b)
|
|
I386_OP(DEC,eSP,0x4c)
|
|
I386_OP(DEC,eBP,0x4d)
|
|
I386_OP(DEC,eSI,0x4e)
|
|
I386_OP(DEC,eDI,0x4f)
|
|
#else
|
|
|
|
I386_OP(REX_PREFIX,None,0x40)
|
|
I386_OP(REX_PREFIX,_B,0x41)
|
|
I386_OP(REX_PREFIX,_X,0x42)
|
|
I386_OP(REX_PREFIX,_X_B,0x43)
|
|
I386_OP(REX_PREFIX,_R,0x44)
|
|
I386_OP(REX_PREFIX,_R_B,0x45)
|
|
I386_OP(REX_PREFIX,_R_X,0x46)
|
|
I386_OP(REX_PREFIX,_R_X_B,0x47)
|
|
|
|
I386_OP(REX_PREFIX,_W,0x48)
|
|
I386_OP(REX_PREFIX,_W_B,0x49)
|
|
I386_OP(REX_PREFIX,_W_X,0x4a)
|
|
I386_OP(REX_PREFIX,_W_X_B,0x4b)
|
|
I386_OP(REX_PREFIX,_W_R,0x4c)
|
|
I386_OP(REX_PREFIX,_W_R_B,0x4d)
|
|
I386_OP(REX_PREFIX,_W_R_X,0x4e)
|
|
I386_OP(REX_PREFIX,_W_R_X_B,0x4f)
|
|
#endif /* __x86_64 */
|
|
|
|
I386_OP(PUSH,eAX,0x50)
|
|
I386_OP(PUSH,eCX,0x51)
|
|
I386_OP(PUSH,eDX,0x52)
|
|
I386_OP(PUSH,eBX,0x53)
|
|
I386_OP(PUSH,eSP,0x54)
|
|
I386_OP(PUSH,eBP,0x55)
|
|
I386_OP(PUSH,eSI,0x56)
|
|
I386_OP(PUSH,eDI,0x57)
|
|
|
|
I386_OP(POP,eAX,0x58)
|
|
I386_OP(POP,eCX,0x59)
|
|
I386_OP(POP,eDX,0x5a)
|
|
I386_OP(POP,eBX,0x5b)
|
|
I386_OP(POP,eSP,0x5c)
|
|
I386_OP(POP,eBP,0x5d)
|
|
I386_OP(POP,eSI,0x5e)
|
|
I386_OP(POP,eDI,0x5f)
|
|
|
|
I386_OP(PUSHA,_,0x60)
|
|
I386_OP(POPA,_,0x61)
|
|
I386_OP(BOUND,Gv_Ma,0x62)
|
|
#ifdef __i386
|
|
I386_OP(ARPL,Ew_Rw,0x63)
|
|
#else /* __x86_64 */
|
|
I386_OP(MOVSXD,Gv_Ev,0x63)
|
|
#endif /* __i386 */
|
|
I386_OP(SEG,FS,0x64)
|
|
I386_OP(SEG,GS,0x65)
|
|
I386_OP(Operand_Size,Prefix,0x66)
|
|
I386_OP(Address_Size,Prefix,0x67)
|
|
|
|
I386_OP(PUSH,Iv,0x68)
|
|
I386_OP(IMUL,GvEvIv,0x69)
|
|
I386_OP(PUSH,Ib,0x6a)
|
|
I386_OP(IMUL,GvEvIb,0x6b)
|
|
I386_OP(INSB,Yb_DX,0x6c)
|
|
I386_OP(INSW_D,Yv_DX,0x6d)
|
|
I386_OP(OUTSB,DX_Xb,0x6e)
|
|
I386_OP(OUTSW_D,DX_Xv,0x6f)
|
|
|
|
I386_OP(JO,Jb,0x70)
|
|
I386_OP(JNO,Jb,0x71)
|
|
I386_OP(JB,Jb,0x72)
|
|
I386_OP(JNB,Jb,0x73)
|
|
I386_OP(JZ,Jb,0x74)
|
|
I386_OP(JNZ,Jb,0x75)
|
|
I386_OP(JBE,Jb,0x76)
|
|
I386_OP(JNBE,Jb,0x77)
|
|
|
|
I386_OP(JS,Jb,0x78)
|
|
I386_OP(JNS,Jb,0x79)
|
|
I386_OP(JP,Jb,0x7a)
|
|
I386_OP(JNP,Jb,0x7b)
|
|
I386_OP(JL,Jb,0x7c)
|
|
I386_OP(JNL,Jb,0x7d)
|
|
I386_OP(JLE,Jb,0x7e)
|
|
I386_OP(JNLE,Jb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