diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2008-09-08 22:53:49 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2008-09-08 22:53:49 (GMT) |
commit | b77dcf34b9b2308978e1c6333b34cde9f0e27a8c (patch) | |
tree | 9263e556e0e42c915b82fe48a4c3bdc5d2654b24 /src/arch/x86/op_mov.c | |
parent | b52f03ab912cd5e51dc2abea20edee6ad38c26fe (diff) |
Handled four kinds of the 'test' opcode.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@27 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/op_mov.c')
-rw-r--r-- | src/arch/x86/op_mov.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/arch/x86/op_mov.c b/src/arch/x86/op_mov.c index db731bb..d0a1bfc 100644 --- a/src/arch/x86/op_mov.c +++ b/src/arch/x86/op_mov.c @@ -65,27 +65,27 @@ asm_x86_instr *read_instr_mov_with_reg1632(const uint8_t *data, off_t *pos, off_ ASM_INSTRUCTION(result)->opcode = data[(*pos)++]; - /* TODO ! */ - if ((data[*pos] & 0xc0) != 0xc0) - return NULL; - - reg1 = x86_create_reg1632_operand_from_modrm(data[*pos], oprsize == AOS_32_BITS, true); - if (reg1 == NULL) + reg2 = x86_create_reg1632_operand_from_modrm(data[*pos], oprsize == AOS_32_BITS, false); + if (reg2 == NULL) { free(result); return NULL; } - reg2 = x86_create_reg1632_operand_from_modrm(data[*pos], oprsize == AOS_32_BITS, false); - if (reg2 == NULL) + if ((data[*pos] & 0xc0) == 0xc0) + { + reg1 = x86_create_reg1632_operand_from_modrm(data[*pos], oprsize == AOS_32_BITS, true); + (*pos)++; + } + else reg1 = x86_create_content1632_operand(data, pos, len, oprsize == AOS_32_BITS, true); + + if (reg1 == NULL) { free(result); - free(reg1); + free(reg2); return NULL; } - (*pos)++; - ASM_INSTRUCTION(result)->operands = (asm_operand **)calloc(2, sizeof(asm_operand *)); ASM_INSTRUCTION(result)->operands_count = 2; |