summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-10-04 21:31:35 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-10-04 21:31:35 (GMT)
commit34612ad3304e9064f38c3adce728f2a71352c981 (patch)
tree4fde28976b0c6d8700f9242b549192fe622e30cb /src/arch/x86
parent5d33469143778e8ab22b362b7a647f53cd6fc840 (diff)
Supported extra x86 opcodes. Fixed a bug with two-byte opcodes.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@126 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/Makefile.am1
-rw-r--r--src/arch/x86/instruction.c25
-rw-r--r--src/arch/x86/instruction.h16
-rw-r--r--src/arch/x86/op_jump.c144
-rw-r--r--src/arch/x86/op_not.c33
-rw-r--r--src/arch/x86/op_or.c115
-rw-r--r--src/arch/x86/op_set.c93
-rw-r--r--src/arch/x86/op_test.c33
-rw-r--r--src/arch/x86/opcodes.h33
-rw-r--r--src/arch/x86/processor.c49
10 files changed, 541 insertions, 1 deletions
diff --git a/src/arch/x86/Makefile.am b/src/arch/x86/Makefile.am
index 257bf9c..2fd5cd7 100644
--- a/src/arch/x86/Makefile.am
+++ b/src/arch/x86/Makefile.am
@@ -33,6 +33,7 @@ libarchx86_la_SOURCES = \
op_sar.c \
op_sbb.c \
op_scas.c \
+ op_set.c \
op_shl.c \
op_shr.c \
op_sub.c \
diff --git a/src/arch/x86/instruction.c b/src/arch/x86/instruction.c
index 712fab4..c8d31a0 100644
--- a/src/arch/x86/instruction.c
+++ b/src/arch/x86/instruction.c
@@ -88,12 +88,27 @@ static x86_instruction _instructions[XOP_COUNT] = {
[XOP_ADD_E_AX_IMM1632] = { false, 0x05, IDX_TO_EXT(-1), "add", XPX_OPERAND_SIZE_OVERRIDE },
[XOP_OR_R8_RM8] = { false, 0x0a, IDX_TO_EXT(-1), "or", XPX_NONE },
+
+ [XOP_OR_RM8_R8] = { false, 0x08, IDX_TO_EXT(-1), "or", XPX_NONE },
+ [XOP_OR_RM1632_R1632] = { false, 0x09, IDX_TO_EXT(-1), "or", XPX_OPERAND_SIZE_OVERRIDE },
+ [XOP_OR_R8_RM8] = { false, 0x0a, IDX_TO_EXT(-1), "or", XPX_NONE },
+ [XOP_OR_R1632_RM1632] = { false, 0x0b, IDX_TO_EXT(-1), "or", XPX_OPERAND_SIZE_OVERRIDE },
[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_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_SETE_RM8] = { false, 0x94, IDX_TO_EXT(-1), "sete", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE },
+ [XOP_SETNE_RM8] = { false, 0x95, IDX_TO_EXT(-1), "setne", XPX_TWO_BYTES | XPX_OPERAND_SIZE_OVERRIDE },
+
+
[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 },
@@ -300,6 +315,9 @@ static x86_instruction _instructions[XOP_COUNT] = {
[XOP_HLT] = { false, 0xf4, IDX_TO_EXT(-1), "hlt", XPX_NONE },
+ [XOP_TEST_RM8_IMM8] = { false, 0xf6, IDX_TO_EXT(0), "test", XPX_NONE },
+ [XOP_TEST_RM8_IMM8_BIS] = { false, 0xf6, IDX_TO_EXT(1), "test", XPX_NONE },
+ [XOP_NOT_RM8] = { false, 0xf6, IDX_TO_EXT(2), "not", XPX_NONE },
[XOP_TEST_RM1632_IMM1632] = { false, 0xf7, IDX_TO_EXT(0), "test", XPX_OPERAND_SIZE_OVERRIDE },
[XOP_TEST_RM1632_IMM1632_BIS] = { false, 0xf7, IDX_TO_EXT(1), "test", XPX_OPERAND_SIZE_OVERRIDE },
@@ -507,7 +525,12 @@ X86Opcodes x86_guess_next_instruction(const bin_t *data, off_t pos, off_t len, X
for (result = 0; result < XOP_COUNT; result++)
{
- if ((_instructions[result].prefix & *prefix) != *prefix) continue;
+ /* TODO : à intégrer dans la liste */
+ if (_instructions[result].prefix & XPX_TWO_BYTES)
+ {
+ if ((_instructions[result].prefix & *prefix) != (*prefix | XPX_TWO_BYTES)) continue;
+ }
+ else if ((_instructions[result].prefix & *prefix) != *prefix) continue;
if (_instructions[result].opcode != opcode) continue;
diff --git a/src/arch/x86/instruction.h b/src/arch/x86/instruction.h
index c190136..ad50834 100644
--- a/src/arch/x86/instruction.h
+++ b/src/arch/x86/instruction.h
@@ -42,11 +42,23 @@ typedef enum _X86Opcodes
XOP_ADD_AL_IMM8, /* add (0x04) */
XOP_ADD_E_AX_IMM1632, /* sub ([0x66] 0x05) */
+ XOP_OR_RM8_R8, /* or (0x08) */
+ XOP_OR_RM1632_R1632, /* or ([0x66] 0x09) */
XOP_OR_R8_RM8, /* or (0x0a) */
+ 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_JA_REL1632, /* jne ([0x66] 0x0f 0x87) */
+
+ XOP_JGE_REL1632, /* jge ([0x66] 0x0f 0x8d) */
XOP_JLE_REL1632, /* jle ([0x66] 0x0f 0x8e) */
+ XOP_SETE_RM8, /* sete ([0x66] 0x0f 0x94) */
+ XOP_SETNE_RM8, /* setne ([0x66] 0x0f 0x95) */
+
XOP_MOVZX_R1632_RM8, /* movzx ([0x66] 0x0f 0xb6) */
XOP_MOVSX_R1632_RM8, /* movsx ([0x66] 0x0f 0xbe) */
@@ -240,6 +252,10 @@ typedef enum _X86Opcodes
XOP_HLT, /* hlt (0xf4) */
+ XOP_TEST_RM8_IMM8, /* test (0xf6 0) */
+ XOP_TEST_RM8_IMM8_BIS, /* test (0xf6 1) */
+ XOP_NOT_RM8, /* not (0xf6 2) */
+
XOP_TEST_RM1632_IMM1632, /* test ([0x66] 0xf7 0) */
XOP_TEST_RM1632_IMM1632_BIS, /* test ([0x66] 0xf7 1) */
XOP_NOT_RM1632, /* not ([0x66] 0xf7 2) */
diff --git a/src/arch/x86/op_jump.c b/src/arch/x86/op_jump.c
index 9688963..1f7db24 100644
--- a/src/arch/x86/op_jump.c
+++ b/src/arch/x86/op_jump.c
@@ -71,6 +71,42 @@ 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.). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_ja_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ AsmOperandSize oprsize; /* Taille des opérandes */
+
+ result = g_x86_instruction_new(XOP_JA_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);*/
+ 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 'jb' (saut 8b si inférieur). *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -137,6 +173,42 @@ 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). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_je_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ AsmOperandSize oprsize; /* Taille des opérandes */
+
+ result = g_x86_instruction_new(XOP_JE_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);*/
+ 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 'jg' (saut 8b si supérieur). *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -170,6 +242,42 @@ 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 'jge' (saut 16/32b si sup.). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+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 *result; /* Instruction à retourner */
+ AsmOperandSize oprsize; /* Taille des opérandes */
+
+ result = g_x86_instruction_new(XOP_JGE_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);*/
+ 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 si inférieur). *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -443,6 +551,42 @@ 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). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_jne_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ AsmOperandSize oprsize; /* Taille des opérandes */
+
+ result = g_x86_instruction_new(XOP_JNE_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);*/
+ 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 8b si !supérieur).*
* *
* Retour : Instruction mise en place ou NULL. *
diff --git a/src/arch/x86/op_not.c b/src/arch/x86/op_not.c
index f57c754..e5677fe 100644
--- a/src/arch/x86/op_not.c
+++ b/src/arch/x86/op_not.c
@@ -38,6 +38,39 @@
* addr = adresse virtuelle de l'instruction. *
* proc = architecture ciblée par le désassemblage. *
* *
+* Description : Décode une instruction de type 'not' (8 bits). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_not_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_NOT_RM8);
+
+ if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8))
+ {
+ /* 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 'not' (16 ou 32 bits). *
* *
* Retour : Instruction mise en place ou NULL. *
diff --git a/src/arch/x86/op_or.c b/src/arch/x86/op_or.c
index 1f1e78d..f620d7b 100644
--- a/src/arch/x86/op_or.c
+++ b/src/arch/x86/op_or.c
@@ -32,6 +32,11 @@
/******************************************************************************
* *
+* 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 'or al, ...' (8 bits). *
* *
@@ -60,6 +65,11 @@ GArchInstruction *x86_read_instr_or_al_imm8(const bin_t *data, off_t *pos, off_t
/******************************************************************************
* *
+* 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 'or' (8 bits). *
* *
@@ -94,6 +104,42 @@ GArchInstruction *x86_read_instr_or_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 'or' (16 ou 32 bits). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_or_r1632_rm1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ AsmOperandSize oprsize; /* Taille des opérandes */
+
+ result = g_x86_instruction_new(XOP_OR_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 'or' (8 bits). *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -189,3 +235,72 @@ GArchInstruction *x86_read_instr_or_rm1632_imm1632(const bin_t *data, off_t *pos
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 'or' (8 bits). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_or_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_OR_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. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'or' (16 ou 32 bits). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_or_rm1632_r1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ AsmOperandSize oprsize; /* Taille des opérandes */
+
+ result = g_x86_instruction_new(XOP_OR_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
new file mode 100644
index 0000000..ed49877
--- /dev/null
+++ b/src/arch/x86/op_set.c
@@ -0,0 +1,93 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * op_set.c - décodage des définitions d'octet sur condition
+ *
+ * Copyright (C) 2009 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 'sete' (8 bits). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_sete_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_SETE_RM8);
+
+ if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8))
+ {
+ /* 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 'setne' (8 bits). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *x86_read_instr_setne_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_SETNE_RM8);
+
+ if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM8))
+ {
+ /* TODO free(result);*/
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/x86/op_test.c b/src/arch/x86/op_test.c
index 3ee2fe2..a64861f 100644
--- a/src/arch/x86/op_test.c
+++ b/src/arch/x86/op_test.c
@@ -115,6 +115,39 @@ GArchInstruction *x86_read_instr_test_e_ax_imm1632(const bin_t *data, off_t *pos
* *
******************************************************************************/
+GArchInstruction *x86_read_instr_test_rm8_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_TEST_RM8_IMM8);
+
+ if (!x86_read_two_operands(result, data, pos, len, X86_OTP_RM8, 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. *
+* offset = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'test' (8 bits). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
GArchInstruction *x86_read_instr_test_rm8_r8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
{
GArchInstruction *result; /* Instruction à retourner */
diff --git a/src/arch/x86/opcodes.h b/src/arch/x86/opcodes.h
index 9ef2880..5317415 100644
--- a/src/arch/x86/opcodes.h
+++ b/src/arch/x86/opcodes.h
@@ -138,15 +138,24 @@ GArchInstruction *x86_read_instr_int_imm8(const bin_t *, off_t *, off_t, vmpa_t,
/* Décode une instruction de type 'ja' (saut 8b si supérieur). */
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.). */
+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). */
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 8b si égal). */
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). */
+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). */
GArchInstruction *x86_read_instr_jg_rel8(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). */
GArchInstruction *x86_read_instr_jl_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
@@ -162,6 +171,9 @@ GArchInstruction *x86_read_instr_jnb_rel8(const bin_t *, off_t *, off_t, vmpa_t,
/* Décode une instruction de type 'jne' (saut 8b si !égal). */
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). */
+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). */
GArchInstruction *x86_read_instr_jng_rel8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
@@ -243,6 +255,9 @@ GArchInstruction *x86_read_instr_movzx_r1632_rm8(const bin_t *, off_t *, off_t,
/* Décode une instruction de type 'nop'. */
GArchInstruction *x86_read_instr_nop(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
+/* Décode une instruction de type 'not' (8 bits). */
+GArchInstruction *x86_read_instr_not_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
+
/* Décode une instruction de type 'not' (16 ou 32 bits). */
GArchInstruction *x86_read_instr_not_rm1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
@@ -252,6 +267,9 @@ GArchInstruction *x86_read_instr_or_al_imm8(const bin_t *, off_t *, off_t, vmpa_
/* Décode une instruction de type 'or' (8 bits). */
GArchInstruction *x86_read_instr_or_r8_rm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
+/* Décode une instruction de type 'or' (16 ou 32 bits). */
+GArchInstruction *x86_read_instr_or_r1632_rm1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
+
/* Décode une instruction de type 'or' (8 bits). */
GArchInstruction *x86_read_instr_or_rm8_imm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
@@ -261,6 +279,12 @@ GArchInstruction *x86_read_instr_or_rm1632_imm8(const bin_t *, off_t *, off_t, v
/* Décode une instruction de type 'or' (16 ou 32 bits). */
GArchInstruction *x86_read_instr_or_rm1632_imm1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
+/* Décode une instruction de type 'or' (8 bits). */
+GArchInstruction *x86_read_instr_or_rm8_r8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
+
+/* Décode une instruction de type 'or' (16 ou 32 bits). */
+GArchInstruction *x86_read_instr_or_rm1632_r1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
+
/* Décode une instruction de type 'pop' (16 ou 32 bits). */
GArchInstruction *x86_read_instr_pop_r1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
@@ -306,6 +330,12 @@ GArchInstruction *x86_read_instr_sbb_rm1632_imm1632(const bin_t *, off_t *, off_
/* 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 '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 '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 'shl' (16 ou 32 bits). */
GArchInstruction *x86_read_instr_shl_rm1632_cl(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
@@ -343,6 +373,9 @@ GArchInstruction *x86_read_instr_test_al_imm8(const bin_t *, off_t *, off_t, vmp
GArchInstruction *x86_read_instr_test_e_ax_imm1632(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
/* Décode une instruction de type 'test' (8 bits). */
+GArchInstruction *x86_read_instr_test_rm8_imm8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
+
+/* Décode une instruction de type 'test' (8 bits). */
GArchInstruction *x86_read_instr_test_rm8_r8(const bin_t *, off_t *, off_t, vmpa_t, X86Prefix, const GX86Processor *);
/* Décode une instruction de type 'test' (16 ou 32 bits). */
diff --git a/src/arch/x86/processor.c b/src/arch/x86/processor.c
index fc2924b..15179e2 100644
--- a/src/arch/x86/processor.c
+++ b/src/arch/x86/processor.c
@@ -217,15 +217,55 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor
break;
+ case XOP_OR_RM8_R8:
+ result = x86_read_instr_or_rm8_r8(data, pos, len, addr, prefix, proc);
+ break;
+
+ case XOP_OR_RM1632_R1632:
+ result = x86_read_instr_or_rm1632_r1632(data, pos, len, addr, prefix, proc);
+ break;
+
case XOP_OR_R8_RM8:
result = x86_read_instr_or_r8_rm8(data, pos, len, addr, prefix, proc);
break;
+ case XOP_OR_R1632_RM1632:
+ result = x86_read_instr_or_r1632_rm1632(data, pos, len, addr, prefix, proc);
+ break;
+
case XOP_OR_AL_IMM8:
result = x86_read_instr_or_al_imm8(data, pos, len, addr, prefix, proc);
break;
+ case XOP_JE_REL1632:
+ result = x86_read_instr_je_rel1632(data, pos, len, addr, prefix, proc);
+ break;
+
+ case XOP_JNE_REL1632:
+ result = x86_read_instr_jne_rel1632(data, pos, len, addr, prefix, proc);
+ break;
+
+
+ case XOP_JA_REL1632:
+ result = x86_read_instr_ja_rel1632(data, pos, len, addr, prefix, proc);
+ break;
+
+
+ case XOP_SETE_RM8:
+ result = x86_read_instr_sete_rm8(data, pos, len, addr, prefix, proc);
+ break;
+
+ case XOP_SETNE_RM8:
+ result = x86_read_instr_setne_rm8(data, pos, len, addr, prefix, proc);
+ break;
+
+
+
+ case XOP_JGE_REL1632:
+ result = x86_read_instr_jge_rel1632(data, pos, len, addr, prefix, proc);
+ break;
+
case XOP_JLE_REL1632:
result = x86_read_instr_jle_rel1632(data, pos, len, addr, prefix, proc);
break;
@@ -718,6 +758,15 @@ static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor
break;
+ case XOP_TEST_RM8_IMM8:
+ case XOP_TEST_RM8_IMM8_BIS:
+ result = x86_read_instr_test_rm8_imm8(data, pos, len, addr, prefix, proc);
+ break;
+
+ case XOP_NOT_RM8:
+ result = x86_read_instr_not_rm8(data, pos, len, addr, prefix, proc);
+ break;
+
case XOP_TEST_RM1632_IMM1632:
case XOP_TEST_RM1632_IMM1632_BIS:
result = x86_read_instr_test_rm1632_imm1632(data, pos, len, addr, prefix, proc);