diff options
Diffstat (limited to 'src/arch/x86/op_test.c')
| -rw-r--r-- | src/arch/x86/op_test.c | 44 | 
1 files changed, 18 insertions, 26 deletions
| diff --git a/src/arch/x86/op_test.c b/src/arch/x86/op_test.c index 1d8d18a..39f5777 100644 --- a/src/arch/x86/op_test.c +++ b/src/arch/x86/op_test.c @@ -46,17 +46,15 @@  *                                                                             *  ******************************************************************************/ -asm_x86_instr *x86_read_instr_test_al(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc) +GArchInstruction *x86_read_instr_test_al_imm8(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     */ -    result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr)); - -    ASM_INSTRUCTION(result)->opcode = data[(*pos)++]; +    result = g_x86_instruction_new(XOP_TEST_AL_IMM8);      if (!x86_read_two_operands(result, data, pos, len, X86_OTP_AL, X86_OTP_IMM8))      { -        free(result); +        /* TODO free(result);*/          return NULL;      } @@ -81,20 +79,18 @@ asm_x86_instr *x86_read_instr_test_al(const uint8_t *data, off_t *pos, off_t len  *                                                                             *  ******************************************************************************/ -asm_x86_instr *x86_read_instr_test_e_ax(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc) +GArchInstruction *x86_read_instr_test_e_ax_imm1632(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); +    result = g_x86_instruction_new(XOP_TEST_E_AX_IMM1632); -    ASM_INSTRUCTION(result)->opcode = data[(*pos)++]; +    oprsize = g_x86_processor_get_operand_size(proc, prefix);      if (!x86_read_two_operands(result, data, pos, len, X86_OTP_E_AX, X86_OTP_IMM1632, oprsize))      { -        free(result); +        /* TODO free(result);*/          return NULL;      } @@ -119,17 +115,15 @@ asm_x86_instr *x86_read_instr_test_e_ax(const uint8_t *data, off_t *pos, off_t l  *                                                                             *  ******************************************************************************/ -asm_x86_instr *x86_read_instr_test_rm8_with_r8(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc) +GArchInstruction *x86_read_instr_test_rm8_r8(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     */ -    result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr)); - -    ASM_INSTRUCTION(result)->opcode = data[(*pos)++]; +    result = g_x86_instruction_new(XOP_TEST_RM8_R8);      if (!x86_read_two_operands(result, data, pos, len, X86_OTP_RM8, X86_OTP_R8))      { -        free(result); +        /* TODO free(result);*/          return NULL;      } @@ -154,20 +148,18 @@ asm_x86_instr *x86_read_instr_test_rm8_with_r8(const uint8_t *data, off_t *pos,  *                                                                             *  ******************************************************************************/ -asm_x86_instr *x86_read_instr_test_rm1632_with_r1632(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc) +GArchInstruction *x86_read_instr_test_rm1632_r1632(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); +    result = g_x86_instruction_new(XOP_TEST_RM1632_R1632); -    ASM_INSTRUCTION(result)->opcode = data[(*pos)++]; +    oprsize = g_x86_processor_get_operand_size(proc, prefix);      if (!x86_read_two_operands(result, data, pos, len, X86_OTP_RM1632, X86_OTP_R1632, oprsize))      { -        free(result); +        /* TODO free(result);*/          return NULL;      } | 
