summaryrefslogtreecommitdiff
path: root/src/arch/x86/instruction.c
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/instruction.c
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/instruction.c')
-rw-r--r--src/arch/x86/instruction.c25
1 files changed, 24 insertions, 1 deletions
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;