summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-07-19 22:28:13 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-07-19 22:28:13 (GMT)
commit59bda76b1a76d796a42ee46b9da7041dbef57253 (patch)
tree36f7d6eaa7847016b99431b1b489c6a1fdbaf33b /src/arch/x86
parent3a9fe39c6a8923f45e7c96d80b0bfe52b8686ff9 (diff)
Encapsulated all recognized variables in the stack using a new plugin (need to be continued).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@99 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/operand.c61
-rw-r--r--src/arch/x86/operand.h14
2 files changed, 72 insertions, 3 deletions
diff --git a/src/arch/x86/operand.c b/src/arch/x86/operand.c
index 8f218fc..24613cf 100644
--- a/src/arch/x86/operand.c
+++ b/src/arch/x86/operand.c
@@ -29,7 +29,6 @@
#include <stdio.h>
-#include "registers.h"
#include "../operand.h"
#include "../operand-int.h"
#include "../../common/extstr.h"
@@ -654,6 +653,66 @@ static char *g_x86_mod_rm_operand_get_text(const GX86ModRMOperand *operand, cons
}
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* scale = facteur sous forme de puissance de deux. [OUT *
+* index = register principal de l'opérande. [OUT] *
+* *
+* Description : Fournit l'indice et l'échelle d'un opérande x86 ModRM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_x86_mod_rm_operand_get_scale_and_index(const GX86ModRMOperand *operand, uint8_t *scale, const x86_register **index)
+{
+ *scale = operand->scale;
+ *index = operand->index;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Fournit le registre de base d'un opérande x86 ModRM. *
+* *
+* Retour : Registre de base de l'opérande. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const x86_register *g_x86_mod_rm_operand_get_base(const GX86ModRMOperand *operand)
+{
+ return operand->base;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Fournit le décallage supplémentaire d'un opérande x86 ModRM. *
+* *
+* Retour : Décallage numérique pour l'opérande. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const GImmOperand *g_x86_mod_rm_operand_get_displacement(const GX86ModRMOperand *operand)
+{
+ return operand->displacement;
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* OPERANDES D'ADRESSES RELATIVES */
diff --git a/src/arch/x86/operand.h b/src/arch/x86/operand.h
index 9f4db09..cbf2ed2 100644
--- a/src/arch/x86/operand.h
+++ b/src/arch/x86/operand.h
@@ -30,6 +30,7 @@
#include "../immediate.h"
#include "../instruction.h"
+#include "registers.h"
@@ -88,9 +89,9 @@ GArchOperand *g_x86_register_operand_new_from_index(bin_t, AsmOperandSize);
#define G_TYPE_X86_MOD_RM_OPERAND g_x86_mod_rm_operand_get_type()
-#define G_X86_MOD_RM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_x86_mod_rm_operand_get_type(), GX86ModRmOperand))
+#define G_X86_MOD_RM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_x86_mod_rm_operand_get_type(), GX86ModRMOperand))
#define G_IS_X86_MOD_RM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_x86_mod_rm_operand_get_type()))
-#define G_X86_MOD_RM_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_x86_mod_rm_operand_get_type(), GX86ModRmOperandIface))
+#define G_X86_MOD_RM_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_x86_mod_rm_operand_get_type(), GX86ModRMOperandIface))
/* Définition d'un opérande x86 de type ModRM (instance) */
@@ -106,6 +107,15 @@ GType g_x86_mod_rm_operand_get_type(void);
/* Crée un opérande x86 de type ModRM. */
GArchOperand *g_x86_mod_rm_operand_new(const bin_t *, off_t *, off_t, AsmOperandSize);
+/* Fournit l'indice et l'échelle d'un opérande x86 ModRM. */
+void g_x86_mod_rm_operand_get_scale_and_index(const GX86ModRMOperand *operand, uint8_t *, const x86_register **);
+
+/* Fournit le registre de base d'un opérande x86 ModRM. */
+const x86_register *g_x86_mod_rm_operand_get_base(const GX86ModRMOperand *);
+
+/* Fournit le décallage supplémentaire d'un opérande x86 ModRM. */
+const GImmOperand *g_x86_mod_rm_operand_get_displacement(const GX86ModRMOperand *);
+
/* ------------------------- OPERANDES D'ADRESSES RELATIVES ------------------------- */