diff options
| -rw-r--r-- | ChangeLog | 24 | ||||
| -rw-r--r-- | src/arch/x86/Makefile.am | 1 | ||||
| -rw-r--r-- | src/arch/x86/instruction.c | 148 | ||||
| -rw-r--r-- | src/arch/x86/instruction.h | 71 | ||||
| -rw-r--r-- | src/arch/x86/op_cmp.c | 97 | ||||
| -rw-r--r-- | src/arch/x86/op_cmps.c | 63 | ||||
| -rw-r--r-- | src/arch/x86/op_jump.c | 482 | ||||
| -rw-r--r-- | src/arch/x86/op_sbb.c | 36 | ||||
| -rw-r--r-- | src/arch/x86/op_set.c | 435 | ||||
| -rw-r--r-- | src/arch/x86/op_sub.c | 36 | ||||
| -rw-r--r-- | src/arch/x86/opcodes.h | 138 | ||||
| -rw-r--r-- | src/arch/x86/operand.c | 4 | ||||
| -rw-r--r-- | src/arch/x86/processor.c | 63 | 
13 files changed, 1421 insertions, 177 deletions
| @@ -1,3 +1,27 @@ +10-08-17  Cyrille Bagard <nocbos@gmail.com> + +	* src/arch/x86/instruction.c: +	* src/arch/x86/instruction.h: +	Support several extra x86 instructions. + +	* src/arch/x86/Makefile.am: +	Add op_cmps.c to libarchx86_la_SOURCES. + +	* src/arch/x86/op_cmp.c: +	Support several extra x86 instructions. + +	* src/arch/x86/op_cmps.c: +	New entry: support one cmps instruction. + +	* src/arch/x86/opcodes.h: +	* src/arch/x86/operand.c: +	* src/arch/x86/op_jump.c: +	* src/arch/x86/op_sbb.c: +	* src/arch/x86/op_set.c: +	* src/arch/x86/op_sub.c: +	* src/arch/x86/processor.c: +	Support several extra x86 instructions. +  10-08-10  Cyrille Bagard <nocbos@gmail.com>  	* src/format/mangling/itanium_tok.l: diff --git a/src/arch/x86/Makefile.am b/src/arch/x86/Makefile.am index e7fd905..ff246c0 100644 --- a/src/arch/x86/Makefile.am +++ b/src/arch/x86/Makefile.am @@ -10,6 +10,7 @@ libarchx86_la_SOURCES =					\  	op_call.c							\  	op_cld.c							\  	op_cmp.c							\ +	op_cmps.c							\  	op_dec.c							\  	op_hlt.c							\  	op_inc.c							\ diff --git a/src/arch/x86/instruction.c b/src/arch/x86/instruction.c index edbffec..af1d25e 100644 --- a/src/arch/x86/instruction.c +++ b/src/arch/x86/instruction.c @@ -24,6 +24,9 @@  #include "instruction.h" +#include <string.h> + +  #include "operand.h"  #include "../instruction-int.h"  #include "../../common/extstr.h" @@ -39,6 +42,8 @@ struct _GX86Instruction      X86Prefix prefixes;                     /* Préfixes finalement trouvés */ +    char *cached_text;                      /* Nom construit à conserver   */ +  };  /* Définition générique d'une instruction d'architecture x86 (classe) */ @@ -80,6 +85,8 @@ typedef struct _x86_instruction  static x86_instruction _instructions[XOP_COUNT] = { +    /* Instructions avec opcode sur un octet */ +      [XOP_ADD_RM8_R8]                = { false, 0x00, IDX_TO_EXT(-1), "add", XPX_NONE },      [XOP_ADD_RM1632_R1632]          = { false, 0x01, IDX_TO_EXT(-1), "add", XPX_OPERAND_SIZE_OVERRIDE },      [XOP_ADD_R8_RM8]                = { false, 0x02, IDX_TO_EXT(-1), "add", XPX_NONE }, @@ -94,29 +101,11 @@ static x86_instruction _instructions[XOP_COUNT] = {      [XOP_OR_AL_IMM8]                = { false, 0x0c, IDX_TO_EXT(-1), "or", XPX_NONE }, -    [XOP_JE_REL1632]                = { false, 0x84, IDX_TO_EXT(-1), "je", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, -    [XOP_JNE_REL1632]               = { false, 0x85, IDX_TO_EXT(-1), "jne", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, -    [XOP_JBE_REL1632]               = { false, 0x86, IDX_TO_EXT(-1), "jbe", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, -    [XOP_JA_REL1632]                = { false, 0x87, IDX_TO_EXT(-1), "ja", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, - -    [XOP_JGE_REL1632]               = { false, 0x8d, IDX_TO_EXT(-1), "jge", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, -    [XOP_JLE_REL1632]               = { false, 0x8e, IDX_TO_EXT(-1), "jle", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, -    [XOP_JG_REL1632]                = { false, 0x8f, IDX_TO_EXT(-1), "jg", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, - - -    [XOP_SETE_RM8]                  = { false, 0x94, IDX_TO_EXT(-1), "sete", XPX_TWO_BYTES }, -    [XOP_SETNE_RM8]                 = { false, 0x95, IDX_TO_EXT(-1), "setne", XPX_TWO_BYTES }, - -    [XOP_SETL_RM8]                  = { false, 0x9c, IDX_TO_EXT(-1), "setl", XPX_TWO_BYTES }, - - -    [XOP_MOVZX_R1632_RM8]           = { false, 0xb6, IDX_TO_EXT(-1), "movzx", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, -    [XOP_MOVSX_R1632_RM8]           = { false, 0xbe, IDX_TO_EXT(-1), "movsx", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, -    [XOP_MOVSX_R1632_RM1632]        = { false, 0xbf, IDX_TO_EXT(-1), "movsx", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, -      [XOP_ADC_RM8_R8]                = { false, 0x10, IDX_TO_EXT(-1), "adc", XPX_NONE }, +    [XOP_SBB_RM1632_R1632]          = { false, 0x19, IDX_TO_EXT(-1), "sbb", XPX_OPERAND_SIZE_OVERRIDE }, +      [XOP_AND_RM8_R8]                = { false, 0x20, IDX_TO_EXT(-1), "and", XPX_NONE },      [XOP_AND_RM1632_R1632]          = { false, 0x21, IDX_TO_EXT(-1), "and", XPX_OPERAND_SIZE_OVERRIDE }, @@ -128,6 +117,7 @@ static x86_instruction _instructions[XOP_COUNT] = {      [XOP_SUB_RM1632_R1632]          = { false, 0x29, IDX_TO_EXT(-1), "sub", XPX_OPERAND_SIZE_OVERRIDE },      [XOP_SUB_R8_RM8]                = { false, 0x2a, IDX_TO_EXT(-1), "sub", XPX_NONE }, +    [XOP_SUB_R1632_RM1632]          = { false, 0x2b, IDX_TO_EXT(-1), "sub", XPX_OPERAND_SIZE_OVERRIDE },      [XOP_SUB_AL_IMM8]               = { false, 0x2c, IDX_TO_EXT(-1), "sub", XPX_NONE },      [XOP_SUB_E_AX_IMM1632]          = { false, 0x2d, IDX_TO_EXT(-1), "sub", XPX_OPERAND_SIZE_OVERRIDE }, @@ -145,9 +135,12 @@ static x86_instruction _instructions[XOP_COUNT] = { +    [XOP_CMP_RM8_R8]                = { false, 0x38, IDX_TO_EXT(-1), "cmp", XPX_NONE },      [XOP_CMP_RM1632_R1632]          = { false, 0x39, IDX_TO_EXT(-1), "cmp", XPX_OPERAND_SIZE_OVERRIDE },      [XOP_CMP_R1632_RM1632]          = { false, 0x3b, IDX_TO_EXT(-1), "cmp", XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_CMP_AL_IMM8]               = { false, 0x3c, IDX_TO_EXT(-1), "cmp", XPX_NONE }, +    [XOP_CMP_E_AX_IMM1632]          = { false, 0x3d, IDX_TO_EXT(-1), "cmp", XPX_OPERAND_SIZE_OVERRIDE },      [XOP_INC_E_AX]                  = { true, 0x40, IDX_TO_EXT(-1), "inc", XPX_OPERAND_SIZE_OVERRIDE }, @@ -272,6 +265,7 @@ static x86_instruction _instructions[XOP_COUNT] = {      [XOP_MOVS_M1632_M1632]          = { false, 0xa5, IDX_TO_EXT(-1), "movs", XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_CMPS_M8_M8]                = { false, 0xa6, IDX_TO_EXT(-1), "cmps", XPX_NONE },      [XOP_TEST_AL_IMM8]              = { false, 0xa8, IDX_TO_EXT(-1), "test", XPX_NONE },      [XOP_TEST_E_AX_IMM1632]         = { false, 0xa9, IDX_TO_EXT(-1), "test", XPX_OPERAND_SIZE_OVERRIDE }, @@ -355,7 +349,53 @@ static x86_instruction _instructions[XOP_COUNT] = {      [XOP_DEC_RM1632]                = { false, 0xff, IDX_TO_EXT(1), "dec", XPX_OPERAND_SIZE_OVERRIDE },      [XOP_CALL_RM1632]               = { false, 0xff, IDX_TO_EXT(2), "call", XPX_OPERAND_SIZE_OVERRIDE },      [XOP_JMP_RM1632]                = { false, 0xff, IDX_TO_EXT(4), "jmp", XPX_OPERAND_SIZE_OVERRIDE }, -    [XOP_PUSH_RM1632]               = { false, 0xff, IDX_TO_EXT(6), "push", XPX_OPERAND_SIZE_OVERRIDE } +    [XOP_PUSH_RM1632]               = { false, 0xff, IDX_TO_EXT(6), "push", XPX_OPERAND_SIZE_OVERRIDE }, + + + + + + +    /* Instructions avec opcode sur deux octets */ + +    [XOP_JO_REL1632]                = { false, 0x80, IDX_TO_EXT(-1), "jo", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JNO_REL1632]               = { false, 0x81, IDX_TO_EXT(-1), "jno", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JB_REL1632]                = { false, 0x82, IDX_TO_EXT(-1), "jb", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JNB_REL1632]               = { false, 0x83, IDX_TO_EXT(-1), "jnb", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JE_REL1632]                = { false, 0x84, IDX_TO_EXT(-1), "je", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JNE_REL1632]               = { false, 0x85, IDX_TO_EXT(-1), "jne", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JNA_REL1632]               = { false, 0x86, IDX_TO_EXT(-1), "jna", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JA_REL1632]                = { false, 0x87, IDX_TO_EXT(-1), "ja", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JS_REL1632]                = { false, 0x88, IDX_TO_EXT(-1), "js", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JNS_REL1632]               = { false, 0x89, IDX_TO_EXT(-1), "jns", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JP_REL1632]                = { false, 0x8a, IDX_TO_EXT(-1), "jp", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JNP_REL1632]               = { false, 0x8b, IDX_TO_EXT(-1), "jnp", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JL_REL1632]                = { false, 0x8c, IDX_TO_EXT(-1), "jl", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JNL_REL1632]               = { false, 0x8d, IDX_TO_EXT(-1), "jnl", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JNG_REL1632]               = { false, 0x8e, IDX_TO_EXT(-1), "jng", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_JG_REL1632]                = { false, 0x8f, IDX_TO_EXT(-1), "jg", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_SETO_RM8]                  = { false, 0x90, IDX_TO_EXT(-1), "seto", XPX_TWO_BYTES }, +    [XOP_SETNO_RM8]                 = { false, 0x91, IDX_TO_EXT(-1), "setno", XPX_TWO_BYTES }, +    [XOP_SETB_RM8]                  = { false, 0x92, IDX_TO_EXT(-1), "setn", XPX_TWO_BYTES }, +    [XOP_SETNB_RM8]                 = { false, 0x93, IDX_TO_EXT(-1), "setnb", XPX_TWO_BYTES }, +    [XOP_SETE_RM8]                  = { false, 0x94, IDX_TO_EXT(-1), "sete", XPX_TWO_BYTES }, +    [XOP_SETNE_RM8]                 = { false, 0x95, IDX_TO_EXT(-1), "setne", XPX_TWO_BYTES }, +    [XOP_SETNA_RM8]                 = { false, 0x96, IDX_TO_EXT(-1), "setna", XPX_TWO_BYTES }, +    [XOP_SETA_RM8]                  = { false, 0x97, IDX_TO_EXT(-1), "seta", XPX_TWO_BYTES }, +    [XOP_SETS_RM8]                  = { false, 0x98, IDX_TO_EXT(-1), "sets", XPX_TWO_BYTES }, +    [XOP_SETNS_RM8]                 = { false, 0x99, IDX_TO_EXT(-1), "setns", XPX_TWO_BYTES }, +    [XOP_SETP_RM8]                  = { false, 0x9a, IDX_TO_EXT(-1), "setp", XPX_TWO_BYTES }, +    [XOP_SETNP_RM8]                 = { false, 0x9b, IDX_TO_EXT(-1), "setnp", XPX_TWO_BYTES }, +    [XOP_SETL_RM8]                  = { false, 0x9c, IDX_TO_EXT(-1), "setl", XPX_TWO_BYTES }, +    [XOP_SETNL_RM8]                 = { false, 0x9d, IDX_TO_EXT(-1), "setnl", XPX_TWO_BYTES }, +    [XOP_SETNG_RM8]                 = { false, 0x9e, IDX_TO_EXT(-1), "setng", XPX_TWO_BYTES }, +    [XOP_SETG_RM8]                  = { false, 0x9f, IDX_TO_EXT(-1), "setg", XPX_TWO_BYTES }, + + + +    [XOP_MOVZX_R1632_RM8]           = { false, 0xb6, IDX_TO_EXT(-1), "movzx", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_MOVSX_R1632_RM8]           = { false, 0xbe, IDX_TO_EXT(-1), "movsx", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }, +    [XOP_MOVSX_R1632_RM1632]        = { false, 0xbf, IDX_TO_EXT(-1), "movsx", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE }  }; @@ -364,7 +404,7 @@ static x86_instruction _instructions[XOP_COUNT] = {  /* Traduit une instruction en version humainement lisible. */ -static const char *x86_get_instruction_text(const GX86Instruction *, const GExeFormat *, AsmSyntax); +static const char *x86_get_instruction_text(GX86Instruction *, const GExeFormat *, AsmSyntax);  /* Informe sur une éventuelle référence à une autre instruction. */  static InstructionLinkType x86_get_instruction_link(const GX86Instruction *, vmpa_t *); @@ -529,9 +569,12 @@ X86Opcodes x86_guess_next_instruction(const bin_t *data, off_t pos, off_t len, X                  *prefix |= XPX_OPERAND_SIZE_OVERRIDE;                  break;              case 0xf2: +                pos++; +                extra |= XPX_REPEAT_STR_OPERATION_F2; +                break;              case 0xf3:                  pos++; -                extra |= XPX_REPEAT_STRING_OPERATION; +                extra |= XPX_REPEAT_STR_OPERATION_F3;                  break;              default:                  goto xgni_look_for; @@ -586,19 +629,60 @@ X86Opcodes x86_guess_next_instruction(const bin_t *data, off_t pos, off_t len, X  *                                                                             *  ******************************************************************************/ -static const char *x86_get_instruction_text(const GX86Instruction *instr, const GExeFormat *format, AsmSyntax syntax) +static const char *x86_get_instruction_text(GX86Instruction *instr, const GExeFormat *format, AsmSyntax syntax)  { -    const char *result;                     /* Chaîne à retourner          */ +    char *result;                           /* Chaîne nouvelle à renvoyer  */ +    const char *prefix;                     /* Préfixe à ajouter           */ -    return _instructions[instr->type].keyword; +    if (instr->cached_text != NULL) +        return instr->cached_text;      result = strdup(_instructions[instr->type].keyword); -    /* FIXME : -       http://www.intel.com/software/products/documentation/vlin/mergedprojects/analyzer_ec/mergedprojects/reference_olh/mergedProjects/instructions/instruct32_hh/vc276.htm -    */ -    if (instr->prefixes & XPX_REPEAT_STRING_OPERATION) -        result = strprep(result, "rep "/*"repnz "*/); +    /** +     * Eventuelle répétion de l'instruction. +     * cf. "Repeat String Operation Prefix" (Intel 64 and IA-32 Architectures Software Developer’s Manual Volume 2B) +     * cf. http://www.intel.com/software/products/documentation/vlin/mergedprojects/analyzer_ec/mergedprojects/reference_olh/mergedProjects/instructions/instruct32_hh/vc276.htm +     */ + +    if (instr->prefixes & (XPX_REPEAT_STR_OPERATION_F2 | XPX_REPEAT_STR_OPERATION_F3)) +    { +        prefix = NULL; + +        if (instr->prefixes & XPX_REPEAT_STR_OPERATION_F2) +            switch (instr->type) +            { +                case XOP_CMPS_M8_M8: +                    prefix = "repnz "; +                    break; +                case XOP_SCAS_AL_M8: +                    prefix = "repnz "; +                    break; +                default: +                    prefix = NULL; +                    break; +            } + +        else if (instr->prefixes & XPX_REPEAT_STR_OPERATION_F3) +            switch (instr->type) +            { +                case XOP_CMPS_M8_M8: +                    prefix = "repz "; +                    break; +                case XOP_SCAS_AL_M8: +                    prefix = "repz "; +                    break; +                default: +                    prefix = NULL; +                    break; +            } + +        if (prefix != NULL) +            result = strprep(result, prefix); + +    } + +    instr->cached_text = result;      return result; @@ -625,7 +709,7 @@ static InstructionLinkType x86_get_instruction_link(const GX86Instruction *instr      switch (instr->type)      { -        case XOP_JLE_REL1632: +        case XOP_JA_REL1632:              relative = G_X86_RELATIVE_OPERAND(g_arch_instruction_get_operand(G_ARCH_INSTRUCTION(instr), 0));              if (g_imm_operand_to_vmpa_t(g_x86_relative_operand_get_value(relative), addr)) result = ILT_JUMP_IF_TRUE;              else result = ILT_NONE; diff --git a/src/arch/x86/instruction.h b/src/arch/x86/instruction.h index 0fc7513..bd57ff6 100644 --- a/src/arch/x86/instruction.h +++ b/src/arch/x86/instruction.h @@ -35,6 +35,8 @@ typedef enum _X86Prefix X86Prefix;  /* Enumération de tous les opcodes */  typedef enum _X86Opcodes  { +    /* Instructions avec opcode sur un octet */ +      XOP_ADD_RM8_R8,                         /* add (0x00)                  */      XOP_ADD_RM1632_R1632,                   /* add ([0x66] 0x01)           */      XOP_ADD_R8_RM8,                         /* add (0x02)                  */ @@ -48,26 +50,10 @@ typedef enum _X86Opcodes      XOP_OR_R1632_RM1632,                    /* or ([0x66] 0x0b)            */      XOP_OR_AL_IMM8,                         /* or (0x0c)                   */ -    XOP_JE_REL1632,                         /* je ([0x66] 0x0f 0x84)       */ -    XOP_JNE_REL1632,                        /* jne ([0x66] 0x0f 0x85)      */ -    XOP_JBE_REL1632,                        /* jbe ([0x66] 0x0f 0x86)      */ -    XOP_JA_REL1632,                         /* jne ([0x66] 0x0f 0x87)      */ - -    XOP_JGE_REL1632,                        /* jge ([0x66] 0x0f 0x8d)      */ -    XOP_JLE_REL1632,                        /* jle ([0x66] 0x0f 0x8e)      */ -    XOP_JG_REL1632,                         /* jle ([0x66] 0x0f 0x8f)      */ - -    XOP_SETE_RM8,                           /* sete ([0x66] 0x0f 0x94)     */ -    XOP_SETNE_RM8,                          /* setne ([0x66] 0x0f 0x95)    */ - -    XOP_SETL_RM8,                           /* setl ([0x66] 0x0f 0x9c)     */ - -    XOP_MOVZX_R1632_RM8,                    /* movzx ([0x66] 0x0f 0xb6)    */ -    XOP_MOVSX_R1632_RM8,                    /* movsx ([0x66] 0x0f 0xbe)    */ -    XOP_MOVSX_R1632_RM1632,                 /* movsx ([0x66] 0x0f 0xbf)    */ -      XOP_ADC_RM8_R8,                         /* adc (0x10)                  */ +    XOP_SBB_RM1632_R1632,                   /* and ([0x66] 0x19)           */ +      XOP_AND_RM8_R8,                         /* and (0x20)                  */      XOP_AND_RM1632_R1632,                   /* and ([0x66] 0x21)           */ @@ -77,6 +63,7 @@ typedef enum _X86Opcodes      XOP_SUB_RM1632_R1632,                   /* sub ([0x66] 0x29)           */      XOP_SUB_R8_RM8,                         /* sub (0x2a)                  */ +    XOP_SUB_R1632_RM1632,                   /* sub ([0x66] 0x2b)           */      XOP_SUB_AL_IMM8,                        /* sub (0x2c)                  */      XOP_SUB_E_AX_IMM1632,                   /* sub ([0x66] 0x2d)           */ @@ -89,9 +76,12 @@ typedef enum _X86Opcodes      XOP_XOR_AL_IMM8,                        /* xor (0x34)                  */      XOP_XOR_E_AX_IMM1632,                   /* xor ([0x66] 0x35)           */ +    XOP_CMP_RM8_R8,                         /* cmp (0x38)                  */      XOP_CMP_RM1632_R1632,                   /* cmp ([0x66] 0x39)           */      XOP_CMP_R1632_RM1632,                   /* cmp ([0x66] 0x3b)           */ +    XOP_CMP_AL_IMM8,                        /* cmp (0x3c)                  */ +    XOP_CMP_E_AX_IMM1632,                   /* cmp ([0x66] 0x3d)           */      XOP_INC_E_AX,                           /* inc ([0x66] 0x40)           */ @@ -216,6 +206,7 @@ typedef enum _X86Opcodes      XOP_MOVS_M1632_M1632,                   /* movs ([0x66] 0xa5)          */ +    XOP_CMPS_M8_M8,                         /* cmps (0xa6)                 */      XOP_TEST_AL_IMM8,                       /* test (0xa8)                 */      XOP_TEST_E_AX_IMM1632,                  /* test ([0x66] 0xa9)          */ @@ -292,6 +283,47 @@ typedef enum _X86Opcodes      XOP_JMP_RM1632,                         /* jmp ([0x66] 0xff 4)         */      XOP_PUSH_RM1632,                        /* push ([0x66] 0xff 6)        */ +    /* Instructions avec opcode sur deux octets */ + +    XOP_JO_REL1632,                         /* jo (0x0f 0x80)              */ +    XOP_JNO_REL1632,                        /* jno (0x0f 0x81)             */ +    XOP_JB_REL1632,                         /* jb (0x0f 0x82)              */ +    XOP_JNB_REL1632,                        /* jnb (0x0f 0x83)             */ +    XOP_JE_REL1632,                         /* je (0x0f 0x84)              */ +    XOP_JNE_REL1632,                        /* jne (0x0f 0x85)             */ +    XOP_JNA_REL1632,                        /* jna (0x0f 0x86)             */ +    XOP_JA_REL1632,                         /* ja (0x0f 0x87)              */ +    XOP_JS_REL1632,                         /* js (0x0f 0x88)              */ +    XOP_JNS_REL1632,                        /* jns (0x0f 0x89)             */ +    XOP_JP_REL1632,                         /* jp (0x0f 0x8a)              */ +    XOP_JNP_REL1632,                        /* jnp (0x0f 0x8b)             */ +    XOP_JL_REL1632,                         /* jl (0x0f 0x8c)              */ +    XOP_JNL_REL1632,                        /* jnl (0x0f 0x8d)             */ +    XOP_JNG_REL1632,                        /* jng (0x0f 0x8e)             */ +    XOP_JG_REL1632,                         /* jg (0x0f 0x8f)              */ +    XOP_SETO_RM8,                           /* seto (0x0f 0x90)            */ +    XOP_SETNO_RM8,                          /* setno (0x0f 0x91)           */ +    XOP_SETB_RM8,                           /* setb (0x0f 0x92)            */ +    XOP_SETNB_RM8,                          /* setnb (0x0f 0x93)           */ +    XOP_SETE_RM8,                           /* sete (0x0f 0x94)            */ +    XOP_SETNE_RM8,                          /* setne (0x0f 0x95)           */ +    XOP_SETNA_RM8,                          /* setna (0x0f 0x96)           */ +    XOP_SETA_RM8,                           /* seta (0x0f 0x97)            */ +    XOP_SETS_RM8,                           /* sets (0x0f 0x98)            */ +    XOP_SETNS_RM8,                          /* setns (0x0f 0x99)           */ +    XOP_SETP_RM8,                           /* setp (0x0f 0x9a)            */ +    XOP_SETNP_RM8,                          /* setnp (0x0f 0x9b)           */ +    XOP_SETL_RM8,                           /* setl (0x0f 0x9c)            */ +    XOP_SETNL_RM8,                          /* setnl (0x0f 0x9d)           */ +    XOP_SETNG_RM8,                          /* setng (0x0f 0x9e)           */ +    XOP_SETG_RM8,                           /* setg (0x0f 0x9f)            */ + + + +    XOP_MOVZX_R1632_RM8,                    /* movzx ([0x66] 0x0f 0xb6)    */ +    XOP_MOVSX_R1632_RM8,                    /* movsx ([0x66] 0x0f 0xbe)    */ +    XOP_MOVSX_R1632_RM1632,                 /* movsx ([0x66] 0x0f 0xbf)    */ +      XOP_COUNT  } X86Opcodes; @@ -334,7 +366,8 @@ enum _X86Prefix      XPX_OPERAND_SIZE_OVERRIDE   = (1 << 0), /* Taille des opérandes        */ -    XPX_REPEAT_STRING_OPERATION = (1 << 2), /* Boucle pour les chaînes     */ +    XPX_REPEAT_STR_OPERATION_F2 = (1 << 1), /* Boucle pour les chaînes #1  */ +    XPX_REPEAT_STR_OPERATION_F3 = (1 << 2), /* Boucle pour les chaînes #2  */      XPX_TWO_BYTES               = (1 << 3)  /* Instruction sur deux octets */ diff --git a/src/arch/x86/op_cmp.c b/src/arch/x86/op_cmp.c index eabc0d6..7972fd9 100644 --- a/src/arch/x86/op_cmp.c +++ b/src/arch/x86/op_cmp.c @@ -38,6 +38,75 @@  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * +*  Description : Décode une instruction de type 'cmp' (8 bits).               * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_cmp_al_imm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_CMP_AL_IMM8); + +    if (!x86_read_two_operands(result, data, pos, len, X86_OTP_AL, X86_OTP_IMM8)) +    { +        /* TODO free(result);*/ +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'cmp' (16 ou 32 bits).        * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_cmp_e_ax_imm1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_CMP_E_AX_IMM1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_two_operands(result, data, pos, len, X86_OTP_E_AX, X86_OTP_IMM1632, oprsize)) +    { +        /* TODO free(result);*/ +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             *  *  Description : Décode une instruction de type 'cmp' (16 ou 32 bits).        *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           * @@ -101,6 +170,34 @@ GArchInstruction *x86_read_instr_cmp_rm8_imm8(const bin_t *data, off_t *pos, off  /******************************************************************************  *                                                                             * +*                                                                             * +*  Description : Décode une instruction de type 'cmp' (8 bits).               * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_cmp_rm8_r8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_CMP_RM8_R8); + +    if (!x86_read_two_operands(result, data, pos, len, X86_OTP_RM8, X86_OTP_R8)) +    { +        /* TODO free(result);*/ +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             *  *  Paramètres  : data = flux de données à analyser.                           *  *                pos  = position courante dans ce flux. [OUT]                 *  *                len  = taille totale des données à analyser.                 * diff --git a/src/arch/x86/op_cmps.c b/src/arch/x86/op_cmps.c new file mode 100644 index 0000000..6d2f2b6 --- /dev/null +++ b/src/arch/x86/op_cmps.c @@ -0,0 +1,63 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * op_cmps.c - décodage des comparaisons de chaînes et de scalaires + * + * Copyright (C) 2010 Cyrille Bagard + * + *  This file is part of OpenIDA. + * + *  OpenIDA is free software; you can redistribute it and/or modify + *  it under the terms of the GNU General Public License as published by + *  the Free Software Foundation; either version 3 of the License, or + *  (at your option) any later version. + * + *  OpenIDA is distributed in the hope that it will be useful, + *  but WITHOUT ANY WARRANTY; without even the implied warranty of + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *  GNU General Public License for more details. + * + *  You should have received a copy of the GNU General Public License + *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "../instruction-int.h" +#include "opcodes.h" +#include "operand.h" + + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'cmps' (8 bits).              * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_cmps_m8_m8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_CMPS_M8_M8); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_two_operands(result, data, pos, len, X86_OTP_SRC_8, X86_OTP_DST_8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} diff --git a/src/arch/x86/op_jump.c b/src/arch/x86/op_jump.c index 75e06f2..d7894de 100644 --- a/src/arch/x86/op_jump.c +++ b/src/arch/x86/op_jump.c @@ -21,9 +21,6 @@   */ -#include <malloc.h> - -  #include "../instruction-int.h"  #include "opcodes.h"  #include "operand.h" @@ -38,7 +35,7 @@  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'ja' (saut 8b si supérieur).  * +*  Description : Décode une instruction de type 'ja' (saut 8b).               *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -54,7 +51,7 @@ GArchInstruction *x86_read_instr_ja_rel8(const bin_t *data, off_t *pos, off_t le      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -71,7 +68,7 @@ GArchInstruction *x86_read_instr_ja_rel8(const bin_t *data, off_t *pos, off_t le  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'ja' (saut 16/32b si sup.).   * +*  Description : Décode une instruction de type 'ja' (saut 16/32b).           *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -90,7 +87,7 @@ GArchInstruction *x86_read_instr_ja_rel1632(const bin_t *data, off_t *pos, off_t      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -107,7 +104,7 @@ GArchInstruction *x86_read_instr_ja_rel1632(const bin_t *data, off_t *pos, off_t  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jb' (saut 8b si inférieur).  * +*  Description : Décode une instruction de type 'jb' (saut 8b).               *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -123,7 +120,7 @@ GArchInstruction *x86_read_instr_jb_rel8(const bin_t *data, off_t *pos, off_t le      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -140,7 +137,7 @@ GArchInstruction *x86_read_instr_jb_rel8(const bin_t *data, off_t *pos, off_t le  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'je' (saut 16/32b si inf.).   * +*  Description : Décode une instruction de type 'jb' (saut 16/32b).           *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -148,18 +145,18 @@ GArchInstruction *x86_read_instr_jb_rel8(const bin_t *data, off_t *pos, off_t le  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jbe_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jb_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */      MemoryDataSize oprsize;                 /* Taille des opérandes        */ -    result = g_x86_instruction_new(XOP_JBE_REL1632); +    result = g_x86_instruction_new(XOP_JB_REL1632);      oprsize = g_x86_processor_get_operand_size(proc, prefix);      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -176,7 +173,7 @@ GArchInstruction *x86_read_instr_jbe_rel1632(const bin_t *data, off_t *pos, off_  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'je' (saut 8b si égal).       * +*  Description : Décode une instruction de type 'je' (saut 8b).               *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -192,7 +189,7 @@ GArchInstruction *x86_read_instr_je_rel8(const bin_t *data, off_t *pos, off_t le      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -209,7 +206,7 @@ GArchInstruction *x86_read_instr_je_rel8(const bin_t *data, off_t *pos, off_t le  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'je' (saut 16/32b si égal).   * +*  Description : Décode une instruction de type 'je' (saut 16/32b).           *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -228,7 +225,7 @@ GArchInstruction *x86_read_instr_je_rel1632(const bin_t *data, off_t *pos, off_t      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -245,7 +242,7 @@ GArchInstruction *x86_read_instr_je_rel1632(const bin_t *data, off_t *pos, off_t  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jg' (saut 8b si supérieur).  * +*  Description : Décode une instruction de type 'jg' (saut 8b).               *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -261,7 +258,7 @@ GArchInstruction *x86_read_instr_jg_rel8(const bin_t *data, off_t *pos, off_t le      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -278,7 +275,7 @@ GArchInstruction *x86_read_instr_jg_rel8(const bin_t *data, off_t *pos, off_t le  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jg' (saut 16/32b si sup.).   * +*  Description : Décode une instruction de type 'jg' (saut 16/32b).           *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -297,7 +294,40 @@ GArchInstruction *x86_read_instr_jg_rel1632(const bin_t *data, off_t *pos, off_t      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'jl' (saut 8b).               * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_jl_rel8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_JL_REL8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -314,7 +344,7 @@ GArchInstruction *x86_read_instr_jg_rel1632(const bin_t *data, off_t *pos, off_t  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jge' (saut 16/32b si sup.).  * +*  Description : Décode une instruction de type 'jl' (16 ou 32 bits).         *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -322,18 +352,18 @@ GArchInstruction *x86_read_instr_jg_rel1632(const bin_t *data, off_t *pos, off_t  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jge_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jl_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */      MemoryDataSize oprsize;                 /* Taille des opérandes        */ -    result = g_x86_instruction_new(XOP_JGE_REL1632); +    result = g_x86_instruction_new(XOP_JL_REL1632);      oprsize = g_x86_processor_get_operand_size(proc, prefix);      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -350,7 +380,7 @@ GArchInstruction *x86_read_instr_jge_rel1632(const bin_t *data, off_t *pos, off_  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jl' (saut 8b si inférieur).  * +*  Description : Décode une instruction de type 'jmp' (petit saut).           *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -358,15 +388,15 @@ GArchInstruction *x86_read_instr_jge_rel1632(const bin_t *data, off_t *pos, off_  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jl_rel8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jmp_rel8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */ -    result = g_x86_instruction_new(XOP_JL_REL8); +    result = g_x86_instruction_new(XOP_JMP_REL8);      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -383,7 +413,7 @@ GArchInstruction *x86_read_instr_jl_rel8(const bin_t *data, off_t *pos, off_t le  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jle' (16 ou 32 bits).        * +*  Description : Décode une instruction de type 'jmp' (grand saut relatif).   *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -391,18 +421,18 @@ GArchInstruction *x86_read_instr_jl_rel8(const bin_t *data, off_t *pos, off_t le  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jle_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jmp_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */      MemoryDataSize oprsize;                 /* Taille des opérandes        */ -    result = g_x86_instruction_new(XOP_JLE_REL1632); +    result = g_x86_instruction_new(XOP_JMP_REL1632);      oprsize = g_x86_processor_get_operand_size(proc, prefix);      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -419,7 +449,7 @@ GArchInstruction *x86_read_instr_jle_rel1632(const bin_t *data, off_t *pos, off_  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jmp' (petit saut).           * +*  Description : Décode une instruction de type 'jmp' (16 ou 32 bits).        *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -427,15 +457,18 @@ GArchInstruction *x86_read_instr_jle_rel1632(const bin_t *data, off_t *pos, off_  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jmp_rel8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jmp_rm1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ -    result = g_x86_instruction_new(XOP_JMP_REL8); +    result = g_x86_instruction_new(XOP_JMP_RM1632); -    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr)) +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM1632, oprsize))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -452,7 +485,7 @@ GArchInstruction *x86_read_instr_jmp_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jmp' (grand saut relatif).   * +*  Description : Décode une instruction de type 'jna' (saut 8b).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -460,18 +493,15 @@ GArchInstruction *x86_read_instr_jmp_rel8(const bin_t *data, off_t *pos, off_t l  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jmp_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jna_rel8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */ -    MemoryDataSize oprsize;                 /* Taille des opérandes        */ - -    result = g_x86_instruction_new(XOP_JMP_REL1632); -    oprsize = g_x86_processor_get_operand_size(proc, prefix); +    result = g_x86_instruction_new(XOP_JNA_REL8); -    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -488,7 +518,7 @@ GArchInstruction *x86_read_instr_jmp_rel1632(const bin_t *data, off_t *pos, off_  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jmp' (16 ou 32 bits).        * +*  Description : Décode une instruction de type 'jna' (saut 16/32b).          *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -496,18 +526,18 @@ GArchInstruction *x86_read_instr_jmp_rel1632(const bin_t *data, off_t *pos, off_  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jmp_rm1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jna_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */      MemoryDataSize oprsize;                 /* Taille des opérandes        */ -    result = g_x86_instruction_new(XOP_JMP_RM1632); +    result = g_x86_instruction_new(XOP_JNA_REL1632);      oprsize = g_x86_processor_get_operand_size(proc, prefix); -    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM1632, oprsize)) +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -524,7 +554,7 @@ GArchInstruction *x86_read_instr_jmp_rm1632(const bin_t *data, off_t *pos, off_t  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jna' (saut 8b si !supérieur).* +*  Description : Décode une instruction de type 'jnb' (saut 8b).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -532,15 +562,15 @@ GArchInstruction *x86_read_instr_jmp_rm1632(const bin_t *data, off_t *pos, off_t  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jna_rel8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jnb_rel8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */ -    result = g_x86_instruction_new(XOP_JNA_REL8); +    result = g_x86_instruction_new(XOP_JNB_REL8);      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -557,7 +587,7 @@ GArchInstruction *x86_read_instr_jna_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jnb' (saut 8b si !inférieur).* +*  Description : Décode une instruction de type 'jnb' (saut 16/32b).          *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -565,15 +595,18 @@ GArchInstruction *x86_read_instr_jna_rel8(const bin_t *data, off_t *pos, off_t l  *                                                                             *  ******************************************************************************/ -GArchInstruction *x86_read_instr_jnb_rel8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_jnb_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)  {      GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ -    result = g_x86_instruction_new(XOP_JNB_REL8); +    result = g_x86_instruction_new(XOP_JNB_REL1632); -    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr)) +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -590,7 +623,7 @@ GArchInstruction *x86_read_instr_jnb_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jne' (saut 8b si !égal).     * +*  Description : Décode une instruction de type 'jne' (saut 8b).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -606,7 +639,7 @@ GArchInstruction *x86_read_instr_jne_rel8(const bin_t *data, off_t *pos, off_t l      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -623,7 +656,7 @@ GArchInstruction *x86_read_instr_jne_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jne' (saut 16/32b si !égal). * +*  Description : Décode une instruction de type 'jne' (saut 16/32b).          *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -642,7 +675,7 @@ GArchInstruction *x86_read_instr_jne_rel1632(const bin_t *data, off_t *pos, off_      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -659,7 +692,7 @@ GArchInstruction *x86_read_instr_jne_rel1632(const bin_t *data, off_t *pos, off_  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jng' (saut 8b si !supérieur).* +*  Description : Décode une instruction de type 'jng' (saut 8b).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -675,7 +708,43 @@ GArchInstruction *x86_read_instr_jng_rel8(const bin_t *data, off_t *pos, off_t l      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'jng' (saut 16/32b).          * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_jng_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_JNG_REL1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -692,7 +761,7 @@ GArchInstruction *x86_read_instr_jng_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jnl' (saut 8b si !inférieur).* +*  Description : Décode une instruction de type 'jnl' (saut 8b).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -708,7 +777,43 @@ GArchInstruction *x86_read_instr_jnl_rel8(const bin_t *data, off_t *pos, off_t l      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'jnl' (saut 16/32b).          * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_jnl_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_JNL_REL1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -725,7 +830,7 @@ GArchInstruction *x86_read_instr_jnl_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jno' (saut 8b si !débordemt).* +*  Description : Décode une instruction de type 'jno' (saut 8b).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -741,7 +846,7 @@ GArchInstruction *x86_read_instr_jno_rel8(const bin_t *data, off_t *pos, off_t l      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -758,7 +863,43 @@ GArchInstruction *x86_read_instr_jno_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jnp' (saut 8b si !parité).   * +*  Description : Décode une instruction de type 'jno' (saut 16/32b).          * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_jno_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_JNO_REL1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'jnp' (saut 8b).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -774,7 +915,43 @@ GArchInstruction *x86_read_instr_jnp_rel8(const bin_t *data, off_t *pos, off_t l      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'jnp' (saut 16/32b).          * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_jnp_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_JNP_REL1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -791,7 +968,7 @@ GArchInstruction *x86_read_instr_jnp_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jns' (saut 8b si !signée).   * +*  Description : Décode une instruction de type 'jns' (saut 8b).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -807,7 +984,43 @@ GArchInstruction *x86_read_instr_jns_rel8(const bin_t *data, off_t *pos, off_t l      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'jns' (saut 16/32b).          * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_jns_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_JNS_REL1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -824,7 +1037,7 @@ GArchInstruction *x86_read_instr_jns_rel8(const bin_t *data, off_t *pos, off_t l  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jo' (saut 8b si débordement).* +*  Description : Décode une instruction de type 'jo' (saut 8b).               *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -840,7 +1053,7 @@ GArchInstruction *x86_read_instr_jo_rel8(const bin_t *data, off_t *pos, off_t le      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -857,7 +1070,43 @@ GArchInstruction *x86_read_instr_jo_rel8(const bin_t *data, off_t *pos, off_t le  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'jp' (saut 8b si parité).     * +*  Description : Décode une instruction de type 'jo' (saut 16/32b).           * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_jo_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_JO_REL1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'jp' (saut 8b).               *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -873,7 +1122,7 @@ GArchInstruction *x86_read_instr_jp_rel8(const bin_t *data, off_t *pos, off_t le      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -890,7 +1139,44 @@ GArchInstruction *x86_read_instr_jp_rel8(const bin_t *data, off_t *pos, off_t le  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * -*  Description : Décode une instruction de type 'js' (saut 8b si signée).     * +*  Description : Décode une instruction de type 'jp' (saut 16/32b).           * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_jp_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_JP_REL1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'js' (saut 8b).               *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           *  *                                                                             * @@ -906,7 +1192,43 @@ GArchInstruction *x86_read_instr_js_rel8(const bin_t *data, off_t *pos, off_t le      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL8, addr))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'js' (saut 16/32b).           * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_js_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_JS_REL1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } diff --git a/src/arch/x86/op_sbb.c b/src/arch/x86/op_sbb.c index 9aaa765..4f3eebc 100644 --- a/src/arch/x86/op_sbb.c +++ b/src/arch/x86/op_sbb.c @@ -133,3 +133,39 @@ GArchInstruction *x86_read_instr_sbb_rm1632_imm1632(const bin_t *data, off_t *po      return result;  } + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'sbb' (16 ou 32 bits).        * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_sbb_rm1632_r1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_SBB_RM1632_R1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_two_operands(result, data, pos, len, X86_OTP_RM1632, X86_OTP_R1632, oprsize)) +    { +        /* TODO free(result);*/ +        return NULL; +    } + +    return result; + +} diff --git a/src/arch/x86/op_set.c b/src/arch/x86/op_set.c index 6af6cb8..0da85f0 100644 --- a/src/arch/x86/op_set.c +++ b/src/arch/x86/op_set.c @@ -35,6 +35,72 @@  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * +*  Description : Décode une instruction de type 'seta' (8 bits).              * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_seta_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETA_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setb' (8 bits).              * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setb_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETB_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             *  *  Description : Décode une instruction de type 'sete' (8 bits).              *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           * @@ -51,7 +117,40 @@ GArchInstruction *x86_read_instr_sete_rm8(const bin_t *data, off_t *pos, off_t l      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setg' (8 bits).              * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setg_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETG_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -84,7 +183,73 @@ GArchInstruction *x86_read_instr_setl_rm8(const bin_t *data, off_t *pos, off_t l      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setna' (8 bits).             * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setna_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETNA_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setnb' (8 bits).             * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setnb_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETNB_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } @@ -117,7 +282,271 @@ GArchInstruction *x86_read_instr_setne_rm8(const bin_t *data, off_t *pos, off_t      if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8))      { -        /* TODO free(result);*/ +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setng' (8 bits).             * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setng_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETNG_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setnl' (8 bits).             * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setnl_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETNL_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setno' (8 bits).             * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setno_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETNO_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setnp' (8 bits).             * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setnp_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETNP_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setns' (8 bits).             * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setns_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETNS_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'seto' (8 bits).              * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_seto_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETO_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'setp' (8 bits).              * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_setp_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETP_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result)); +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             * +*  Description : Décode une instruction de type 'sets' (8 bits).              * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_sets_rm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ + +    result = g_x86_instruction_new(XOP_SETS_RM8); + +    if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8)) +    { +        g_object_unref(G_OBJECT(result));          return NULL;      } diff --git a/src/arch/x86/op_sub.c b/src/arch/x86/op_sub.c index 2df4dce..641ab0d 100644 --- a/src/arch/x86/op_sub.c +++ b/src/arch/x86/op_sub.c @@ -140,6 +140,42 @@ GArchInstruction *x86_read_instr_sub_r8_rm8(const bin_t *data, off_t *pos, off_t  *                addr = adresse virtuelle de l'instruction.                   *  *                proc = architecture ciblée par le désassemblage.             *  *                                                                             * +*  Description : Décode une instruction de type 'sub' (16 ou 32 bits).        * +*                                                                             * +*  Retour      : Instruction mise en place ou NULL.                           * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GArchInstruction *x86_read_instr_sub_r1632_rm1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +{ +    GArchInstruction *result;               /* Instruction à retourner     */ +    MemoryDataSize oprsize;                 /* Taille des opérandes        */ + +    result = g_x86_instruction_new(XOP_SUB_R1632_RM1632); + +    oprsize = g_x86_processor_get_operand_size(proc, prefix); + +    if (!x86_read_two_operands(result, data, pos, len, X86_OTP_R1632, X86_OTP_RM1632, oprsize)) +    { +        /* TODO free(result);*/ +        return NULL; +    } + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : data = flux de données à analyser.                           * +*                pos  = position courante dans ce flux. [OUT]                 * +*                len  = taille totale des données à analyser.                 * +*                addr = adresse virtuelle de l'instruction.                   * +*                proc = architecture ciblée par le désassemblage.             * +*                                                                             *  *  Description : Décode une instruction de type 'sub' (8 bits).               *  *                                                                             *  *  Retour      : Instruction mise en place ou NULL.                           * diff --git a/src/arch/x86/opcodes.h b/src/arch/x86/opcodes.h index 92b6124..19af64b 100644 --- a/src/arch/x86/opcodes.h +++ b/src/arch/x86/opcodes.h @@ -107,12 +107,21 @@ GArchInstruction *x86_read_instr_call_rm1632(const bin_t *, off_t *, off_t, vmpa  /* Décode une instruction de type 'cld'. */  GArchInstruction *x86_read_instr_cld(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'cmp' (8 bits). */ +GArchInstruction *x86_read_instr_cmp_al_imm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'cmp' (16 ou 32 bits). */ +GArchInstruction *x86_read_instr_cmp_e_ax_imm1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'cmp' (16 ou 32 bits). */  GArchInstruction *x86_read_instr_cmp_r1632_rm1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);  /* Décode une instruction de type 'cmp' (8 bits). */  GArchInstruction *x86_read_instr_cmp_rm8_imm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'cmp' (8 bits). */ +GArchInstruction *x86_read_instr_cmp_rm8_r8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'cmp' (16 ou 32 bits). */  GArchInstruction *x86_read_instr_cmp_rm1632_imm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); @@ -122,6 +131,9 @@ GArchInstruction *x86_read_instr_cmp_rm1632_imm1632(const bin_t *, off_t *, off_  /* Décode une instruction de type 'cmp' (16 ou 32 bits). */  GArchInstruction *x86_read_instr_cmp_rm1632_r1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'cmps' (8 bits). */ +GArchInstruction *x86_read_instr_cmps_m8_m8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'dec' (16 ou 32 bits). */  GArchInstruction *x86_read_instr_dec_r1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); @@ -158,75 +170,102 @@ GArchInstruction *x86_read_instr_int_3(const bin_t *, off_t *, off_t, vmpa_t, X8  /* Décode une instruction de type 'int'. */  GArchInstruction *x86_read_instr_int_imm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'ja' (saut 8b si supérieur). */ +/* Décode une instruction de type 'ja' (saut 8b). */  GArchInstruction *x86_read_instr_ja_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'ja' (saut 16/32b si sup.). */ +/* Décode une instruction de type 'ja' (saut 16/32b). */  GArchInstruction *x86_read_instr_ja_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jb' (saut 8b si inférieur). */ +/* Décode une instruction de type 'jb' (saut 8b). */  GArchInstruction *x86_read_instr_jb_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'je' (saut 16/32b si inf.). */ -GArchInstruction *x86_read_instr_jbe_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'jb' (saut 16/32b). */ +GArchInstruction *x86_read_instr_jb_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'je' (saut 8b si égal). */ +/* Décode une instruction de type 'je' (saut 8b). */  GArchInstruction *x86_read_instr_je_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'je' (saut 16/32b si égal). */ +/* Décode une instruction de type 'je' (saut 16/32b). */  GArchInstruction *x86_read_instr_je_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jg' (saut 8b si supérieur). */ +/* Décode une instruction de type 'jg' (saut 8b). */  GArchInstruction *x86_read_instr_jg_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jg' (saut 16/32b si sup.). */ +/* Décode une instruction de type 'jg' (saut 16/32b). */  GArchInstruction *x86_read_instr_jg_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jge' (saut 16/32b si sup.). */ -GArchInstruction *x86_read_instr_jge_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); - -/* Décode une instruction de type 'jl' (saut 8b si inférieur). */ +/* Décode une instruction de type 'jl' (saut 8b). */  GArchInstruction *x86_read_instr_jl_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jle' (16 ou 32 bits). */ -GArchInstruction *x86_read_instr_jle_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'jl' (16 ou 32 bits). */ +GArchInstruction *x86_read_instr_jl_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jna' (saut 8b si !supérieur). */ +/* Décode une instruction de type 'jna' (saut 8b). */  GArchInstruction *x86_read_instr_jna_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jnb' (saut 8b si !inférieur). */ +/* Décode une instruction de type 'jna' (saut 16/32b). */ +GArchInstruction *x86_read_instr_jna_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'jnb' (saut 8b). */  GArchInstruction *x86_read_instr_jnb_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jne' (saut 8b si !égal). */ +/* Décode une instruction de type 'jnb' (saut 16/32b). */ +GArchInstruction *x86_read_instr_jnb_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'jne' (saut 8b). */  GArchInstruction *x86_read_instr_jne_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jne' (saut 16/32b si !égal). */ +/* Décode une instruction de type 'jne' (saut 16/32b). */  GArchInstruction *x86_read_instr_jne_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jng' (saut 8b si !supérieur). */ +/* Décode une instruction de type 'jng' (saut 8b). */  GArchInstruction *x86_read_instr_jng_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jnl' (saut 8b si !inférieur). */ +/* Décode une instruction de type 'jng' (saut 16/32b). */ +GArchInstruction *x86_read_instr_jng_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'jnl' (saut 8b). */  GArchInstruction *x86_read_instr_jnl_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jno' (saut 8b si !débordemt). */ +/* Décode une instruction de type 'jnl' (saut 16/32b). */ +GArchInstruction *x86_read_instr_jnl_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'jno' (saut 8b). */  GArchInstruction *x86_read_instr_jno_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jnp' (saut 8b si !parité). */ +/* Décode une instruction de type 'jno' (saut 16/32b). */ +GArchInstruction *x86_read_instr_jno_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'jnp' (saut 8b). */  GArchInstruction *x86_read_instr_jnp_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jns' (saut 8b si !signée). */ +/* Décode une instruction de type 'jnp' (saut 16/32b). */ +GArchInstruction *x86_read_instr_jnp_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'jns' (saut 8b). */  GArchInstruction *x86_read_instr_jns_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jo' (saut 8b si débordement). */ +/* Décode une instruction de type 'jns' (saut 16/32b). */ +GArchInstruction *x86_read_instr_jns_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'jo' (saut 8b). */  GArchInstruction *x86_read_instr_jo_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'jp' (saut 8b si parité). */ +/* Décode une instruction de type 'jo' (16 ou 32 bits). */ +GArchInstruction *x86_read_instr_jo_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'jp' (saut 8b). */  GArchInstruction *x86_read_instr_jp_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); -/* Décode une instruction de type 'js' (saut 8b si signée). */ +/* Décode une instruction de type 'jp' (16 ou 32 bits). */ +GArchInstruction *x86_read_instr_jp_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'js' (saut 8b). */  GArchInstruction *x86_read_instr_js_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'js' (16 ou 32 bits). */ +GArchInstruction *x86_read_instr_js_rel1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'jump' (petit saut). */  GArchInstruction *x86_read_instr_jmp_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); @@ -365,18 +404,60 @@ GArchInstruction *x86_read_instr_sbb_rm1632_imm8(const bin_t *, off_t *, off_t,  /* Décode une instruction de type 'sbb' (16 ou 32 bits). */  GArchInstruction *x86_read_instr_sbb_rm1632_imm1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'sbb' (16 ou 32 bits). */ +GArchInstruction *x86_read_instr_sbb_rm1632_r1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'scas al, ...' (8 bits). */  GArchInstruction *x86_read_instr_scas_al_m8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'seta' (8 bits). */ +GArchInstruction *x86_read_instr_seta_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'setb' (8 bits). */ +GArchInstruction *x86_read_instr_setb_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'sete' (8 bits). */  GArchInstruction *x86_read_instr_sete_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'setg' (8 bits). */ +GArchInstruction *x86_read_instr_setg_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'setl' (8 bits). */  GArchInstruction *x86_read_instr_setl_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'setna' (8 bits). */ +GArchInstruction *x86_read_instr_setna_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'setnb' (8 bits). */ +GArchInstruction *x86_read_instr_setnb_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'setne' (8 bits). */  GArchInstruction *x86_read_instr_setne_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'setng' (8 bits). */ +GArchInstruction *x86_read_instr_setng_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'setnl' (8 bits). */ +GArchInstruction *x86_read_instr_setnl_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'setno' (8 bits). */ +GArchInstruction *x86_read_instr_setno_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'setnp' (8 bits). */ +GArchInstruction *x86_read_instr_setnp_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'setns' (8 bits). */ +GArchInstruction *x86_read_instr_setns_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'seto' (8 bits). */ +GArchInstruction *x86_read_instr_seto_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'setp' (8 bits). */ +GArchInstruction *x86_read_instr_setp_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); + +/* Décode une instruction de type 'sets' (8 bits). */ +GArchInstruction *x86_read_instr_sets_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'shl' (16 ou 32 bits). */  GArchInstruction *x86_read_instr_shl_rm1632_cl(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); @@ -398,6 +479,9 @@ GArchInstruction *x86_read_instr_sub_e_ax_imm1632(const bin_t *, off_t *, off_t,  /* Décode une instruction de type 'sub' (8 bits). */  GArchInstruction *x86_read_instr_sub_r8_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +/* Décode une instruction de type 'sub' (16 ou 32 bits). */ +GArchInstruction *x86_read_instr_sub_r1632_rm1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); +  /* Décode une instruction de type 'sub' (8 bits). */  GArchInstruction *x86_read_instr_sub_rm8_imm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *); diff --git a/src/arch/x86/operand.c b/src/arch/x86/operand.c index e97dc2b..420ceec 100644 --- a/src/arch/x86/operand.c +++ b/src/arch/x86/operand.c @@ -1110,7 +1110,7 @@ GArchOperand *g_x86_moffs_operand_new(const bin_t *data, off_t *pos, off_t len,      result = NULL; -    offset = g_imm_operand_new_from_data(size/* FIXME : !convert mds/aos */, data, pos, len, SRE_LITTLE /* FIXME */); +    offset = g_imm_operand_new_from_data(size, data, pos, len, SRE_LITTLE /* FIXME */);      if (offset != NULL)      { @@ -1242,7 +1242,7 @@ GArchOperand *g_x86_data_operand_new(MemoryDataSize size, bool dest)      result = g_object_new(G_TYPE_X86_DATA_OPERAND, NULL); -    result->reg = g_x86_register_new(size, dest ? 0x07 : 0x06); +    result->reg = g_x86_register_new(MDS_32_BITS/* FIXME size*/, dest ? 0x07 : 0x06);      result->dest = dest;      return G_ARCH_OPERAND(result); diff --git a/src/arch/x86/processor.c b/src/arch/x86/processor.c index 54008d7..7048890 100644 --- a/src/arch/x86/processor.c +++ b/src/arch/x86/processor.c @@ -182,6 +182,8 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor      static const x86_read_instr decodings[XOP_COUNT] = { +        /* Instructions avec opcode sur un octet */ +          [XOP_ADD_RM8_R8]                = x86_read_instr_add_rm8_r8,          [XOP_ADD_RM1632_R1632]          = x86_read_instr_add_rm1632_r1632,          [XOP_ADD_R8_RM8]                = x86_read_instr_add_r8_rm8, @@ -193,26 +195,15 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor          [XOP_OR_R8_RM8]                 = x86_read_instr_or_r8_rm8,          [XOP_OR_R1632_RM1632]           = x86_read_instr_or_r1632_rm1632,          [XOP_OR_AL_IMM8]                = x86_read_instr_or_al_imm8, -        [XOP_JE_REL1632]                = x86_read_instr_je_rel1632, -        [XOP_JNE_REL1632]               = x86_read_instr_jne_rel1632, -        [XOP_JBE_REL1632]               = x86_read_instr_jbe_rel1632, -        [XOP_JA_REL1632]                = x86_read_instr_ja_rel1632, -        [XOP_JGE_REL1632]               = x86_read_instr_jge_rel1632, -        [XOP_JLE_REL1632]               = x86_read_instr_jle_rel1632, -        [XOP_JG_REL1632]                = x86_read_instr_jg_rel1632, -        [XOP_SETE_RM8]                  = x86_read_instr_sete_rm8, -        [XOP_SETNE_RM8]                 = x86_read_instr_setne_rm8, -        [XOP_SETL_RM8]                  = x86_read_instr_setl_rm8, -        [XOP_MOVZX_R1632_RM8]           = x86_read_instr_movzx_r1632_rm8, -        [XOP_MOVSX_R1632_RM8]           = x86_read_instr_movsx_r1632_rm8, -        [XOP_MOVSX_R1632_RM1632]        = x86_read_instr_movsx_r1632_rm1632,          [XOP_ADC_RM8_R8]                = x86_read_instr_adc_rm8_r8, +        [XOP_SBB_RM1632_R1632]          = x86_read_instr_sbb_rm1632_r1632,          [XOP_AND_RM8_R8]                = x86_read_instr_and_rm8_r8,          [XOP_AND_RM1632_R1632]          = x86_read_instr_and_rm1632_r1632,          [XOP_AND_AL_IMM8]               = x86_read_instr_and_al_imm8,          [XOP_AND_E_AX_IMM1632]          = x86_read_instr_and_e_ax_imm1632,          [XOP_SUB_RM1632_R1632]          = x86_read_instr_sub_rm1632_r1632,          [XOP_SUB_R8_RM8]                = x86_read_instr_sub_r8_rm8, +        [XOP_SUB_R1632_RM1632]          = x86_read_instr_sub_r1632_rm1632,          [XOP_SUB_AL_IMM8]               = x86_read_instr_sub_al_imm8,          [XOP_SUB_E_AX_IMM1632]          = x86_read_instr_sub_e_ax_imm1632,          [XOP_XOR_RM8_R8]                = x86_read_instr_xor_rm8_r8, @@ -221,8 +212,11 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor          [XOP_XOR_R1632_RM1632]          = x86_read_instr_xor_r1632_rm1632,          [XOP_XOR_AL_IMM8]               = x86_read_instr_xor_al_imm8,          [XOP_XOR_E_AX_IMM1632]          = x86_read_instr_xor_e_ax_imm1632, +        [XOP_CMP_RM8_R8]                = x86_read_instr_cmp_rm8_r8,          [XOP_CMP_RM1632_R1632]          = x86_read_instr_cmp_rm1632_r1632,          [XOP_CMP_R1632_RM1632]          = x86_read_instr_cmp_r1632_rm1632, +        [XOP_CMP_AL_IMM8]               = x86_read_instr_cmp_al_imm8, +        [XOP_CMP_E_AX_IMM1632]          = x86_read_instr_cmp_e_ax_imm1632,          [XOP_INC_E_AX]                  = x86_read_instr_inc_r1632,          [XOP_INC_E_CX]                  = x86_read_instr_inc_r1632,          [XOP_INC_E_DX]                  = x86_read_instr_inc_r1632, @@ -320,6 +314,7 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor          [XOP_MOV_MOFFS8_AL]             = x86_read_instr_mov_moffs8_al,          [XOP_MOV_MOFFS1632_E_AX]        = x86_read_instr_mov_moffs1632_e_ax,          [XOP_MOVS_M1632_M1632]          = x86_read_instr_movs_m1632_m1632, +        [XOP_CMPS_M8_M8]                = x86_read_instr_cmps_m8_m8,          [XOP_TEST_AL_IMM8]              = x86_read_instr_test_al_imm8,          [XOP_TEST_E_AX_IMM1632]         = x86_read_instr_test_e_ax_imm1632,          [XOP_STOS_M1632_E_AX]           = x86_read_instr_stos_m1632_e_ax, @@ -373,7 +368,45 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor          [XOP_DEC_RM1632]                = x86_read_instr_dec_rm1632,          [XOP_CALL_RM1632]               = x86_read_instr_call_rm1632,          [XOP_JMP_RM1632]                = x86_read_instr_jmp_rm1632, -        [XOP_PUSH_RM1632]               = x86_read_instr_push_rm1632 +        [XOP_PUSH_RM1632]               = x86_read_instr_push_rm1632, + +        /* Instructions avec opcode sur deux octets */ + +        [XOP_JO_REL1632]                = x86_read_instr_jo_rel1632, +        [XOP_JNO_REL1632]               = x86_read_instr_jno_rel1632, +        [XOP_JB_REL1632]                = x86_read_instr_jb_rel1632, +        [XOP_JNB_REL1632]               = x86_read_instr_jnb_rel1632, +        [XOP_JE_REL1632]                = x86_read_instr_je_rel1632, +        [XOP_JNE_REL1632]               = x86_read_instr_jne_rel1632, +        [XOP_JNA_REL1632]               = x86_read_instr_jna_rel1632, +        [XOP_JA_REL1632]                = x86_read_instr_ja_rel1632, +        [XOP_JS_REL1632]                = x86_read_instr_js_rel1632, +        [XOP_JNS_REL1632]               = x86_read_instr_jns_rel1632, +        [XOP_JP_REL1632]                = x86_read_instr_jp_rel1632, +        [XOP_JNP_REL1632]               = x86_read_instr_jnp_rel1632, +        [XOP_JL_REL1632]                = x86_read_instr_jl_rel1632, +        [XOP_JNL_REL1632]               = x86_read_instr_jnl_rel1632, +        [XOP_JNG_REL1632]               = x86_read_instr_jng_rel1632, +        [XOP_JG_REL1632]                = x86_read_instr_jg_rel1632, +        [XOP_SETO_RM8]                  = x86_read_instr_seto_rm8, +        [XOP_SETNO_RM8]                 = x86_read_instr_setno_rm8, +        [XOP_SETB_RM8]                  = x86_read_instr_setb_rm8, +        [XOP_SETNB_RM8]                 = x86_read_instr_setnb_rm8, +        [XOP_SETE_RM8]                  = x86_read_instr_sete_rm8, +        [XOP_SETNE_RM8]                 = x86_read_instr_setne_rm8, +        [XOP_SETNA_RM8]                 = x86_read_instr_setna_rm8, +        [XOP_SETA_RM8]                  = x86_read_instr_seta_rm8, +        [XOP_SETS_RM8]                  = x86_read_instr_sets_rm8, +        [XOP_SETNS_RM8]                 = x86_read_instr_setns_rm8, +        [XOP_SETP_RM8]                  = x86_read_instr_setp_rm8, +        [XOP_SETNP_RM8]                 = x86_read_instr_setnp_rm8, +        [XOP_SETL_RM8]                  = x86_read_instr_setl_rm8, +        [XOP_SETNL_RM8]                 = x86_read_instr_setnl_rm8, +        [XOP_SETNG_RM8]                 = x86_read_instr_setng_rm8, +        [XOP_SETG_RM8]                  = x86_read_instr_setg_rm8, +        [XOP_MOVZX_R1632_RM8]           = x86_read_instr_movzx_r1632_rm8, +        [XOP_MOVSX_R1632_RM8]           = x86_read_instr_movsx_r1632_rm8, +        [XOP_MOVSX_R1632_RM1632]        = x86_read_instr_movsx_r1632_rm1632      }; @@ -385,6 +418,8 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor          addr++;      }      if (prefix & XPX_OPERAND_SIZE_OVERRIDE) (*pos)++; +    if (prefix & XPX_REPEAT_STR_OPERATION_F2) (*pos)++; +    if (prefix & XPX_REPEAT_STR_OPERATION_F3) (*pos)++;      if (id != XOP_COUNT && !care) (*pos)++; | 
