summaryrefslogtreecommitdiff
path: root/src/arch/x86/op_int.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/op_int.c')
-rw-r--r--src/arch/x86/op_int.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/src/arch/x86/op_int.c b/src/arch/x86/op_int.c
index 4fdb73a..98b5ce9 100644
--- a/src/arch/x86/op_int.c
+++ b/src/arch/x86/op_int.c
@@ -27,6 +27,7 @@
#include "../instruction-int.h"
#include "opcodes.h"
#include "operand.h"
+#include "../immediate.h"
@@ -35,7 +36,8 @@
* 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'. *
@@ -46,19 +48,11 @@
* *
******************************************************************************/
-asm_x86_instr *x86_read_instr_int(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc)
+GArchInstruction *x86_read_instr_int(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, X86Prefix prefix, const GX86Processor *proc)
{
- asm_x86_instr *result; /* Instruction à retourner */
-
- result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr));
-
- ASM_INSTRUCTION(result)->opcode = data[(*pos)++];
+ GArchInstruction *result; /* Instruction à retourner */
- if (!x86_read_one_operand(result, data, pos, len, X86_OTP_IMM8))
- {
- free(result);
- return NULL;
- }
+ result = g_x86_instruction_new(XOP_INT);
return result;
@@ -81,27 +75,15 @@ asm_x86_instr *x86_read_instr_int(const uint8_t *data, off_t *pos, off_t len, ui
* *
******************************************************************************/
-asm_x86_instr *x86_read_instr_int_3(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *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)
{
- asm_x86_instr *result; /* Instruction à retourner */
- asm_x86_operand *op; /* Opérande unique décodé */
-
- result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr));
-
- ASM_INSTRUCTION(result)->opcode = data[(*pos)++];
-
- op = create_new_x86_operand();
- if (!fill_imm_operand_with_value(ASM_OPERAND(op), AOS_8_BITS, (int []) { 3 }))
- {
- free(op);
- free(result);
- return NULL;
- }
+ GArchInstruction *result; /* Instruction à retourner */
+ GArchOperand *three; /* Argument artificiel */
- ASM_INSTRUCTION(result)->operands = (asm_operand **)calloc(1, sizeof(asm_operand *));
- ASM_INSTRUCTION(result)->operands_count = 1;
+ result = g_x86_instruction_new(XOP_INT_3);
- ASM_INSTRUCTION(result)->operands[0] = ASM_OPERAND(op);
+ three = g_imm_operand_new_from_value(AOS_8_BITS, 3);
+ g_arch_instruction_attach_one_operand(result, three);
return result;