summaryrefslogtreecommitdiff
path: root/plugins/arm/v7/operands/offset.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/arm/v7/operands/offset.c')
-rw-r--r--plugins/arm/v7/operands/offset.c83
1 files changed, 82 insertions, 1 deletions
diff --git a/plugins/arm/v7/operands/offset.c b/plugins/arm/v7/operands/offset.c
index 6bcacaf..967b296 100644
--- a/plugins/arm/v7/operands/offset.c
+++ b/plugins/arm/v7/operands/offset.c
@@ -24,6 +24,10 @@
#include "offset.h"
+#include <stdio.h>
+#include <string.h>
+
+
#include <arch/operand-int.h>
#include <common/sort.h>
#include <gtkext/gtkblockdisplay.h>
@@ -64,6 +68,12 @@ static void g_armv7_offset_operand_finalize(GArmV7OffsetOperand *);
/* Compare un opérande avec un autre. */
static int g_armv7_offset_operand_compare(const GArmV7OffsetOperand *, const GArmV7OffsetOperand *);
+/* Détermine le chemin conduisant à un opérande interne. */
+static char *g_armv7_offset_operand_find_inner_operand_path(const GArmV7OffsetOperand *, const GArchOperand *);
+
+/* Obtient l'opérande correspondant à un chemin donné. */
+static GArchOperand *g_armv7_offset_operand_get_inner_operand_from_path(const GArmV7OffsetOperand *, const char *);
+
/* Traduit un opérande en version humainement lisible. */
static void g_armv7_offset_operand_print(const GArmV7OffsetOperand *, GBufferLine *);
@@ -102,12 +112,16 @@ static void g_armv7_offset_operand_class_init(GArmV7OffsetOperandClass *klass)
GArchOperandClass *operand; /* Version de classe parente */
object = G_OBJECT_CLASS(klass);
- operand = G_ARCH_OPERAND_CLASS(klass);
object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_offset_operand_dispose;
object->finalize = (GObjectFinalizeFunc)g_armv7_offset_operand_finalize;
+ operand = G_ARCH_OPERAND_CLASS(klass);
+
operand->compare = (operand_compare_fc)g_armv7_offset_operand_compare;
+ operand->find_inner = (find_inner_operand_fc)g_armv7_offset_operand_find_inner_operand_path;
+ operand->get_inner = (get_inner_operand_fc)g_armv7_offset_operand_get_inner_operand_from_path;
+
operand->print = (operand_print_fc)g_armv7_offset_operand_print;
operand->unserialize = (unserialize_operand_fc)g_armv7_offset_operand_unserialize;
@@ -207,6 +221,73 @@ static int g_armv7_offset_operand_compare(const GArmV7OffsetOperand *a, const GA
/******************************************************************************
* *
+* Paramètres : operand = opérande à consulter. *
+* target = instruction à venir retrouver. *
+* *
+* Description : Détermine le chemin conduisant à un opérande interne. *
+* *
+* Retour : Chemin d'accès à l'opérande ou NULL en cas d'absence. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_armv7_offset_operand_find_inner_operand_path(const GArmV7OffsetOperand *operand, const GArchOperand *target)
+{
+ char *result; /* Chemin à retourner */
+
+ if (target == operand->value)
+ result = strdup("0");
+ else
+ result = NULL;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* path = chemin d'accès à un opérande à retrouver. *
+* *
+* Description : Obtient l'opérande correspondant à un chemin donné. *
+* *
+* Retour : Opérande trouvé ou NULL en cas d'échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchOperand *g_armv7_offset_operand_get_inner_operand_from_path(const GArmV7OffsetOperand *operand, const char *path)
+{
+ GArchOperand *result; /* Opérande trouvée à renvoyer */
+
+ if (strncmp(path, "0", 1) == 0)
+ switch (path[1])
+ {
+ case '\0':
+ result = operand->value;
+ g_object_ref(G_OBJECT(result));
+ break;
+
+ case ':':
+ result = g_arch_operand_get_inner_operand_from_path(operand->value, path + 1);
+ break;
+
+ default:
+ result = NULL;
+ break;
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : operand = opérande à traiter. *
* line = ligne tampon où imprimer l'opérande donné. *
* *