diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-05-18 23:53:33 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-05-18 23:53:33 (GMT) |
commit | f7e5d077e0d62f8b8717c79616852c3e1009cfa6 (patch) | |
tree | 95c71183a51aea8e0f936a4d3fa9803760677673 /src/arch/x86/op_int.c | |
parent | 4d0ff0c23862c242d533d9b2d34e8812ef99ad61 (diff) |
Fixed various bugs in the last commit.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@65 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/op_int.c')
-rw-r--r-- | src/arch/x86/op_int.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/arch/x86/op_int.c b/src/arch/x86/op_int.c index 98b5ce9..cbeda87 100644 --- a/src/arch/x86/op_int.c +++ b/src/arch/x86/op_int.c @@ -36,11 +36,10 @@ * 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. * -* prefix = éventuel(s) préfixe(s) remarqué(s). * +* offset = adresse virtuelle de l'instruction. * * proc = architecture ciblée par le désassemblage. * * * -* Description : Décode une instruction de type 'int'. * +* Description : Décode une instruction de type 'int 3'. * * * * Retour : Instruction mise en place ou NULL. * * * @@ -48,11 +47,15 @@ * * ******************************************************************************/ -GArchInstruction *x86_read_instr_int(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_int_3(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) { GArchInstruction *result; /* Instruction à retourner */ + GArchOperand *three; /* Argument artificiel */ - result = g_x86_instruction_new(XOP_INT); + result = g_x86_instruction_new(XOP_INT_3); + + three = g_imm_operand_new_from_value(AOS_8_BITS, 3); + g_arch_instruction_attach_one_operand(result, three); return result; @@ -64,10 +67,11 @@ GArchInstruction *x86_read_instr_int(const bin_t *data, off_t *pos, off_t len, v * 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. * +* addr = adresse virtuelle de l'instruction. * +* prefix = éventuel(s) préfixe(s) remarqué(s). * * proc = architecture ciblée par le désassemblage. * * * -* Description : Décode une instruction de type 'int 3'. * +* Description : Décode une instruction de type 'int'. * * * * Retour : Instruction mise en place ou NULL. * * * @@ -75,15 +79,17 @@ GArchInstruction *x86_read_instr_int(const bin_t *data, off_t *pos, off_t len, v * * ******************************************************************************/ -GArchInstruction *x86_read_instr_int_3(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) +GArchInstruction *x86_read_instr_int_imm8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc) { GArchInstruction *result; /* Instruction à retourner */ - GArchOperand *three; /* Argument artificiel */ - result = g_x86_instruction_new(XOP_INT_3); + result = g_x86_instruction_new(XOP_INT); - three = g_imm_operand_new_from_value(AOS_8_BITS, 3); - g_arch_instruction_attach_one_operand(result, three); + if (!x86_read_one_operand(result, data, pos, len, X86_OTP_IMM8)) + { + /* TODO free(result);*/ + return NULL; + } return result; |