summaryrefslogtreecommitdiff
path: root/src/arch/x86/op_push.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2008-09-06 21:30:01 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2008-09-06 21:30:01 (GMT)
commit4946ffe81e3edf35061a07cf4425f9accff11888 (patch)
treeb27b61d398195c017a49bfa61ab6c8badc417b98 /src/arch/x86/op_push.c
parentf14993aac5b0b4b7ae174f27e4d1f0f540057c58 (diff)
Added more support for lea and push opcodes.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@25 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/op_push.c')
-rw-r--r--src/arch/x86/op_push.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/arch/x86/op_push.c b/src/arch/x86/op_push.c
index 0edd9bc..b577177 100644
--- a/src/arch/x86/op_push.c
+++ b/src/arch/x86/op_push.c
@@ -47,6 +47,58 @@
* *
******************************************************************************/
+asm_x86_instr *read_instr_push_content(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc)
+{
+ asm_x86_instr *result; /* Instruction à retourner */
+ AsmOperandSize oprsize; /* Taille des opérandes */
+ asm_x86_operand *content; /* Registre de source */
+
+ result = (asm_x86_instr *)calloc(1, sizeof(asm_x86_instr));
+
+ /* Utilisation des registres 32 bits ? */
+ 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)++];
+
+ content = x86_create_content1632_operand(data, pos, len, oprsize == AOS_32_BITS, true);
+ if (content == NULL)
+ {
+ (*pos)--;
+ free(result);
+ return NULL;
+ }
+
+ ASM_INSTRUCTION(result)->operands = (asm_operand **)calloc(1, sizeof(asm_operand *));
+ ASM_INSTRUCTION(result)->operands_count = 1;
+
+ ASM_INSTRUCTION(result)->operands[0] = ASM_OPERAND(content);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* 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 'push' (16 ou 32 bits). *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
asm_x86_instr *read_instr_push_imm1632(const uint8_t *data, off_t *pos, off_t len, uint64_t offset, const asm_x86_processor *proc)
{
asm_x86_instr *result; /* Instruction à retourner */