summaryrefslogtreecommitdiff
path: root/src/arch/x86/op_mov.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2008-07-31 21:46:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2008-07-31 21:46:47 (GMT)
commit3786e818fdf8731dd6f310f0aaac75d431646160 (patch)
treea1dc1d1ed27c56d7ae2e361102fef7310a9b1a21 /src/arch/x86/op_mov.c
parent57758c2cd11938e3e4c6e45b983cee4c2269ff44 (diff)
Handled the virtual offset and fixed the operand-size overriding.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@11 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/op_mov.c')
-rw-r--r--src/arch/x86/op_mov.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/arch/x86/op_mov.c b/src/arch/x86/op_mov.c
index 2ce8464..e14a2f7 100644
--- a/src/arch/x86/op_mov.c
+++ b/src/arch/x86/op_mov.c
@@ -32,9 +32,11 @@
/******************************************************************************
* *
-* Paramètres : data = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* len = taille totale des données à analyser. *
+* 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. *
* *
* Description : Décode une instruction de type 'mov' (16 ou 32 bits). *
* *
@@ -44,25 +46,26 @@
* *
******************************************************************************/
-asm_x86_instr *read_instr_mov_to_1632(const uint8_t *data, off_t *pos, off_t len)
+asm_x86_instr *read_instr_mov_to_1632(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc)
{
asm_x86_instr *result; /* Instruction à retourner */
- bool is_reg32; /* Implique un registre 32 bits*/
+ AsmOperandSize oprsize; /* Taille des opérandes */
asm_x86_operand *reg; /* Registre de destination */
asm_x86_operand *value; /* Valeur portée */
result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr));
/* Utilisation des registres 32 bits ? */
- is_reg32 = (data[*pos] == 0x66);
- if (is_reg32)
+ if (data[*pos] == 0x66)
{
+ oprsize = switch_x86_operand_size(proc);
(*pos)++;
}
+ else oprsize = get_x86_current_operand_size(proc);
ASM_INSTRUCTION(result)->opcode = data[*pos];
- reg = x86_create_reg1632_operand(data[(*pos)++], is_reg32, 0xb8);
+ reg = x86_create_reg1632_operand(data[(*pos)++], oprsize == AOS_32_BITS, 0xb8);
if (reg == NULL)
{
free(result);
@@ -70,7 +73,7 @@ asm_x86_instr *read_instr_mov_to_1632(const uint8_t *data, off_t *pos, off_t len
}
value = create_new_x86_operand();
- if (!fill_imm_operand(ASM_OPERAND(value), is_reg32 ? AOS_32_BITS : AOS_16_BITS, data, pos, len))
+ if (!fill_imm_operand(ASM_OPERAND(value), oprsize, data, pos, len))
{
free(reg);
free(value);