summaryrefslogtreecommitdiff
path: root/src/arch/x86/op_call.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-05-17 22:59:55 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-05-17 22:59:55 (GMT)
commit4d0ff0c23862c242d533d9b2d34e8812ef99ad61 (patch)
tree3b8504b8d3946a8bc9a702b819138ab1e5501be6 /src/arch/x86/op_call.c
parent96cb6971ee3ca529958b8cb1e8e55a6eb4e60eae (diff)
Used only the new format of processor/instructions/operands for x86.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@64 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/op_call.c')
-rw-r--r--src/arch/x86/op_call.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/src/arch/x86/op_call.c b/src/arch/x86/op_call.c
index 7641214..f121dd3 100644
--- a/src/arch/x86/op_call.c
+++ b/src/arch/x86/op_call.c
@@ -32,11 +32,11 @@
/******************************************************************************
* *
-* 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. *
+* 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 'call' (16 ou 32 bits). *
* *
@@ -46,22 +46,18 @@
* *
******************************************************************************/
-asm_x86_instr *x86_read_instr_call_rel1632(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc)
+GArchInstruction *x86_read_instr_call_rel1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
{
- asm_x86_instr *result; /* Instruction à retourner */
+ GArchInstruction *result; /* Instruction à retourner */
AsmOperandSize oprsize; /* Taille des opérandes */
- result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr));
+ result = g_x86_instruction_new(XOP_CALL_REL1632);
- oprsize = switch_x86_operand_size_if_needed(proc, data, pos);
+ oprsize = g_x86_processor_get_operand_size(proc, prefix);
- ASM_INSTRUCTION(result)->opcode = data[(*pos)++];
-
- ASM_INSTRUCTION(result)->type = AIT_CALL;
-
- if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, offset))
+ if (!x86_read_one_operand(result, data, pos, len, X86_OTP_REL1632, oprsize, addr))
{
- free(result);
+ /* TODO free(result);*/
return NULL;
}
@@ -72,11 +68,11 @@ asm_x86_instr *x86_read_instr_call_rel1632(const uint8_t *data, off_t *pos, off_
/******************************************************************************
* *
-* 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. *
+* 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 'call' (16 ou 32 bits). *
* *
@@ -86,22 +82,18 @@ asm_x86_instr *x86_read_instr_call_rel1632(const uint8_t *data, off_t *pos, off_
* *
******************************************************************************/
-asm_x86_instr *x86_read_instr_call_rm1632(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc)
+GArchInstruction *x86_read_instr_call_rm1632(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
{
- asm_x86_instr *result; /* Instruction à retourner */
+ GArchInstruction *result; /* Instruction à retourner */
AsmOperandSize oprsize; /* Taille des opérandes */
- result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr));
-
- oprsize = switch_x86_operand_size_if_needed(proc, data, pos);
-
- ASM_INSTRUCTION(result)->opcode = data[(*pos)++];
+ result = g_x86_instruction_new(XOP_CALL_RM1632);
- ASM_INSTRUCTION(result)->type = AIT_CALL;
+ oprsize = g_x86_processor_get_operand_size(proc, prefix);
if (!x86_read_one_operand(result, data, pos, len, X86_OTP_RM1632, oprsize))
{
- free(result);
+ /* TODO free(result);*/
return NULL;
}