summaryrefslogtreecommitdiff
path: root/plugins/arm/v7/operands
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/arm/v7/operands')
-rw-r--r--plugins/arm/v7/operands/Makefile.am21
-rw-r--r--plugins/arm/v7/operands/coproc.c250
-rw-r--r--plugins/arm/v7/operands/coproc.h61
-rw-r--r--plugins/arm/v7/operands/estate.c248
-rw-r--r--plugins/arm/v7/operands/estate.h61
-rw-r--r--plugins/arm/v7/operands/limitation.c287
-rw-r--r--plugins/arm/v7/operands/limitation.h77
-rw-r--r--plugins/arm/v7/operands/maccess.c385
-rw-r--r--plugins/arm/v7/operands/maccess.h77
-rw-r--r--plugins/arm/v7/operands/offset.c283
-rw-r--r--plugins/arm/v7/operands/offset.h68
-rw-r--r--plugins/arm/v7/operands/reglist.c376
-rw-r--r--plugins/arm/v7/operands/reglist.h74
-rw-r--r--plugins/arm/v7/operands/rotation.c256
-rw-r--r--plugins/arm/v7/operands/rotation.h61
-rw-r--r--plugins/arm/v7/operands/shift.c300
-rw-r--r--plugins/arm/v7/operands/shift.h67
17 files changed, 2952 insertions, 0 deletions
diff --git a/plugins/arm/v7/operands/Makefile.am b/plugins/arm/v7/operands/Makefile.am
new file mode 100644
index 0000000..5b2d245
--- /dev/null
+++ b/plugins/arm/v7/operands/Makefile.am
@@ -0,0 +1,21 @@
+
+noinst_LTLIBRARIES = libarmv7operands.la
+
+libarmv7operands_la_SOURCES = \
+ coproc.h coproc.c \
+ estate.h estate.c \
+ limitation.h limitation.c \
+ maccess.h maccess.c \
+ offset.h offset.c \
+ reglist.h reglist.c \
+ rotation.h rotation.c \
+ shift.h shift.c
+
+libarmv7operands_la_LIBADD =
+
+libarmv7operands_la_CFLAGS = $(AM_CFLAGS)
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) -I$(top_srcdir)/src
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/arm/v7/operands/coproc.c b/plugins/arm/v7/operands/coproc.c
new file mode 100644
index 0000000..abe27c4
--- /dev/null
+++ b/plugins/arm/v7/operands/coproc.c
@@ -0,0 +1,250 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * coproc.c - décallages de valeurs
+ *
+ * Copyright (C) 2016-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "coproc.h"
+
+
+#include <arch/operand-int.h>
+#include <common/sort.h>
+
+
+
+/* Définition d'un opérande représentant un co-processeur (instance) */
+struct _GArmV7CoprocOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ uint8_t index; /* Indice du co-processeur */
+
+};
+
+
+/* Définition d'un opérande représentant un co-processeur (classe) */
+struct _GArmV7CoprocOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des coprocs de domaine et d'accès. */
+static void g_armv7_coproc_operand_class_init(GArmV7CoprocOperandClass *);
+
+/* Initialise une instance de coproc de domaine et d'accès. */
+static void g_armv7_coproc_operand_init(GArmV7CoprocOperand *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_coproc_operand_dispose(GArmV7CoprocOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_coproc_operand_finalize(GArmV7CoprocOperand *);
+
+/* Compare un opérande avec un autre. */
+static int g_armv7_coproc_operand_compare(const GArmV7CoprocOperand *, const GArmV7CoprocOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static void g_armv7_coproc_operand_print(const GArmV7CoprocOperand *, GBufferLine *, AsmSyntax);
+
+
+
+/* Indique le type défini par la GLib pour un co-processeur ARM. */
+G_DEFINE_TYPE(GArmV7CoprocOperand, g_armv7_coproc_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des co-processeurs ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_coproc_operand_class_init(GArmV7CoprocOperandClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchOperandClass *operand; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+ operand = G_ARCH_OPERAND_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_coproc_operand_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_armv7_coproc_operand_finalize;
+
+ operand->compare = (operand_compare_fc)g_armv7_coproc_operand_compare;
+ operand->print = (operand_print_fc)g_armv7_coproc_operand_print;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance de co-processeur ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_coproc_operand_init(GArmV7CoprocOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_coproc_operand_dispose(GArmV7CoprocOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_coproc_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_coproc_operand_finalize(GArmV7CoprocOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_coproc_operand_parent_class)->finalize(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un opérande avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_armv7_coproc_operand_compare(const GArmV7CoprocOperand *a, const GArmV7CoprocOperand *b)
+{
+ int result; /* Bilan à faire remonter */
+
+ result = sort_unsigned_long(a->index, b->index);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_coproc_operand_print(const GArmV7CoprocOperand *operand, GBufferLine *line, AsmSyntax syntax)
+{
+ char name[5]; /* Mot clef principal */
+ size_t nlen; /* Taille de ce mot clef */
+
+ nlen = snprintf(name, sizeof(name), "p%hhu", operand->index);
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, name, nlen, RTT_REGISTER, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : raw = valeur brute du co-processeur à considérer. *
+* *
+* Description : Crée une représentation d'un co-processeur ARM. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_coproc_operand_new(uint8_t raw)
+{
+ GArmV7CoprocOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_COPROC_OPERAND, NULL);
+
+ result->index = raw;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Fournit l'indice d'un co-processeur ARM. *
+* *
+* Retour : Inditifiant représentant le co-processeur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+uint8_t g_armv7_coproc_operand_get_index(const GArmV7CoprocOperand *operand)
+{
+ return operand->index;
+
+}
diff --git a/plugins/arm/v7/operands/coproc.h b/plugins/arm/v7/operands/coproc.h
new file mode 100644
index 0000000..bb85024
--- /dev/null
+++ b/plugins/arm/v7/operands/coproc.h
@@ -0,0 +1,61 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * coproc.h - prototypes pour les décallages de valeurs
+ *
+ * Copyright (C) 2016-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_OPERANDS_COPROC_H
+#define _PLUGINS_ARM_V7_OPERANDS_COPROC_H
+
+
+#include <glib-object.h>
+
+
+#include <arch/operand.h>
+
+
+
+#define G_TYPE_ARMV7_COPROC_OPERAND g_armv7_coproc_operand_get_type()
+#define G_ARMV7_COPROC_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv7_coproc_operand_get_type(), GArmV7CoprocOperand))
+#define G_IS_ARMV7_COPROC_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv7_coproc_operand_get_type()))
+#define G_ARMV7_COPROC_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_COPROC_OPERAND, GArmV7CoprocOperandClass))
+#define G_IS_ARMV7_COPROC_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_COPROC_OPERAND))
+#define G_ARMV7_COPROC_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_COPROC_OPERAND, GArmV7CoprocOperandClass))
+
+
+/* Définition d'un opérande représentant un co-processeur (instance) */
+typedef struct _GArmV7CoprocOperand GArmV7CoprocOperand;
+
+/* Définition d'un opérande représentant un co-processeur (classe) */
+typedef struct _GArmV7CoprocOperandClass GArmV7CoprocOperandClass;
+
+
+/* Indique le type défini par la GLib pour un co-processeur ARM. */
+GType g_armv7_coproc_operand_get_type(void);
+
+/* Crée une représentation d'un co-processeur ARM. */
+GArchOperand *g_armv7_coproc_operand_new(uint8_t);
+
+/* Fournit l'indice d'un co-processeur ARM. */
+uint8_t g_armv7_coproc_operand_get_index(const GArmV7CoprocOperand *);
+
+
+
+#endif /* _PLUGINS_ARM_V7_OPERANDS_COPROC_H */
diff --git a/plugins/arm/v7/operands/estate.c b/plugins/arm/v7/operands/estate.c
new file mode 100644
index 0000000..cdadb76
--- /dev/null
+++ b/plugins/arm/v7/operands/estate.c
@@ -0,0 +1,248 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * endian.c - décallages de valeurs
+ *
+ * Copyright (C) 2016-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "estate.h"
+
+
+#include <arch/operand-int.h>
+#include <common/sort.h>
+
+
+
+/* Définition d'un opérande affichant le choix d'un boutisme (instance) */
+struct _GArmV7EndianOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ bool big; /* Grand boutisme à afficher ? */
+
+};
+
+
+/* Définition d'un opérande affichant le choix d'un boutisme (classe) */
+struct _GArmV7EndianOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des affichages de boutisme. */
+static void g_armv7_endian_operand_class_init(GArmV7EndianOperandClass *);
+
+/* Initialise une instance d'affichage de boutisme. */
+static void g_armv7_endian_operand_init(GArmV7EndianOperand *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_endian_operand_dispose(GArmV7EndianOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_endian_operand_finalize(GArmV7EndianOperand *);
+
+/* Compare un opérande avec un autre. */
+static int g_armv7_endian_operand_compare(const GArmV7EndianOperand *, const GArmV7EndianOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static void g_armv7_endian_operand_print(const GArmV7EndianOperand *, GBufferLine *, AsmSyntax);
+
+
+
+/* Indique le type défini par la GLib pour une endian de domaine et d'accès. */
+G_DEFINE_TYPE(GArmV7EndianOperand, g_armv7_endian_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des affichages de boutisme. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_endian_operand_class_init(GArmV7EndianOperandClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchOperandClass *operand; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+ operand = G_ARCH_OPERAND_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_endian_operand_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_armv7_endian_operand_finalize;
+
+ operand->compare = (operand_compare_fc)g_armv7_endian_operand_compare;
+ operand->print = (operand_print_fc)g_armv7_endian_operand_print;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance d'affichage de boutisme. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_endian_operand_init(GArmV7EndianOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_endian_operand_dispose(GArmV7EndianOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_endian_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_endian_operand_finalize(GArmV7EndianOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_endian_operand_parent_class)->finalize(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un opérande avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_armv7_endian_operand_compare(const GArmV7EndianOperand *a, const GArmV7EndianOperand *b)
+{
+ int result; /* Bilan à faire remonter */
+
+ result = sort_boolean(a->big, b->big);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_endian_operand_print(const GArmV7EndianOperand *operand, GBufferLine *line, AsmSyntax syntax)
+{
+ if (operand->big)
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "BE", 2, RTT_KEY_WORD, NULL);
+ else
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "LE", 2, RTT_KEY_WORD, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : big = indication sur le boutisme à représenter. *
+* *
+* Description : Crée une représentation de boutisme ARMv7. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_endian_operand_new(bool big)
+{
+ GArmV7EndianOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_ENDIAN_OPERAND, NULL);
+
+ result->big = big;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Indique le type de boutisme représenté. *
+* *
+* Retour : Type de boutisme. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_armv7_endian_operand_is_big_endian(const GArmV7EndianOperand *operand)
+{
+ return operand->big;
+
+}
diff --git a/plugins/arm/v7/operands/estate.h b/plugins/arm/v7/operands/estate.h
new file mode 100644
index 0000000..6407ed1
--- /dev/null
+++ b/plugins/arm/v7/operands/estate.h
@@ -0,0 +1,61 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * estate.h - prototypes pour le basculement de boutisme
+ *
+ * Copyright (C) 2016-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_OPERANDS_ESTATE_H
+#define _PLUGINS_ARM_V7_OPERANDS_ESTATE_H
+
+
+#include <glib-object.h>
+
+
+#include <arch/operand.h>
+
+
+
+#define G_TYPE_ARMV7_ENDIAN_OPERAND g_armv7_endian_operand_get_type()
+#define G_ARMV7_ENDIAN_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv7_endian_operand_get_type(), GArmV7EndianOperand))
+#define G_IS_ARMV7_ENDIAN_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv7_endian_operand_get_type()))
+#define G_ARMV7_ENDIAN_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_ENDIAN_OPERAND, GArmV7EndianOperandClass))
+#define G_IS_ARMV7_ENDIAN_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_ENDIAN_OPERAND))
+#define G_ARMV7_ENDIAN_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_ENDIAN_OPERAND, GArmV7EndianOperandClass))
+
+
+/* Définition d'un opérande affichant le choix d'un boutisme (instance) */
+typedef struct _GArmV7EndianOperand GArmV7EndianOperand;
+
+/* Définition d'un opérande affichant le choix d'un boutisme (classe) */
+typedef struct _GArmV7EndianOperandClass GArmV7EndianOperandClass;
+
+
+/* Indique le type défini par la GLib pour une endian de domaine et d'accès. */
+GType g_armv7_endian_operand_get_type(void);
+
+/* Crée une représentation de boutisme ARMv7. */
+GArchOperand *g_armv7_endian_operand_new(bool);
+
+/* Indique le type de boutisme représenté. */
+bool g_armv7_endian_operand_is_big_endian(const GArmV7EndianOperand *);
+
+
+
+#endif /* _PLUGINS_ARM_V7_OPERANDS_ESTATE_H */
diff --git a/plugins/arm/v7/operands/limitation.c b/plugins/arm/v7/operands/limitation.c
new file mode 100644
index 0000000..1515101
--- /dev/null
+++ b/plugins/arm/v7/operands/limitation.c
@@ -0,0 +1,287 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * limitation.c - décallages de valeurs
+ *
+ * Copyright (C) 2016-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "limitation.h"
+
+
+#include <arch/operand-int.h>
+#include <common/sort.h>
+
+
+
+/* Définition d'un opérande déterminant une limitation de domaine et d'accès (instance) */
+struct _GArmV7LimitationOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ BarrierLimitationType type; /* Type de limitation */
+
+};
+
+
+/* Définition d'un opérande déterminant une limitation de domaine et d'accès (classe) */
+struct _GArmV7LimitationOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des co-processeurs ARM. */
+static void g_armv7_limitation_operand_class_init(GArmV7LimitationOperandClass *);
+
+/* Initialise une instance de co-processeur ARM. */
+static void g_armv7_limitation_operand_init(GArmV7LimitationOperand *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_limitation_operand_dispose(GArmV7LimitationOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_limitation_operand_finalize(GArmV7LimitationOperand *);
+
+/* Compare un opérande avec un autre. */
+static int g_armv7_limitation_operand_compare(const GArmV7LimitationOperand *, const GArmV7LimitationOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static void g_armv7_limitation_operand_print(const GArmV7LimitationOperand *, GBufferLine *, AsmSyntax);
+
+
+
+/* Indique le type défini par la GLib pour une limitation de domaine et d'accès. */
+G_DEFINE_TYPE(GArmV7LimitationOperand, g_armv7_limitation_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des limitations de domaine et d'accès. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_limitation_operand_class_init(GArmV7LimitationOperandClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchOperandClass *operand; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+ operand = G_ARCH_OPERAND_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_limitation_operand_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_armv7_limitation_operand_finalize;
+
+ operand->compare = (operand_compare_fc)g_armv7_limitation_operand_compare;
+ operand->print = (operand_print_fc)g_armv7_limitation_operand_print;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance de limitation de domaine et d'accès. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_limitation_operand_init(GArmV7LimitationOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_limitation_operand_dispose(GArmV7LimitationOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_limitation_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_limitation_operand_finalize(GArmV7LimitationOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_limitation_operand_parent_class)->finalize(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un opérande avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_armv7_limitation_operand_compare(const GArmV7LimitationOperand *a, const GArmV7LimitationOperand *b)
+{
+ int result; /* Bilan à faire remonter */
+
+ result = sort_unsigned_long(a->type, b->type);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_limitation_operand_print(const GArmV7LimitationOperand *operand, GBufferLine *line, AsmSyntax syntax)
+{
+ switch (operand->type)
+ {
+ case BLT_SY:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "SY", 2, RTT_KEY_WORD, NULL);
+ break;
+
+ case BLT_ST:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "ST", 2, RTT_KEY_WORD, NULL);
+ break;
+
+ case BLT_ISH:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "ISH", 3, RTT_KEY_WORD, NULL);
+ break;
+
+ case BLT_ISHST:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "ISHST", 5, RTT_KEY_WORD, NULL);
+ break;
+
+ case BLT_NSH:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "NSH", 3, RTT_KEY_WORD, NULL);
+ break;
+
+ case BLT_NSHST:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "NSHST", 5, RTT_KEY_WORD, NULL);
+ break;
+
+ case BLT_OSH:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "OSH", 3, RTT_KEY_WORD, NULL);
+ break;
+
+ case BLT_OSHST:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "OSHST", 5, RTT_KEY_WORD, NULL);
+ break;
+
+ default:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "(reserved)", 10, RTT_KEY_WORD, NULL);
+ break;
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : raw = valeur brute de la limitation à considérer. *
+* *
+* Description : Crée une représentation d'une limitation pour barrière. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_limitation_operand_new(uint8_t raw)
+{
+ GArmV7LimitationOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_LIMITATION_OPERAND, NULL);
+
+ if (raw < 0b0010 || raw > 0b1111)
+ result->type = BLT_RESERVED;
+
+ else
+ result->type = raw;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Indique le type de limitation représentée. *
+* *
+* Retour : Type de limitation d'accès et de domaine. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+BarrierLimitationType g_armv7_limitation_operand_get_value(const GArmV7LimitationOperand *operand)
+{
+ return operand->type;
+
+}
diff --git a/plugins/arm/v7/operands/limitation.h b/plugins/arm/v7/operands/limitation.h
new file mode 100644
index 0000000..2a2b52d
--- /dev/null
+++ b/plugins/arm/v7/operands/limitation.h
@@ -0,0 +1,77 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * limitation.h - prototypes pour les décallages de valeurs
+ *
+ * Copyright (C) 2016-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_OPERANDS_LIMITATION_H
+#define _PLUGINS_ARM_V7_OPERANDS_LIMITATION_H
+
+
+#include <glib-object.h>
+
+
+#include <arch/operand.h>
+
+
+
+#define G_TYPE_ARMV7_LIMITATION_OPERAND g_armv7_limitation_operand_get_type()
+#define G_ARMV7_LIMITATION_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv7_limitation_operand_get_type(), GArmV7LimitationOperand))
+#define G_IS_ARMV7_LIMITATION_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv7_limitation_operand_get_type()))
+#define G_ARMV7_LIMITATION_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_LIMITATION_OPERAND, GArmV7LimitationOperandClass))
+#define G_IS_ARMV7_LIMITATION_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_LIMITATION_OPERAND))
+#define G_ARMV7_LIMITATION_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_LIMITATION_OPERAND, GArmV7LimitationOperandClass))
+
+
+/* Définition d'un opérande déterminant une limitation de domaine et d'accès (instance) */
+typedef struct _GArmV7LimitationOperand GArmV7LimitationOperand;
+
+/* Définition d'un opérande déterminant une limitation de domaine et d'accès (classe) */
+typedef struct _GArmV7LimitationOperandClass GArmV7LimitationOperandClass;
+
+
+/* Types de limitation domaine & accès */
+typedef enum _BarrierLimitationType
+{
+ BLT_RESERVED = 0,
+ BLT_SY = 0b1111,
+ BLT_ST = 0b1110,
+ BLT_ISH = 0b1011,
+ BLT_ISHST = 0b1010,
+ BLT_NSH = 0b0111,
+ BLT_NSHST = 0b0110,
+ BLT_OSH = 0b0011,
+ BLT_OSHST = 0b0010
+
+} BarrierLimitationType;
+
+
+/* Indique le type défini par la GLib pour une limitation de domaine et d'accès. */
+GType g_armv7_limitation_operand_get_type(void);
+
+/* Crée une représentation d'une limitation pour barrière. */
+GArchOperand *g_armv7_limitation_operand_new(uint8_t);
+
+/* Indique le type de limitation représentée. */
+BarrierLimitationType g_armv7_limitation_operand_get_value(const GArmV7LimitationOperand *);
+
+
+
+#endif /* _PLUGINS_ARM_V7_OPERANDS_LIMITATION_H */
diff --git a/plugins/arm/v7/operands/maccess.c b/plugins/arm/v7/operands/maccess.c
new file mode 100644
index 0000000..07192b2
--- /dev/null
+++ b/plugins/arm/v7/operands/maccess.c
@@ -0,0 +1,385 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * maccess.c - accès à la mémorie à partir d'un registre et d'un décallage
+ *
+ * Copyright (C) 2014-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "maccess.h"
+
+
+#include <arch/operand-int.h>
+#include <common/sort.h>
+
+
+
+/* Définition d'un opérande offrant un accès à la mémoire depuis une base (instance) */
+struct _GArmV7MAccessOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ GArchOperand *base; /* Base de l'accès en mémoire */
+ GArchOperand *offset; /* Décallage pour l'adresse */
+ GArchOperand *shift; /* Décallage pour le décallage */
+ bool not_post_indexed; /* Positio du décallage */
+ bool write_back; /* Mise à jour de la base */
+
+};
+
+
+/* Définition d'un opérande offrant un accès à la mémoire depuis une base (classe) */
+struct _GArmV7MAccessOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des accès à la mémoire chez ARM. */
+static void g_armv7_maccess_operand_class_init(GArmV7MAccessOperandClass *);
+
+/* Initialise une instance d'accès à la mémoire chez ARM. */
+static void g_armv7_maccess_operand_init(GArmV7MAccessOperand *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_maccess_operand_dispose(GArmV7MAccessOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_maccess_operand_finalize(GArmV7MAccessOperand *);
+
+/* Compare un opérande avec un autre. */
+static int g_armv7_maccess_operand_compare(const GArmV7MAccessOperand *, const GArmV7MAccessOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static void g_armv7_maccess_operand_print(const GArmV7MAccessOperand *, GBufferLine *, AsmSyntax);
+
+
+
+/* Indique le type défini par la GLib pour un accès à la mémoire depuis une base. */
+G_DEFINE_TYPE(GArmV7MAccessOperand, g_armv7_maccess_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des accès à la mémoire chez ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_maccess_operand_class_init(GArmV7MAccessOperandClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchOperandClass *operand; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+ operand = G_ARCH_OPERAND_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_maccess_operand_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_armv7_maccess_operand_finalize;
+
+ operand->compare = (operand_compare_fc)g_armv7_maccess_operand_compare;
+ operand->print = (operand_print_fc)g_armv7_maccess_operand_print;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance d'accès à la mémoire chez ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_maccess_operand_init(GArmV7MAccessOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_maccess_operand_dispose(GArmV7MAccessOperand *operand)
+{
+ g_object_unref(G_OBJECT(operand->base));
+
+ if (operand->offset != NULL)
+ g_object_unref(G_OBJECT(operand->offset));
+
+ if (operand->shift != NULL)
+ g_object_unref(G_OBJECT(operand->shift));
+
+ G_OBJECT_CLASS(g_armv7_maccess_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_maccess_operand_finalize(GArmV7MAccessOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_maccess_operand_parent_class)->finalize(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un opérande avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_armv7_maccess_operand_compare(const GArmV7MAccessOperand *a, const GArmV7MAccessOperand *b)
+{
+ int result; /* Bilan à faire remonter */
+
+ result = g_arch_operand_compare(a->base, b->base);
+ if (result != 0) goto gamoc_done;
+
+ result = sort_pointer(a->offset, b->offset, (__compar_fn_t)g_arch_operand_compare);
+ if (result != 0) goto gamoc_done;
+
+ result = sort_pointer(a->shift, b->shift, (__compar_fn_t)g_arch_operand_compare);
+ if (result != 0) goto gamoc_done;
+
+ result = sort_boolean(a->not_post_indexed, b->not_post_indexed);
+ if (result != 0) goto gamoc_done;
+
+ result = sort_boolean(a->write_back, b->write_back);
+
+ gamoc_done:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_maccess_operand_print(const GArmV7MAccessOperand *operand, GBufferLine *line, AsmSyntax syntax)
+{
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "[", 1, RTT_HOOK, NULL);
+
+ g_arch_operand_print(operand->base, line, syntax);
+
+ if (!operand->not_post_indexed)
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "]", 1, RTT_HOOK, NULL);
+
+ if (operand->offset != NULL)
+ {
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, ",", 1, RTT_PUNCT, NULL);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW, NULL);
+
+ g_arch_operand_print(operand->offset, line, syntax);
+
+ }
+
+ if (operand->shift != NULL)
+ {
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, ",", 1, RTT_PUNCT, NULL);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW, NULL);
+
+ g_arch_operand_print(operand->shift, line, syntax);
+
+ }
+
+ if (operand->not_post_indexed)
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "]", 1, RTT_HOOK, NULL);
+
+ if (operand->write_back)
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "!", 1, RTT_PUNCT, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : base = représente le registre de la base d'accès. *
+* offset = détermine le décallage entre l'adresse et la base. *
+* shift = opération de décallage pour jouer sur le décallage.*
+* indexed = précise la forme donnée au décallage à appliquer. *
+* wback = indique une mise à jour de la base après usage. *
+* *
+* Description : Crée un accès à la mémoire depuis une base et un décallage. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_maccess_operand_new(GArchOperand *base, GArchOperand *offset, GArchOperand *shift, bool indexed, bool wback)
+{
+ GArmV7MAccessOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_MACCESS_OPERAND, NULL);
+
+ result->base = base;
+ result->offset = offset;
+ result->shift = shift;
+
+ result->not_post_indexed = indexed;
+ result->write_back = wback;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Founit la base d'un accès à la mémoire. *
+* *
+* Retour : Opérande en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_maccess_operand_get_base(const GArmV7MAccessOperand *operand)
+{
+ return operand->base;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Founit le décallage d'un accès à la mémoire depuis la base. *
+* *
+* Retour : Opérande en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_maccess_operand_get_offset(const GArmV7MAccessOperand *operand)
+{
+ return operand->offset;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Founit le décallage d'un décallage pour un accès mémoire. *
+* *
+* Retour : Opérande en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_maccess_operand_get_shift(const GArmV7MAccessOperand *operand)
+{
+ return operand->shift;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Indique si le décallage est post-indexé. *
+* *
+* Retour : Statut des opérations menées. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_armv7_maccess_operand_is_post_indexed(const GArmV7MAccessOperand *operand)
+{
+ return !operand->not_post_indexed;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Indique si la base est mise à jour après usage. *
+* *
+* Retour : Statut des opérations menées. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_armv7_maccess_operand_has_to_write_back(const GArmV7MAccessOperand *operand)
+{
+ return operand->write_back;
+
+}
diff --git a/plugins/arm/v7/operands/maccess.h b/plugins/arm/v7/operands/maccess.h
new file mode 100644
index 0000000..25cbe9e
--- /dev/null
+++ b/plugins/arm/v7/operands/maccess.h
@@ -0,0 +1,77 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * maccess.h - prototypes pour les accès à la mémorie à partir d'un registre et d'un décallage
+ *
+ * Copyright (C) 2014-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_OPERANDS_MACCESS_H
+#define _PLUGINS_ARM_V7_OPERANDS_MACCESS_H
+
+
+#include <glib-object.h>
+#include <stdbool.h>
+
+
+#include <arch/operand.h>
+
+
+#include "../pseudo.h"
+
+
+
+#define G_TYPE_ARMV7_MACCESS_OPERAND g_armv7_maccess_operand_get_type()
+#define G_ARMV7_MACCESS_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv7_maccess_operand_get_type(), GArmV7MAccessOperand))
+#define G_IS_ARMV7_MACCESS_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv7_maccess_operand_get_type()))
+#define G_ARMV7_MACCESS_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_MACCESS_OPERAND, GArmV7MAccessOperandClass))
+#define G_IS_ARMV7_MACCESS_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_MACCESS_OPERAND))
+#define G_ARMV7_MACCESS_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_MACCESS_OPERAND, GArmV7MAccessOperandClass))
+
+
+/* Définition d'un opérande offrant un accès à la mémoire depuis une base (instance) */
+typedef struct _GArmV7MAccessOperand GArmV7MAccessOperand;
+
+/* Définition d'un opérande offrant un accès à la mémoire depuis une base (classe) */
+typedef struct _GArmV7MAccessOperandClass GArmV7MAccessOperandClass;
+
+
+/* Indique le type défini par la GLib pour un accès à la mémoire depuis une base. */
+GType g_armv7_maccess_operand_get_type(void);
+
+/* Crée un accès à la mémoire depuis une base et un décallage. */
+GArchOperand *g_armv7_maccess_operand_new(GArchOperand *, GArchOperand *, GArchOperand *, bool, bool);
+
+/* Founit la base d'un accès à la mémoire. */
+GArchOperand *g_armv7_maccess_operand_get_base(const GArmV7MAccessOperand *);
+
+/* Founit le décallage d'un accès à la mémoire depuis la base. */
+GArchOperand *g_armv7_maccess_operand_get_offset(const GArmV7MAccessOperand *);
+
+/* Founit le décallage d'un décallage pour un accès mémoire. */
+GArchOperand *g_armv7_maccess_operand_get_shift(const GArmV7MAccessOperand *);
+
+/* Indique si le décallage est post-indexé. */
+bool g_armv7_maccess_operand_is_post_indexed(const GArmV7MAccessOperand *);
+
+/* Indique si la base est mise à jour après usage. */
+bool g_armv7_maccess_operand_has_to_write_back(const GArmV7MAccessOperand *);
+
+
+
+#endif /* _PLUGINS_ARM_V7_OPERANDS_MACCESS_H */
diff --git a/plugins/arm/v7/operands/offset.c b/plugins/arm/v7/operands/offset.c
new file mode 100644
index 0000000..5b0b1f0
--- /dev/null
+++ b/plugins/arm/v7/operands/offset.c
@@ -0,0 +1,283 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * offset.c - constitution d'un décallage positif ou négatif
+ *
+ * Copyright (C) 2014-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "offset.h"
+
+
+#include <arch/operand-int.h>
+#include <common/sort.h>
+
+
+
+/* Définition d'un opérande visant à constituer un décallage relatif ARMv7 (instance) */
+struct _GArmV7OffsetOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ bool positive; /* Sens du décallage */
+ GArchOperand *value; /* Valeur du décallage */
+
+};
+
+
+/* Définition d'un opérande visant à constituer un décallage relatif ARMv7 (classe) */
+struct _GArmV7OffsetOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des décallages relatifs ARMv7. */
+static void g_armv7_offset_operand_class_init(GArmV7OffsetOperandClass *);
+
+/* Initialise une instance de décallage relatif ARMv7. */
+static void g_armv7_offset_operand_init(GArmV7OffsetOperand *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_offset_operand_dispose(GArmV7OffsetOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+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 *);
+
+/* Traduit un opérande en version humainement lisible. */
+static void g_armv7_offset_operand_print(const GArmV7OffsetOperand *, GBufferLine *, AsmSyntax);
+
+
+
+/* Indique le type défini par la GLib pour un décallage relatif ARMv7. */
+G_DEFINE_TYPE(GArmV7OffsetOperand, g_armv7_offset_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des décallages relatifs ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_offset_operand_class_init(GArmV7OffsetOperandClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ 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->compare = (operand_compare_fc)g_armv7_offset_operand_compare;
+ operand->print = (operand_print_fc)g_armv7_offset_operand_print;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance de décallage relatif ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_offset_operand_init(GArmV7OffsetOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_offset_operand_dispose(GArmV7OffsetOperand *operand)
+{
+ g_object_unref(G_OBJECT(operand->value));
+
+ G_OBJECT_CLASS(g_armv7_offset_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_offset_operand_finalize(GArmV7OffsetOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_offset_operand_parent_class)->finalize(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un opérande avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_armv7_offset_operand_compare(const GArmV7OffsetOperand *a, const GArmV7OffsetOperand *b)
+{
+ int result; /* Bilan à faire remonter */
+
+ result = sort_boolean(a->positive, b->positive);
+ if (result != 0) goto gaooc_done;
+
+ result = g_arch_operand_compare(a->value, b->value);
+
+ gaooc_done:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_offset_operand_print(const GArmV7OffsetOperand *operand, GBufferLine *line, AsmSyntax syntax)
+{
+ if (!operand->positive)
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "-", 1, RTT_KEY_WORD, NULL);
+
+ g_arch_operand_print(operand->value, line, syntax);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : positive = indique si la quantité doit être ajoutée ou non. *
+* value = valeur du décallage à appliquer. *
+* *
+* Description : Crée un décallage selon un sens et une valeur donnés. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_offset_operand_new(bool positive, GArchOperand *value)
+{
+ GArmV7OffsetOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_OFFSET_OPERAND, NULL);
+
+ result->positive = positive;
+ result->value = value;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Indique le sens du décallage représenté. *
+* *
+* Retour : Indication d'ajout ou de retrait. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_armv7_offset_operand_is_positive(const GArmV7OffsetOperand *operand)
+{
+ return operand->positive;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Founit la valeur utilisée pour un décallage. *
+* *
+* Retour : Opérande en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_offset_operand_get_value(const GArmV7OffsetOperand *operand)
+{
+ GArchOperand *result; /* Instance à retourner */
+
+ result = operand->value;
+
+ g_object_ref(G_OBJECT(result));
+
+ return result;
+
+}
diff --git a/plugins/arm/v7/operands/offset.h b/plugins/arm/v7/operands/offset.h
new file mode 100644
index 0000000..e5f967e
--- /dev/null
+++ b/plugins/arm/v7/operands/offset.h
@@ -0,0 +1,68 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * offset.h - prototypes pour la constitution d'un décallage positif ou négatif
+ *
+ * Copyright (C) 2014-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_OPERANDS_OFFSET_H
+#define _PLUGINS_ARM_V7_OPERANDS_OFFSET_H
+
+
+#include <glib-object.h>
+#include <stdbool.h>
+
+
+#include <arch/operand.h>
+
+
+#include "../pseudo.h"
+
+
+
+#define G_TYPE_ARMV7_OFFSET_OPERAND g_armv7_offset_operand_get_type()
+#define G_ARMV7_OFFSET_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv7_offset_operand_get_type(), GArmV7OffsetOperand))
+#define G_IS_ARMV7_OFFSET_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv7_offset_operand_get_type()))
+#define G_ARMV7_OFFSET_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_OFFSET_OPERAND, GArmV7OffsetOperandClass))
+#define G_IS_ARMV7_OFFSET_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_OFFSET_OPERAND))
+#define G_ARMV7_OFFSET_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_OFFSET_OPERAND, GArmV7OffsetOperandClass))
+
+
+/* Définition d'un opérande visant à constituer un décallage relatif ARMv7 (instance) */
+typedef struct _GArmV7OffsetOperand GArmV7OffsetOperand;
+
+/* Définition d'un opérande visant à constituer un décallage relatif ARMv7 (classe) */
+typedef struct _GArmV7OffsetOperandClass GArmV7OffsetOperandClass;
+
+
+/* Indique le type défini par la GLib pour un décallage relatif ARMv7. */
+GType g_armv7_offset_operand_get_type(void);
+
+/* Crée un décallage selon un sens et une valeur donnés. */
+GArchOperand *g_armv7_offset_operand_new(bool, GArchOperand *);
+
+/* Indique le sens du décallage représenté. */
+bool g_armv7_offset_operand_is_positive(const GArmV7OffsetOperand *);
+
+/* Founit la valeur utilisée pour un décallage. */
+GArchOperand *g_armv7_offset_operand_get_value(const GArmV7OffsetOperand *);
+
+
+
+#endif /* _PLUGINS_ARM_V7_OPERANDS_OFFSET_H */
diff --git a/plugins/arm/v7/operands/reglist.c b/plugins/arm/v7/operands/reglist.c
new file mode 100644
index 0000000..25981eb
--- /dev/null
+++ b/plugins/arm/v7/operands/reglist.c
@@ -0,0 +1,376 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * reglist.c - accès à la mémorie à partir d'un registre et d'un décallage
+ *
+ * Copyright (C) 2014-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "reglist.h"
+
+
+#include <assert.h>
+#include <malloc.h>
+
+
+#include <arch/operand-int.h>
+#include <arch/register.h>
+#include <common/sort.h>
+
+
+
+/* Définition d'un opérande listant une série de registres ARM (instance) */
+struct _GArmV7RegListOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ GArmV7Register **registers; /* Liste de registres intégrés */
+ size_t count; /* Taille de cette liste */
+
+};
+
+
+/* Définition d'un opérande listant une série de registres ARM (classe) */
+struct _GArmV7RegListOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des listes de registres ARM. */
+static void g_armv7_reglist_operand_class_init(GArmV7RegListOperandClass *);
+
+/* Initialise une instance de liste de registres ARM. */
+static void g_armv7_reglist_operand_init(GArmV7RegListOperand *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_reglist_operand_dispose(GArmV7RegListOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_reglist_operand_finalize(GArmV7RegListOperand *);
+
+/* Compare un opérande avec un autre. */
+static int g_armv7_reglist_operand_compare(const GArmV7RegListOperand *, const GArmV7RegListOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static void g_armv7_reglist_operand_print(const GArmV7RegListOperand *, GBufferLine *, AsmSyntax);
+
+
+
+/* Indique le type défini par la GLib pour une liste de registres ARM. */
+G_DEFINE_TYPE(GArmV7RegListOperand, g_armv7_reglist_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des listes de registres ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_reglist_operand_class_init(GArmV7RegListOperandClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchOperandClass *operand; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+ operand = G_ARCH_OPERAND_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_reglist_operand_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_armv7_reglist_operand_finalize;
+
+ operand->compare = (operand_compare_fc)g_armv7_reglist_operand_compare;
+ operand->print = (operand_print_fc)g_armv7_reglist_operand_print;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance de liste de registres ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_reglist_operand_init(GArmV7RegListOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_reglist_operand_dispose(GArmV7RegListOperand *operand)
+{
+ size_t i; /* Boucle de parcours */
+
+ for (i = 0; i < operand->count; i++)
+ g_object_unref(G_OBJECT(operand->registers[i]));
+
+ G_OBJECT_CLASS(g_armv7_reglist_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_reglist_operand_finalize(GArmV7RegListOperand *operand)
+{
+ if (operand->registers != NULL)
+ free(operand->registers);
+
+ G_OBJECT_CLASS(g_armv7_reglist_operand_parent_class)->finalize(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un opérande avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_armv7_reglist_operand_compare(const GArmV7RegListOperand *a, const GArmV7RegListOperand *b)
+{
+ int result; /* Bilan à faire remonter */
+ size_t i; /* Boucle de parcours */
+ GArchRegister *ra; /* Registre de la liste A */
+ GArchRegister *rb; /* Registre de la liste B */
+
+ /* Création de l'objet... */
+ if (b == NULL)
+ {
+ result = 1;
+ goto garoc_done;
+ }
+
+ result = sort_unsigned_long(a->count, b->count);
+ if (result != 0) goto garoc_done;
+
+ for (i = 0; i < a->count && result == 0; i++)
+ {
+ ra = G_ARCH_REGISTER(a->registers[i]);
+ rb = G_ARCH_REGISTER(b->registers[i]);
+
+ result = g_arch_register_compare(ra, rb);
+
+ }
+
+ garoc_done:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_reglist_operand_print(const GArmV7RegListOperand *operand, GBufferLine *line, AsmSyntax syntax)
+{
+ size_t i; /* Boucle de parcours */
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "{", 1, RTT_HOOK, NULL);
+
+ for (i = 0; i < operand->count; i++)
+ {
+ if (i > 0)
+ {
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, ",", 1, RTT_PUNCT, NULL);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW, NULL);
+ }
+
+ g_arch_register_print(G_ARCH_REGISTER(operand->registers[i]), line, syntax);
+
+ }
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "}", 1, RTT_HOOK, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée une liste vierge de registres ARM. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_reglist_operand_new(void)
+{
+ GArchOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_REGLIST_OPERAND, NULL);
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = liste de registres à compléter. *
+* selected = masque de bits pour les registres à intégrer. *
+* *
+* Description : Remplit une liste de registres de registres ARM. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_armv7_reglist_load_registers(GArmV7RegListOperand *operand, uint32_t selected)
+{
+ uint8_t i; /* Boucle de parcours */
+ GArmV7Register *reg; /* Nouveau registre à intégrer */
+
+ for (i = 18; i < 32; i++)
+ if (selected & (1 << i)) return false;
+
+ for (i = 0; i < 18; i++)
+ {
+ if ((selected & (1 << i)) == 0) continue;
+
+ reg = g_armv7_register_new(i);
+ g_armv7_reglist_add_register(operand, reg);
+
+ }
+
+ return true;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = liste de registres à compléter. *
+* reg = nouveau registre à intégrer. *
+* *
+* Description : Ajoute un registre à une liste de registres ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_armv7_reglist_add_register(GArmV7RegListOperand *operand, GArmV7Register *reg)
+{
+ operand->registers = (GArmV7Register **)realloc(operand->registers,
+ ++operand->count * sizeof(GArmV7Register *));
+
+ operand->registers[operand->count - 1] = reg;
+
+}
+
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Compte le nombre de registres ARM composant la liste. *
+* *
+* Retour : Nombre positif ou nul. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+size_t g_armv7_reglist_count_registers(const GArmV7RegListOperand *operand)
+{
+ return operand->count;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* index = indice de l'élément à fournier. *
+* *
+* Description : Founit un élément donné d'une liste de registres ARM. *
+* *
+* Retour : Registre intégré à la liste manipulée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArmV7Register *g_armv7_reglist_operand_get_register(const GArmV7RegListOperand *operand, size_t index)
+{
+ assert(index < operand->count);
+
+ return operand->registers[index];
+
+}
diff --git a/plugins/arm/v7/operands/reglist.h b/plugins/arm/v7/operands/reglist.h
new file mode 100644
index 0000000..5cba197
--- /dev/null
+++ b/plugins/arm/v7/operands/reglist.h
@@ -0,0 +1,74 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * reglist.h - prototypes pour les accès à la mémorie à partir d'un registre et d'un décallage
+ *
+ * Copyright (C) 2014-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_OPERANDS_REGLIST_H
+#define _PLUGINS_ARM_V7_OPERANDS_REGLIST_H
+
+
+#include <glib-object.h>
+#include <stdbool.h>
+
+
+#include <arch/operand.h>
+
+
+#include "../register.h"
+
+
+
+#define G_TYPE_ARMV7_REGLIST_OPERAND g_armv7_reglist_operand_get_type()
+#define G_ARMV7_REGLIST_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv7_reglist_operand_get_type(), GArmV7RegListOperand))
+#define G_IS_ARMV7_REGLIST_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv7_reglist_operand_get_type()))
+#define G_ARMV7_REGLIST_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_REGLIST_OPERAND, GArmV7RegListOperandClass))
+#define G_IS_ARMV7_REGLIST_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_REGLIST_OPERAND))
+#define G_ARMV7_REGLIST_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_REGLIST_OPERAND, GArmV7RegListOperandClass))
+
+
+/* Définition d'un opérande listant une série de registres ARM (instance) */
+typedef struct _GArmV7RegListOperand GArmV7RegListOperand;
+
+/* Définition d'un opérande listant une série de registres ARM (classe) */
+typedef struct _GArmV7RegListOperandClass GArmV7RegListOperandClass;
+
+
+/* Indique le type défini par la GLib pour une liste de registres ARM. */
+GType g_armv7_reglist_operand_get_type(void);
+
+/* Crée une liste vierge de registres ARM. */
+GArchOperand *g_armv7_reglist_operand_new(void);
+
+/* Remplit une liste de registres de registres ARM. */
+bool g_armv7_reglist_load_registers(GArmV7RegListOperand *, uint32_t);
+
+/* Ajoute un registre à une liste de registres ARM. */
+void g_armv7_reglist_add_register(GArmV7RegListOperand *, GArmV7Register *);
+
+/* Compte le nombre de registres ARM composant la liste. */
+size_t g_armv7_reglist_count_registers(const GArmV7RegListOperand *);
+
+/* Founit un élément donné d'une liste de registres ARM. */
+GArmV7Register *g_armv7_reglist_operand_get_register(const GArmV7RegListOperand *, size_t );
+
+
+
+#endif /* _PLUGINS_ARM_V7_OPERANDS_REGLIST_H */
diff --git a/plugins/arm/v7/operands/rotation.c b/plugins/arm/v7/operands/rotation.c
new file mode 100644
index 0000000..3858426
--- /dev/null
+++ b/plugins/arm/v7/operands/rotation.c
@@ -0,0 +1,256 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * rotation.c - rotations de valeurs
+ *
+ * Copyright (C) 2015-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "rotation.h"
+
+
+#include <arch/operand-int.h>
+
+
+
+/* Définition d'un opérande visant une opérande de rotation ARMv7 (instance) */
+struct _GArmV7RotationOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ GArchOperand *value; /* Valeur du décallage */
+
+};
+
+
+/* Définition d'un opérande visant une opérande de rotation ARMv7 (classe) */
+struct _GArmV7RotationOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des opérandes de rotation ARMv7. */
+static void g_armv7_rotation_operand_class_init(GArmV7RotationOperandClass *);
+
+/* Initialise une instance d'opérande de rotation ARMv7. */
+static void g_armv7_rotation_operand_init(GArmV7RotationOperand *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_rotation_operand_dispose(GArmV7RotationOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_rotation_operand_finalize(GArmV7RotationOperand *);
+
+/* Compare un opérande avec un autre. */
+static int g_armv7_rotation_operand_compare(const GArmV7RotationOperand *, const GArmV7RotationOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static void g_armv7_rotation_operand_print(const GArmV7RotationOperand *, GBufferLine *, AsmSyntax);
+
+
+
+/* Indique le type défini par la GLib pour une opérande de rotation ARMv7. */
+G_DEFINE_TYPE(GArmV7RotationOperand, g_armv7_rotation_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des opérandes de rotation ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_rotation_operand_class_init(GArmV7RotationOperandClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchOperandClass *operand; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+ operand = G_ARCH_OPERAND_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_rotation_operand_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_armv7_rotation_operand_finalize;
+
+ operand->compare = (operand_compare_fc)g_armv7_rotation_operand_compare;
+ operand->print = (operand_print_fc)g_armv7_rotation_operand_print;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance d'opérande de rotation ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_rotation_operand_init(GArmV7RotationOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_rotation_operand_dispose(GArmV7RotationOperand *operand)
+{
+ g_object_unref(G_OBJECT(operand->value));
+
+ G_OBJECT_CLASS(g_armv7_rotation_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_rotation_operand_finalize(GArmV7RotationOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_rotation_operand_parent_class)->finalize(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un opérande avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_armv7_rotation_operand_compare(const GArmV7RotationOperand *a, const GArmV7RotationOperand *b)
+{
+ int result; /* Bilan à faire remonter */
+
+ result = g_arch_operand_compare(a->value, b->value);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_rotation_operand_print(const GArmV7RotationOperand *operand, GBufferLine *line, AsmSyntax syntax)
+{
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "ror", 3, RTT_KEY_WORD, NULL);
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW, NULL);
+
+ g_arch_operand_print(operand->value, line, syntax);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un réceptacle pour opérandes de rotation ARMv7. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_rotation_operand_new(GArchOperand *value)
+{
+ GArmV7RotationOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_ROTATION_OPERAND, NULL);
+
+ result->value = value;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Founit la valeur utilisée pour une rotation. *
+* *
+* Retour : Opérande en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_rotation_operand_get_value(const GArmV7RotationOperand *operand)
+{
+ GArchOperand *result; /* Instance à retourner */
+
+ result = operand->value;
+
+ g_object_ref(G_OBJECT(result));
+
+ return result;
+
+}
diff --git a/plugins/arm/v7/operands/rotation.h b/plugins/arm/v7/operands/rotation.h
new file mode 100644
index 0000000..952f0e4
--- /dev/null
+++ b/plugins/arm/v7/operands/rotation.h
@@ -0,0 +1,61 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * rotation.h - prototypes pour les rotations de valeurs
+ *
+ * Copyright (C) 2015-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_OPERANDS_ROTATION_H
+#define _PLUGINS_ARM_V7_OPERANDS_ROTATION_H
+
+
+#include <glib-object.h>
+
+
+#include <arch/operand.h>
+
+
+
+#define G_TYPE_ARMV7_ROTATION_OPERAND g_armv7_rotation_operand_get_type()
+#define G_ARMV7_ROTATION_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv7_rotation_operand_get_type(), GArmV7RotationOperand))
+#define G_IS_ARMV7_ROTATION_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv7_rotation_operand_get_type()))
+#define G_ARMV7_ROTATION_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_ROTATION_OPERAND, GArmV7RotationOperandClass))
+#define G_IS_ARMV7_ROTATION_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_ROTATION_OPERAND))
+#define G_ARMV7_ROTATION_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_ROTATION_OPERAND, GArmV7RotationOperandClass))
+
+
+/* Définition d'un opérande visant une opérande de rotation ARMv7 (instance) */
+typedef struct _GArmV7RotationOperand GArmV7RotationOperand;
+
+/* Définition d'un opérande visant une opérande de rotation ARMv7 (classe) */
+typedef struct _GArmV7RotationOperandClass GArmV7RotationOperandClass;
+
+
+/* Indique le type défini par la GLib pour une opérande de rotation ARMv7. */
+GType g_armv7_rotation_operand_get_type(void);
+
+/* Crée un réceptacle pour opérandes de rotation ARMv7. */
+GArchOperand *g_armv7_rotation_operand_new(GArchOperand *);
+
+/* Founit la valeur utilisée pour une rotation. */
+GArchOperand *g_armv7_rotation_operand_get_value(const GArmV7RotationOperand *);
+
+
+
+#endif /* _PLUGINS_ARM_V7_OPERANDS_ROTATION_H */
diff --git a/plugins/arm/v7/operands/shift.c b/plugins/arm/v7/operands/shift.c
new file mode 100644
index 0000000..3dfdf12
--- /dev/null
+++ b/plugins/arm/v7/operands/shift.c
@@ -0,0 +1,300 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * shift.c - décallages de valeurs
+ *
+ * Copyright (C) 2014-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "shift.h"
+
+
+#include <arch/operand-int.h>
+#include <common/sort.h>
+
+
+
+/* Définition d'un opérande visant une opérande de décallage ARMv7 (instance) */
+struct _GArmV7ShiftOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ SRType shift_type; /* Type de décallage */
+ GArchOperand *shift_value; /* Valeur du décallage */
+
+};
+
+
+/* Définition d'un opérande visant une opérande de décallage ARMv7 (classe) */
+struct _GArmV7ShiftOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des opérandes de décallage ARMv7. */
+static void g_armv7_shift_operand_class_init(GArmV7ShiftOperandClass *);
+
+/* Initialise une instance d'opérande de décallage ARMv7. */
+static void g_armv7_shift_operand_init(GArmV7ShiftOperand *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_shift_operand_dispose(GArmV7ShiftOperand *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_shift_operand_finalize(GArmV7ShiftOperand *);
+
+/* Compare un opérande avec un autre. */
+static int g_armv7_shift_operand_compare(const GArmV7ShiftOperand *, const GArmV7ShiftOperand *);
+
+/* Traduit un opérande en version humainement lisible. */
+static void g_armv7_shift_operand_print(const GArmV7ShiftOperand *, GBufferLine *, AsmSyntax);
+
+
+
+/* Indique le type défini par la GLib pour une opérande de décallage ARMv7. */
+G_DEFINE_TYPE(GArmV7ShiftOperand, g_armv7_shift_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des opérandes de décallage ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_shift_operand_class_init(GArmV7ShiftOperandClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchOperandClass *operand; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+ operand = G_ARCH_OPERAND_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_shift_operand_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_armv7_shift_operand_finalize;
+
+ operand->compare = (operand_compare_fc)g_armv7_shift_operand_compare;
+ operand->print = (operand_print_fc)g_armv7_shift_operand_print;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance d'opérande de décallage ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_shift_operand_init(GArmV7ShiftOperand *operand)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_shift_operand_dispose(GArmV7ShiftOperand *operand)
+{
+ g_object_unref(G_OBJECT(operand->shift_value));
+
+ G_OBJECT_CLASS(g_armv7_shift_operand_parent_class)->dispose(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_shift_operand_finalize(GArmV7ShiftOperand *operand)
+{
+ G_OBJECT_CLASS(g_armv7_shift_operand_parent_class)->finalize(G_OBJECT(operand));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un opérande avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_armv7_shift_operand_compare(const GArmV7ShiftOperand *a, const GArmV7ShiftOperand *b)
+{
+ int result; /* Bilan à faire remonter */
+
+ result = sort_unsigned_long(a->shift_type, b->shift_type);
+ if (result != 0) goto gasoc_done;
+
+ result = g_arch_operand_compare(a->shift_value, b->shift_value);
+
+ gasoc_done:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un opérande en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_shift_operand_print(const GArmV7ShiftOperand *operand, GBufferLine *line, AsmSyntax syntax)
+{
+ switch (operand->shift_type)
+ {
+ case SRType_LSL:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "lsl", 3, RTT_KEY_WORD, NULL);
+ break;
+ case SRType_LSR:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "lsr", 3, RTT_KEY_WORD, NULL);
+ break;
+ case SRType_ASR:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "asr", 3, RTT_KEY_WORD, NULL);
+ break;
+ case SRType_ROR:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "ror", 3, RTT_KEY_WORD, NULL);
+ break;
+ case SRType_RRX:
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, "rrx", 3, RTT_KEY_WORD, NULL);
+ break;
+ }
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW, NULL);
+
+ g_arch_operand_print(operand->shift_value, line, syntax);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un réceptacle pour opérande de décallage ARMv7. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_shift_operand_new(SRType type, GArchOperand *value)
+{
+ GArmV7ShiftOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_SHIFT_OPERAND, NULL);
+
+ result->shift_type = type;
+ result->shift_value = value;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Indique la forme de décallage représenté. *
+* *
+* Retour : Type de décallage. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+SRType g_armv7_shift_operand_get_shift_type(const GArmV7ShiftOperand *operand)
+{
+ return operand->shift_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
+* Description : Founit la valeur utilisée pour un décallage. *
+* *
+* Retour : Opérande en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_armv7_shift_operand_get_shift_value(const GArmV7ShiftOperand *operand)
+{
+ GArchOperand *result; /* Instance à retourner */
+
+ result = operand->shift_value;
+
+ g_object_ref(G_OBJECT(result));
+
+ return result;
+
+}
diff --git a/plugins/arm/v7/operands/shift.h b/plugins/arm/v7/operands/shift.h
new file mode 100644
index 0000000..d3c8001
--- /dev/null
+++ b/plugins/arm/v7/operands/shift.h
@@ -0,0 +1,67 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * shift.h - prototypes pour les décallages de valeurs
+ *
+ * Copyright (C) 2014-2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_OPERANDS_SHIFT_H
+#define _PLUGINS_ARM_V7_OPERANDS_SHIFT_H
+
+
+#include <glib-object.h>
+
+
+#include <arch/operand.h>
+
+
+#include "../pseudo.h"
+
+
+
+#define G_TYPE_ARMV7_SHIFT_OPERAND g_armv7_shift_operand_get_type()
+#define G_ARMV7_SHIFT_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_armv7_shift_operand_get_type(), GArmV7ShiftOperand))
+#define G_IS_ARMV7_SHIFT_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_armv7_shift_operand_get_type()))
+#define G_ARMV7_SHIFT_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_SHIFT_OPERAND, GArmV7ShiftOperandClass))
+#define G_IS_ARMV7_SHIFT_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_SHIFT_OPERAND))
+#define G_ARMV7_SHIFT_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_SHIFT_OPERAND, GArmV7ShiftOperandClass))
+
+
+/* Définition d'un opérande visant une opérande de décallage ARMv7 (instance) */
+typedef struct _GArmV7ShiftOperand GArmV7ShiftOperand;
+
+/* Définition d'un opérande visant une opérande de décallage ARMv7 (classe) */
+typedef struct _GArmV7ShiftOperandClass GArmV7ShiftOperandClass;
+
+
+/* Indique le type défini par la GLib pour une opérande de décallage ARMv7. */
+GType g_armv7_shift_operand_get_type(void);
+
+/* Crée un réceptacle pour opérande de décallage ARMv7. */
+GArchOperand *g_armv7_shift_operand_new(SRType, GArchOperand *);
+
+/* Indique la forme de décallage représenté. */
+SRType g_armv7_shift_operand_get_shift_type(const GArmV7ShiftOperand *);
+
+/* Founit la valeur utilisée pour un décallage. */
+GArchOperand *g_armv7_shift_operand_get_shift_value(const GArmV7ShiftOperand *);
+
+
+
+#endif /* _PLUGINS_ARM_V7_OPERANDS_SHIFT_H */