diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2008-07-27 19:38:15 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2008-07-27 19:38:15 (GMT) |
commit | 1bf9c5ebe8bb3326e10491974cd43b221e2a56a1 (patch) | |
tree | 01a745a798661478eb7a6e02c0a0831bb1b4950c /src/arch/x86/op_int.c | |
parent | dbf4d1f93e54251568854bff0ebc9c84f60857f6 (diff) |
Supported new x86 opcodes (nop and mov).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@7 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/op_int.c')
-rw-r--r-- | src/arch/x86/op_int.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/arch/x86/op_int.c b/src/arch/x86/op_int.c index e7805e1..3c621d6 100644 --- a/src/arch/x86/op_int.c +++ b/src/arch/x86/op_int.c @@ -24,9 +24,9 @@ #include <malloc.h> -#include "instruction.h" #include "../instruction-int.h" - +#include "opcodes.h" +#include "operand.h" @@ -44,20 +44,28 @@ * * ******************************************************************************/ -asm_x86_instr *read_instr_int(const char *data, off_t *pos, off_t len) +asm_x86_instr *read_instr_int(const uint8_t *data, off_t *pos, off_t len) { - asm_x86_instr *result; + asm_x86_instr *result; /* Instruction à retourner */ + asm_x86_operand *syscall; /* Indice de l'appel système */ result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr)); ASM_INSTRUCTION(result)->opcode = data[(*pos)++]; - /* TODO: check result */ - fill_db_operand(&ASM_INSTRUCTION(result)->operands[0], data[(*pos)++]); + syscall = create_new_x86_operand(); + if (!fill_imm_operand(ASM_OPERAND(syscall), AOS_8_BITS, data, pos, len)) + { + free(syscall); + free(result); + return NULL; + } + ASM_INSTRUCTION(result)->operands = (asm_operand **)calloc(1, sizeof(asm_operand *)); ASM_INSTRUCTION(result)->operands_count = 1; + ASM_INSTRUCTION(result)->operands[0] = ASM_OPERAND(syscall); + return result; } - |