summaryrefslogtreecommitdiff
path: root/plugins/arm/v7/registers
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/arm/v7/registers')
-rw-r--r--plugins/arm/v7/registers/Makefile.am23
-rw-r--r--plugins/arm/v7/registers/banked.c726
-rw-r--r--plugins/arm/v7/registers/banked.h114
-rw-r--r--plugins/arm/v7/registers/basic.c461
-rw-r--r--plugins/arm/v7/registers/basic.h70
-rw-r--r--plugins/arm/v7/registers/coproc.c441
-rw-r--r--plugins/arm/v7/registers/coproc.h70
-rw-r--r--plugins/arm/v7/registers/simd.c534
-rw-r--r--plugins/arm/v7/registers/simd.h82
-rw-r--r--plugins/arm/v7/registers/special.c485
-rw-r--r--plugins/arm/v7/registers/special.h90
11 files changed, 3096 insertions, 0 deletions
diff --git a/plugins/arm/v7/registers/Makefile.am b/plugins/arm/v7/registers/Makefile.am
new file mode 100644
index 0000000..49f7f82
--- /dev/null
+++ b/plugins/arm/v7/registers/Makefile.am
@@ -0,0 +1,23 @@
+
+noinst_LTLIBRARIES = libarmv7registers.la
+
+libarmv7registers_la_SOURCES = \
+ banked.h banked.c \
+ basic.h basic.c \
+ coproc.h coproc.c \
+ simd.h simd.c \
+ special.h special.c
+
+libarmv7registers_la_LIBADD =
+
+libarmv7registers_la_CFLAGS = $(AM_CFLAGS)
+
+
+devdir = $(includedir)/chrysalide-$(subdir)
+
+dev_HEADERS = $(libarmv7registers_la_SOURCES:%c=)
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) -I$(top_srcdir)/src
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/arm/v7/registers/banked.c b/plugins/arm/v7/registers/banked.c
new file mode 100644
index 0000000..bce48dd
--- /dev/null
+++ b/plugins/arm/v7/registers/banked.c
@@ -0,0 +1,726 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * banked.c - aides auxiliaires relatives aux registres de banque ARMv7
+ *
+ * Copyright (C) 2018 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "banked.h"
+
+
+#include <stdio.h>
+
+
+#include "../register-int.h"
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+/* Représentation d'un registre de banque ARMv7 (instance) */
+struct _GArmV7BankedRegister
+{
+ GArmV7Register parent; /* Instance parente */
+
+};
+
+/* Représentation d'un registre de banque ARMv7 (classe) */
+struct _GArmV7BankedRegisterClass
+{
+ GArmV7RegisterClass parent; /* Classe parente */
+
+};
+
+
+#define MAX_REGNAME_LEN 9
+
+
+/* Initialise la classe des registres de banque ARMv7. */
+static void g_armv7_banked_register_class_init(GArmV7BankedRegisterClass *);
+
+/* Initialise une instance de registre de banque ARMv7. */
+static void g_armv7_banked_register_init(GArmV7BankedRegister *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_banked_register_dispose(GArmV7BankedRegister *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_banked_register_finalize(GArmV7BankedRegister *);
+
+/* Traduit un registre en version humainement lisible. */
+static void g_armv7_banked_register_print(const GArmV7BankedRegister *, GBufferLine *, AsmSyntax);
+
+/* Convertit en indice des paramètres d'encodage. */
+static BankedRegisterTarget convert_r_sysm_to_target(uint8_t, uint8_t);
+
+/* Crée une réprésentation de registre de banque ARMv7. */
+static GArchRegister *_g_armv7_banked_register_new(BankedRegisterTarget);
+
+
+
+/* --------------------- TRANSPOSITIONS VIA CACHE DES REGISTRES --------------------- */
+
+
+/* Charge un registre depuis une mémoire tampon. */
+static GArchRegister *g_armv7_banked_register_unserialize(GArmV7BankedRegister *, GAsmStorage *, packed_buffer *);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Conservation des registres utilisés */
+static GArchRegister **_armv7_banked_registers = NULL;
+static size_t _av7_banked_reg_count = 0;
+G_LOCK_DEFINE_STATIC(_av7_banked_reg_mutex);
+
+
+/* Fournit le singleton associé à un registre de banque ARMv7. */
+static GArchRegister *get_armv7_banked_register(BankedRegisterTarget);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION UNITAIRE DES REGISTRES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une représentation d'un registre de banque ARMv7. */
+G_DEFINE_TYPE(GArmV7BankedRegister, g_armv7_banked_register, G_TYPE_ARMV7_REGISTER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des registres de banque ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_banked_register_class_init(GArmV7BankedRegisterClass *klass)
+{
+ GObjectClass *object_class; /* Autre version de la classe */
+ GArchRegisterClass *reg_class; /* Classe de haut niveau */
+
+ object_class = G_OBJECT_CLASS(klass);
+ reg_class = G_ARCH_REGISTER_CLASS(klass);
+
+ object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_banked_register_dispose;
+ object_class->finalize = (GObjectFinalizeFunc)g_armv7_banked_register_finalize;
+
+ reg_class->print = (reg_print_fc)g_armv7_banked_register_print;
+ reg_class->unserialize = (reg_unserialize_fc)g_armv7_banked_register_unserialize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance à initialiser. *
+* *
+* Description : Initialise une instance de registre de banque ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_banked_register_init(GArmV7BankedRegister *reg)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_banked_register_dispose(GArmV7BankedRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_banked_register_parent_class)->dispose(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_banked_register_finalize(GArmV7BankedRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_banked_register_parent_class)->finalize(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre à transcrire. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un registre en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_banked_register_print(const GArmV7BankedRegister *reg, GBufferLine *line, AsmSyntax syntax)
+{
+ BankedRegisterTarget target; /* Registre ciblé */
+ char key[MAX_REGNAME_LEN]; /* Mot clef principal */
+ size_t klen; /* Taille de ce mot clef */
+
+ target = G_ARM_REGISTER(reg)->index;
+
+ switch (target)
+ {
+ case BRT_R8_USR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R8_usr");
+ break;
+ case BRT_R9_USR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R9_usr");
+ break;
+ case BRT_R10_USR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R10_usr");
+ break;
+ case BRT_R11_USR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R11_usr");
+ break;
+ case BRT_R12_USR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R12_usr");
+ break;
+ case BRT_SP_USR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SP_usr");
+ break;
+ case BRT_LR_USR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "LR_usr");
+ break;
+
+ case BRT_R8_FIQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R8_fiq");
+ break;
+ case BRT_R9_FIQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R9_fiq");
+ break;
+ case BRT_R10_FIQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R10_fiq");
+ break;
+ case BRT_R11_FIQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R11_fiq");
+ break;
+ case BRT_R12_FIQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "R12_fiq");
+ break;
+ case BRT_SP_FIQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SP_fiq");
+ break;
+ case BRT_LR_FIQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "LR_fiq");
+ break;
+
+ case BRT_LR_IRQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "LR_irq");
+ break;
+ case BRT_SP_IRQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SP_irq");
+ break;
+ case BRT_LR_SVC:
+ klen = snprintf(key, MAX_REGNAME_LEN, "LR_svc");
+ break;
+ case BRT_SP_SVC:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SP_svc");
+ break;
+ case BRT_LR_ABT:
+ klen = snprintf(key, MAX_REGNAME_LEN, "LR_abt");
+ break;
+ case BRT_SP_ABT:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SP_abt");
+ break;
+ case BRT_LR_UND:
+ klen = snprintf(key, MAX_REGNAME_LEN, "LR_und");
+ break;
+ case BRT_SP_UND:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SP_und");
+ break;
+
+ case BRT_LR_MON:
+ klen = snprintf(key, MAX_REGNAME_LEN, "LR_mon");
+ break;
+ case BRT_SP_MON:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SP_mon");
+ break;
+ case BRT_ELR_HYP:
+ klen = snprintf(key, MAX_REGNAME_LEN, "ELR_hyp");
+ break;
+ case BRT_SP_HYP:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SP_hyp");
+ break;
+
+ case BRT_SPSR_IRQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SPSR_irq");
+ break;
+ case BRT_SPSR_SVC:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SPSR_svc");
+ break;
+
+ default:
+ klen = snprintf(key, MAX_REGNAME_LEN, "???");
+ break;
+
+ }
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, key, klen, RTT_REGISTER, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : r = premier champ à interpréter. *
+* sysm = second champ à interpréter. *
+* *
+* Description : Convertit en indice des paramètres d'encodage. *
+* *
+* Retour : Registre ciblé ou BRT_COUNT en cas d'invalidité. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static BankedRegisterTarget convert_r_sysm_to_target(uint8_t r, uint8_t sysm)
+{
+ BankedRegisterTarget result; /* Cible effective à retourner */
+ uint8_t sysm_20; /* Décomposition en bits #1 */
+ uint8_t sysm_43; /* Décomposition en bits #2 */
+
+ result = BRT_COUNT;
+
+ sysm_20 = (sysm & 0x3);
+ sysm_43 = (sysm & 0x18) >> 3;
+
+ if (r == 0)
+ {
+ switch (sysm_43)
+ {
+ case 0b00:
+ switch (sysm_20)
+ {
+ case 0b000:
+ result = BRT_R8_USR;
+ break;
+ case 0b001:
+ result = BRT_R9_USR;
+ break;
+ case 0b010:
+ result = BRT_R10_USR;
+ break;
+ case 0b011:
+ result = BRT_R11_USR;
+ break;
+ case 0b100:
+ result = BRT_R12_USR;
+ break;
+ case 0b101:
+ result = BRT_SP_USR;
+ break;
+ case 0b110:
+ result = BRT_LR_USR;
+ break;
+ }
+ break;
+
+ case 0b01:
+ switch (sysm_20)
+ {
+ case 0b000:
+ result = BRT_R8_FIQ;
+ break;
+ case 0b001:
+ result = BRT_R9_FIQ;
+ break;
+ case 0b010:
+ result = BRT_R10_FIQ;
+ break;
+ case 0b011:
+ result = BRT_R11_FIQ;
+ break;
+ case 0b100:
+ result = BRT_R12_FIQ;
+ break;
+ case 0b101:
+ result = BRT_SP_FIQ;
+ break;
+ case 0b110:
+ result = BRT_LR_FIQ;
+ break;
+ }
+ break;
+
+ case 0b10:
+ switch (sysm_20)
+ {
+ case 0b000:
+ result = BRT_LR_IRQ;
+ break;
+ case 0b001:
+ result = BRT_SP_IRQ;
+ break;
+ case 0b010:
+ result = BRT_LR_SVC;
+ break;
+ case 0b011:
+ result = BRT_SP_SVC;
+ break;
+ case 0b100:
+ result = BRT_LR_ABT;
+ break;
+ case 0b101:
+ result = BRT_SP_ABT;
+ break;
+ case 0b110:
+ result = BRT_LR_UND;
+ break;
+ case 0b111:
+ result = BRT_SP_UND;
+ break;
+ }
+ break;
+
+ case 0b11:
+ switch (sysm_20)
+ {
+ case 0b100:
+ result = BRT_LR_MON;
+ break;
+ case 0b101:
+ result = BRT_SP_MON;
+ break;
+ case 0b110:
+ result = BRT_ELR_HYP;
+ break;
+ case 0b111:
+ result = BRT_SP_HYP;
+ break;
+ }
+ break;
+
+ }
+
+ }
+
+ else if (r == 1)
+ {
+ switch (sysm_43)
+ {
+ case 0b10:
+ switch (sysm_20)
+ {
+ case 0b000:
+ result = BRT_SPSR_IRQ;
+ break;
+ case 0b010:
+ result = BRT_SPSR_SVC;
+ break;
+ }
+ break;
+
+ }
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : target = registre effectivement ciblé. *
+* *
+* Description : Crée une réprésentation de registre de banque ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *_g_armv7_banked_register_new(BankedRegisterTarget target)
+{
+ GArmV7BankedRegister *result; /* Structure à retourner */
+
+ if (target >= BRT_COUNT)
+ goto bad_values;
+
+ result = g_object_new(G_TYPE_ARMV7_BANKED_REGISTER, NULL);
+
+ G_ARM_REGISTER(result)->index = target;
+
+ return G_ARCH_REGISTER(result);
+
+ bad_values:
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : r = premier champ à interpréter. *
+* sysm = second champ à interpréter. *
+* *
+* Description : Crée une réprésentation de registre de banque ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchRegister *g_armv7_banked_register_new(uint8_t r, uint8_t sysm)
+{
+ GArchRegister *result; /* Structure à retourner */
+ BankedRegisterTarget target; /* Registre effectivement ciblé*/
+
+ target = convert_r_sysm_to_target(r, sysm);
+
+ if (target >= BRT_COUNT)
+ goto bad_values;
+
+ result = get_armv7_banked_register(target);
+
+ return result;
+
+ bad_values:
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre à consulter. *
+* *
+* Description : Fournit le registre de banque ciblé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+BankedRegisterTarget g_armv7_banked_register_get_target(const GArmV7BankedRegister *reg)
+{
+ BankedRegisterTarget result; /* Cible à retourner */
+
+ result = G_ARM_REGISTER(reg)->index;
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* TRANSPOSITIONS VIA CACHE DES OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre d'architecture à constituer. *
+* storage = mécanisme de sauvegarde à manipuler. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Charge un registre depuis une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *g_armv7_banked_register_unserialize(GArmV7BankedRegister *reg, GAsmStorage *storage, packed_buffer *pbuf)
+{
+ GArchRegister *result; /* Instance à retourner */
+ uint8_t index; /* Indice du registre */
+ bool status; /* Bilan d'une extraction */
+ GArchRegisterClass *parent; /* Classe parente à consulter */
+
+ status = extract_packed_buffer(pbuf, &index, sizeof(uint8_t), false);
+
+ if (status)
+ {
+ result = get_armv7_banked_register(index);
+
+ if (result == NULL)
+ g_object_unref(G_OBJECT(reg));
+
+ }
+
+ else
+ {
+ g_object_unref(G_OBJECT(reg));
+ result = NULL;
+ }
+
+ if (result != NULL)
+ {
+ parent = G_ARCH_REGISTER_CLASS(g_armv7_banked_register_parent_class);
+
+ result = parent->unserialize(result, storage, pbuf);
+
+ }
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION SOUS FORME DE SINGLETONS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : target = registre effectivement ciblé. *
+* *
+* Description : Fournit le singleton associé à un registre de banque ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *get_armv7_banked_register(BankedRegisterTarget target)
+{
+ GArchRegister *result; /* Structure à retourner */
+ size_t new_count; /* Nouvelle taille à considérer*/
+ size_t i; /* Boucle de parcours */
+
+ G_LOCK(_av7_banked_reg_mutex);
+
+ if (target >= _av7_banked_reg_count)
+ {
+ /**
+ * On valide déjà le fait que le registre puisse être créé
+ * avant de réaliser une allocation potentiellement énorme
+ * avec un indice démesuré.
+ */
+
+ result = _g_armv7_banked_register_new(target);
+
+ if (result == NULL)
+ goto bad_values;
+
+ new_count = target + 1;
+
+ _armv7_banked_registers = realloc(_armv7_banked_registers, new_count * sizeof(GArchRegister *));
+
+ for (i = _av7_banked_reg_count; i < new_count; i++)
+ _armv7_banked_registers[i] = NULL;
+
+ _av7_banked_reg_count = new_count;
+
+ }
+
+ else
+ result = NULL;
+
+ if (_armv7_banked_registers[target] == NULL)
+ {
+ if (result != NULL)
+ _armv7_banked_registers[target] = result;
+ else
+ _armv7_banked_registers[target] = _g_armv7_banked_register_new(target);
+ }
+
+ result = _armv7_banked_registers[target];
+
+ G_UNLOCK(_av7_banked_reg_mutex);
+
+ g_object_ref(G_OBJECT(result));
+
+ bad_values:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Vide totalement le cache des registres de banque ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void clean_armv7_banked_register_cache(void)
+{
+ size_t i; /* Boucle de parcours */
+
+ G_LOCK(_av7_banked_reg_mutex);
+
+ for (i = 0; i < _av7_banked_reg_count; i++)
+ g_object_unref(G_OBJECT(_armv7_banked_registers[i]));
+
+ if (_armv7_banked_registers != NULL)
+ free(_armv7_banked_registers);
+
+ _armv7_banked_registers = NULL;
+ _av7_banked_reg_count = 0;
+
+ G_UNLOCK(_av7_banked_reg_mutex);
+
+}
diff --git a/plugins/arm/v7/registers/banked.h b/plugins/arm/v7/registers/banked.h
new file mode 100644
index 0000000..55d137b
--- /dev/null
+++ b/plugins/arm/v7/registers/banked.h
@@ -0,0 +1,114 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * banked.h - prototypes pour les aides auxiliaires relatives aux registres de banque ARMv7
+ *
+ * Copyright (C) 2018 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_REGISTERS_BANKED_H
+#define _PLUGINS_ARM_V7_REGISTERS_BANKED_H
+
+
+#include <glib-object.h>
+#include <stdint.h>
+
+
+#include <arch/register.h>
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+#define G_TYPE_ARMV7_BANKED_REGISTER g_armv7_banked_register_get_type()
+#define G_ARMV7_BANKED_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_ARMV7_BANKED_REGISTER, GArmV7BankedRegister))
+#define G_IS_ARMV7_BANKED_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_ARMV7_BANKED_REGISTER))
+#define G_ARMV7_BANKED_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_BANKED_REGISTER, GArmV7BankedRegisterClass))
+#define G_IS_ARMV7_BANKED_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_BANKED_REGISTER))
+#define G_ARMV7_BANKED_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_BANKED_REGISTER, GArmV7BankedRegisterClass))
+
+
+/* Représentation d'un registre de banque ARMv7 (instance) */
+typedef struct _GArmV7BankedRegister GArmV7BankedRegister;
+
+/* Représentation d'un registre de banque ARMv7 (classe) */
+typedef struct _GArmV7BankedRegisterClass GArmV7BankedRegisterClass;
+
+
+/* Liste des registres de banque */
+typedef enum _BankedRegisterTarget
+{
+ BRT_R8_USR,
+ BRT_R9_USR,
+ BRT_R10_USR,
+ BRT_R11_USR,
+ BRT_R12_USR,
+ BRT_SP_USR,
+ BRT_LR_USR,
+
+ BRT_R8_FIQ,
+ BRT_R9_FIQ,
+ BRT_R10_FIQ,
+ BRT_R11_FIQ,
+ BRT_R12_FIQ,
+ BRT_SP_FIQ,
+ BRT_LR_FIQ,
+
+ BRT_LR_IRQ,
+ BRT_SP_IRQ,
+ BRT_LR_SVC,
+ BRT_SP_SVC,
+ BRT_LR_ABT,
+ BRT_SP_ABT,
+ BRT_LR_UND,
+ BRT_SP_UND,
+
+ BRT_LR_MON,
+ BRT_SP_MON,
+ BRT_ELR_HYP,
+ BRT_SP_HYP,
+
+ BRT_SPSR_IRQ,
+ BRT_SPSR_SVC,
+
+ BRT_COUNT
+
+} BankedRegisterTarget;
+
+
+/* Indique le type défini pour une représentation d'un registre de banque ARMv7. */
+GType g_armv7_banked_register_get_type(void);
+
+/* Crée une réprésentation de registre de banque ARMv7. */
+GArchRegister *g_armv7_banked_register_new(uint8_t, uint8_t);
+
+/* Fournit le registre de banque ciblé. */
+BankedRegisterTarget g_armv7_banked_register_get_target(const GArmV7BankedRegister *);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Vide totalement le cache des registres de banque ARMv7. */
+void clean_armv7_banked_register_cache(void);
+
+
+
+#endif /* _PLUGINS_ARM_V7_REGISTERS_BANKED_H */
diff --git a/plugins/arm/v7/registers/basic.c b/plugins/arm/v7/registers/basic.c
new file mode 100644
index 0000000..aed9001
--- /dev/null
+++ b/plugins/arm/v7/registers/basic.c
@@ -0,0 +1,461 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * basic.c - aides auxiliaires relatives aux registres de base ARMv7
+ *
+ * Copyright (C) 2018 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "basic.h"
+
+
+#include <stdio.h>
+
+
+#include "../register-int.h"
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+/* Représentation d'un registre de base ARMv7 (instance) */
+struct _GArmV7BasicRegister
+{
+ GArmV7Register parent; /* Instance parente */
+
+};
+
+/* Représentation d'un registre de base ARMv7 (classe) */
+struct _GArmV7BasicRegisterClass
+{
+ GArmV7RegisterClass parent; /* Classe parente - */
+
+};
+
+
+#define MAX_REGNAME_LEN 8
+
+
+/* Initialise la classe des registres de base ARMv7. */
+static void g_armv7_basic_register_class_init(GArmV7BasicRegisterClass *);
+
+/* Initialise une instance de registre de base ARMv7. */
+static void g_armv7_basic_register_init(GArmV7BasicRegister *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_basic_register_dispose(GArmV7BasicRegister *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_basic_register_finalize(GArmV7BasicRegister *);
+
+/* Traduit un registre en version humainement lisible. */
+static void g_armv7_basic_register_print(const GArmV7BasicRegister *, GBufferLine *, AsmSyntax);
+
+/* Crée une réprésentation de registre de base ARMv7. */
+static GArchRegister *_g_armv7_basic_register_new(uint8_t);
+
+
+
+/* --------------------- TRANSPOSITIONS VIA CACHE DES REGISTRES --------------------- */
+
+
+/* Charge un registre depuis une mémoire tampon. */
+static GArchRegister *g_armv7_basic_register_unserialize(GArmV7BasicRegister *, GAsmStorage *, packed_buffer *);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Conservation des registres utilisés */
+static GArchRegister **_armv7_basic_registers = NULL;
+static size_t _av7_basic_reg_count = 0;
+G_LOCK_DEFINE_STATIC(_av7_basic_reg_mutex);
+
+
+/* Fournit le singleton associé à un registre de base ARMv7. */
+static GArchRegister *get_armv7_basic_register(uint8_t);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION UNITAIRE DES REGISTRES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une représentation d'un registre de base ARMv7. */
+G_DEFINE_TYPE(GArmV7BasicRegister, g_armv7_basic_register, G_TYPE_ARMV7_REGISTER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des registres de base ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_basic_register_class_init(GArmV7BasicRegisterClass *klass)
+{
+ GObjectClass *object_class; /* Autre version de la classe */
+ GArchRegisterClass *reg_class; /* Classe de haut niveau */
+
+ object_class = G_OBJECT_CLASS(klass);
+ reg_class = G_ARCH_REGISTER_CLASS(klass);
+
+ object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_basic_register_dispose;
+ object_class->finalize = (GObjectFinalizeFunc)g_armv7_basic_register_finalize;
+
+ reg_class->print = (reg_print_fc)g_armv7_basic_register_print;
+ reg_class->unserialize = (reg_unserialize_fc)g_armv7_basic_register_unserialize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance à initialiser. *
+* *
+* Description : Initialise une instance de registre de base ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_basic_register_init(GArmV7BasicRegister *reg)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_basic_register_dispose(GArmV7BasicRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_basic_register_parent_class)->dispose(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_basic_register_finalize(GArmV7BasicRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_basic_register_parent_class)->finalize(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre à transcrire. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un registre en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_basic_register_print(const GArmV7BasicRegister *reg, GBufferLine *line, AsmSyntax syntax)
+{
+ char key[MAX_REGNAME_LEN]; /* Mot clef principal */
+ size_t klen; /* Taille de ce mot clef */
+
+ switch (G_ARM_REGISTER(reg)->index)
+ {
+ case 0 ... 10:
+ klen = snprintf(key, MAX_REGNAME_LEN, "r%hhu", G_ARM_REGISTER(reg)->index);
+ break;
+ case 11:
+ klen = snprintf(key, MAX_REGNAME_LEN, "fp");
+ break;
+ case 12:
+ klen = snprintf(key, MAX_REGNAME_LEN, "ip");
+ break;
+ case 13:
+ klen = snprintf(key, MAX_REGNAME_LEN, "sp");
+ break;
+ case 14:
+ klen = snprintf(key, MAX_REGNAME_LEN, "lr");
+ break;
+ case 15:
+ klen = snprintf(key, MAX_REGNAME_LEN, "pc");
+ break;
+ case 16:
+ klen = snprintf(key, MAX_REGNAME_LEN, "cpsr");
+ break;
+ case 17:
+ klen = snprintf(key, MAX_REGNAME_LEN, "spsr");
+ break;
+ default:
+ klen = snprintf(key, MAX_REGNAME_LEN, "r??");
+ break;
+ }
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, key, klen, RTT_REGISTER, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : index = indice du registre correspondant. *
+* *
+* Description : Crée une réprésentation de registre de base ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *_g_armv7_basic_register_new(uint8_t index)
+{
+ GArmV7BasicRegister *result; /* Structure à retourner */
+
+ if (index > 17)
+ goto bad_index;
+
+ result = g_object_new(G_TYPE_ARMV7_BASIC_REGISTER, NULL);
+
+ G_ARM_REGISTER(result)->index = index;
+
+ return G_ARCH_REGISTER(result);
+
+ bad_index:
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : index = indice du registre correspondant. *
+* *
+* Description : Crée une réprésentation de registre de base ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchRegister *g_armv7_basic_register_new(uint8_t index)
+{
+ GArchRegister *result; /* Structure à retourner */
+
+ result = get_armv7_basic_register(index);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* TRANSPOSITIONS VIA CACHE DES OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre d'architecture à constituer. *
+* storage = mécanisme de sauvegarde à manipuler. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Charge un registre depuis une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *g_armv7_basic_register_unserialize(GArmV7BasicRegister *reg, GAsmStorage *storage, packed_buffer *pbuf)
+{
+ GArchRegister *result; /* Instance à retourner */
+ uint8_t index; /* Indice du registre */
+ bool status; /* Bilan d'une extraction */
+ GArchRegisterClass *parent; /* Classe parente à consulter */
+
+ status = extract_packed_buffer(pbuf, &index, sizeof(uint8_t), false);
+
+ if (status)
+ {
+ result = get_armv7_basic_register(index);
+
+ if (result == NULL)
+ g_object_unref(G_OBJECT(reg));
+
+ }
+
+ else
+ {
+ g_object_unref(G_OBJECT(reg));
+ result = NULL;
+ }
+
+ if (result != NULL)
+ {
+ parent = G_ARCH_REGISTER_CLASS(g_armv7_basic_register_parent_class);
+
+ result = parent->unserialize(result, storage, pbuf);
+
+ }
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION SOUS FORME DE SINGLETONS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : index = indice du registre correspondant. *
+* *
+* Description : Fournit le singleton associé à un registre de base ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *get_armv7_basic_register(uint8_t index)
+{
+ GArchRegister *result; /* Structure à retourner */
+ size_t new_count; /* Nouvelle taille à considérer*/
+ size_t i; /* Boucle de parcours */
+
+ G_LOCK(_av7_basic_reg_mutex);
+
+ if (index >= _av7_basic_reg_count)
+ {
+ /**
+ * On valide déjà le fait que le registre puisse être créé
+ * avant de réaliser une allocation potentiellement énorme
+ * avec un indice démesuré.
+ */
+
+ result = _g_armv7_basic_register_new(index);
+
+ if (result == NULL)
+ goto bad_index;
+
+ new_count = index + 1;
+
+ _armv7_basic_registers = realloc(_armv7_basic_registers, new_count * sizeof(GArchRegister *));
+
+ for (i = _av7_basic_reg_count; i < new_count; i++)
+ _armv7_basic_registers[i] = NULL;
+
+ _av7_basic_reg_count = new_count;
+
+ }
+
+ else
+ result = NULL;
+
+ if (_armv7_basic_registers[index] == NULL)
+ {
+ if (result != NULL)
+ _armv7_basic_registers[index] = result;
+ else
+ _armv7_basic_registers[index] = _g_armv7_basic_register_new(index);
+ }
+
+ result = _armv7_basic_registers[index];
+
+ G_UNLOCK(_av7_basic_reg_mutex);
+
+ g_object_ref(G_OBJECT(result));
+
+ bad_index:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Vide totalement le cache des registres de base ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void clean_armv7_basic_register_cache(void)
+{
+ size_t i; /* Boucle de parcours */
+
+ G_LOCK(_av7_basic_reg_mutex);
+
+ for (i = 0; i < _av7_basic_reg_count; i++)
+ g_object_unref(G_OBJECT(_armv7_basic_registers[i]));
+
+ if (_armv7_basic_registers != NULL)
+ free(_armv7_basic_registers);
+
+ _armv7_basic_registers = NULL;
+ _av7_basic_reg_count = 0;
+
+ G_UNLOCK(_av7_basic_reg_mutex);
+
+}
diff --git a/plugins/arm/v7/registers/basic.h b/plugins/arm/v7/registers/basic.h
new file mode 100644
index 0000000..bec4747
--- /dev/null
+++ b/plugins/arm/v7/registers/basic.h
@@ -0,0 +1,70 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * basic.h - prototypes pour les aides auxiliaires relatives aux registres de base ARMv7
+ *
+ * Copyright (C) 2018 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_REGISTERS_BASIC_H
+#define _PLUGINS_ARM_V7_REGISTERS_BASIC_H
+
+
+#include <glib-object.h>
+#include <stdint.h>
+
+
+#include <arch/register.h>
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+#define G_TYPE_ARMV7_BASIC_REGISTER g_armv7_basic_register_get_type()
+#define G_ARMV7_BASIC_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_ARMV7_BASIC_REGISTER, GArmV7BasicRegister))
+#define G_IS_ARMV7_BASIC_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_ARMV7_BASIC_REGISTER))
+#define G_ARMV7_BASIC_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_BASIC_REGISTER, GArmV7BasicRegisterClass))
+#define G_IS_ARMV7_BASIC_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_BASIC_REGISTER))
+#define G_ARMV7_BASIC_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_BASIC_REGISTER, GArmV7BasicRegisterClass))
+
+
+/* Représentation d'un registre de base ARMv7 (instance) */
+typedef struct _GArmV7BasicRegister GArmV7BasicRegister;
+
+/* Représentation d'un registre de base ARMv7 (classe) */
+typedef struct _GArmV7BasicRegisterClass GArmV7BasicRegisterClass;
+
+
+/* Indique le type défini pour une représentation d'un registre de base ARMv7. */
+GType g_armv7_basic_register_get_type(void);
+
+/* Crée une réprésentation de registre de base ARMv7. */
+GArchRegister *g_armv7_basic_register_new(uint8_t);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Vide totalement le cache des registres de base ARMv7. */
+void clean_armv7_basic_register_cache(void);
+
+
+
+#endif /* _PLUGINS_ARM_V7_REGISTERS_BASIC_H */
diff --git a/plugins/arm/v7/registers/coproc.c b/plugins/arm/v7/registers/coproc.c
new file mode 100644
index 0000000..f1dc3bc
--- /dev/null
+++ b/plugins/arm/v7/registers/coproc.c
@@ -0,0 +1,441 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * coproc.c - aides auxiliaires relatives aux registres de co-processeur ARMv7
+ *
+ * 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "coproc.h"
+
+
+#include <stdio.h>
+
+
+#include "../register-int.h"
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+/* Représentation d'un registre de co-processeur ARMv7 (instance) */
+struct _GArmV7CpRegister
+{
+ GArmV7Register parent; /* Instance parente */
+
+};
+
+
+/* Représentation d'un registre de co-processeur ARMv7 (classe) */
+struct _GArmV7CpRegisterClass
+{
+ GArmV7RegisterClass parent; /* Classe parente */
+
+};
+
+
+#define MAX_REGNAME_LEN 5
+
+
+/* Initialise la classe des registres de co-processeur ARMv7. */
+static void g_armv7_cp_register_class_init(GArmV7CpRegisterClass *);
+
+/* Initialise une instance de registre de co-processeur ARMv7. */
+static void g_armv7_cp_register_init(GArmV7CpRegister *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_cp_register_dispose(GArmV7CpRegister *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_cp_register_finalize(GArmV7CpRegister *);
+
+/* Traduit un registre en version humainement lisible. */
+static void g_armv7_cp_register_print(const GArmV7CpRegister *, GBufferLine *, AsmSyntax);
+
+/* Crée une réprésentation de registre de co-processeur ARMv7. */
+static GArchRegister *_g_armv7_cp_register_new(uint8_t);
+
+
+
+/* --------------------- TRANSPOSITIONS VIA CACHE DES REGISTRES --------------------- */
+
+
+/* Charge un registre depuis une mémoire tampon. */
+static GArchRegister *g_armv7_cp_register_unserialize(GArmV7CpRegister *, GAsmStorage *, packed_buffer *);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Conservation des registres utilisés */
+static GArchRegister **_armv7_cp_registers = NULL;
+static size_t _av7_cp_reg_count = 0;
+G_LOCK_DEFINE_STATIC(_av7_cp_reg_mutex);
+
+
+/* Fournit le singleton associé à un registre de co-proc. ARMv7. */
+static GArchRegister *get_armv7_cp_register(uint8_t);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION UNITAIRE DES REGISTRES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une représentation d'un registre de co-processeur ARMv7. */
+G_DEFINE_TYPE(GArmV7CpRegister, g_armv7_cp_register, G_TYPE_ARMV7_REGISTER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des registres de co-processeur ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_cp_register_class_init(GArmV7CpRegisterClass *klass)
+{
+ GObjectClass *object_class; /* Autre version de la classe */
+ GArchRegisterClass *reg_class; /* Classe de haut niveau */
+
+ object_class = G_OBJECT_CLASS(klass);
+ reg_class = G_ARCH_REGISTER_CLASS(klass);
+
+ object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_cp_register_dispose;
+ object_class->finalize = (GObjectFinalizeFunc)g_armv7_cp_register_finalize;
+
+ reg_class->print = (reg_print_fc)g_armv7_cp_register_print;
+ reg_class->unserialize = (reg_unserialize_fc)g_armv7_cp_register_unserialize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance à initialiser. *
+* *
+* Description : Initialise une instance de registre de co-processeur ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_cp_register_init(GArmV7CpRegister *reg)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_cp_register_dispose(GArmV7CpRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_cp_register_parent_class)->dispose(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_cp_register_finalize(GArmV7CpRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_cp_register_parent_class)->finalize(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre à transcrire. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un registre en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_cp_register_print(const GArmV7CpRegister *reg, GBufferLine *line, AsmSyntax syntax)
+{
+ char key[MAX_REGNAME_LEN]; /* Mot clef principal */
+ size_t klen; /* Taille de ce mot clef */
+
+ switch (G_ARM_REGISTER(reg)->index)
+ {
+ case 0 ... 15:
+ klen = snprintf(key, MAX_REGNAME_LEN, "cp%hhu", G_ARM_REGISTER(reg)->index);
+ break;
+ default:
+ klen = snprintf(key, MAX_REGNAME_LEN, "cp??");
+ break;
+ }
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, key, klen, RTT_REGISTER, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : index = indice du registre correspondant. *
+* *
+* Description : Crée une réprésentation de registre de co-processeur ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *_g_armv7_cp_register_new(uint8_t index)
+{
+ GArmV7CpRegister *result; /* Structure à retourner */
+
+ if (index > 15)
+ goto bad_index;
+
+ result = g_object_new(G_TYPE_ARMV7_CP_REGISTER, NULL);
+
+ G_ARM_REGISTER(result)->index = index;
+
+ return G_ARCH_REGISTER(result);
+
+ bad_index:
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : index = indice du registre correspondant. *
+* *
+* Description : Crée une réprésentation de registre de co-processeur ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchRegister *g_armv7_cp_register_new(uint8_t index)
+{
+ GArchRegister *result; /* Structure à retourner */
+
+ result = get_armv7_cp_register(index);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* TRANSPOSITIONS VIA CACHE DES OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre d'architecture à constituer. *
+* storage = mécanisme de sauvegarde à manipuler. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Charge un registre depuis une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *g_armv7_cp_register_unserialize(GArmV7CpRegister *reg, GAsmStorage *storage, packed_buffer *pbuf)
+{
+ GArchRegister *result; /* Instance à retourner */
+ uint8_t index; /* Indice du registre */
+ bool status; /* Bilan d'une extraction */
+ GArchRegisterClass *parent; /* Classe parente à consulter */
+
+ status = extract_packed_buffer(pbuf, &index, sizeof(uint8_t), false);
+
+ if (status)
+ {
+ result = get_armv7_cp_register(index);
+
+ if (result == NULL)
+ g_object_unref(G_OBJECT(reg));
+
+ }
+
+ else
+ {
+ g_object_unref(G_OBJECT(reg));
+ result = NULL;
+ }
+
+ if (result != NULL)
+ {
+ parent = G_ARCH_REGISTER_CLASS(g_armv7_cp_register_parent_class);
+
+ result = parent->unserialize(result, storage, pbuf);
+
+ }
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION SOUS FORME DE SINGLETONS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : index = indice du registre correspondant. *
+* *
+* Description : Fournit le singleton associé à un registre de co-proc. ARMv7.*
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *get_armv7_cp_register(uint8_t index)
+{
+ GArchRegister *result; /* Structure à retourner */
+ size_t new_count; /* Nouvelle taille à considérer*/
+ size_t i; /* Boucle de parcours */
+
+ G_LOCK(_av7_cp_reg_mutex);
+
+ if (index >= _av7_cp_reg_count)
+ {
+ /**
+ * On valide déjà le fait que le registre puisse être créé
+ * avant de réaliser une allocation potentiellement énorme
+ * avec un indice démesuré.
+ */
+
+ result = _g_armv7_cp_register_new(index);
+
+ if (result == NULL)
+ goto bad_index;
+
+ new_count = index + 1;
+
+ _armv7_cp_registers = realloc(_armv7_cp_registers, new_count * sizeof(GArchRegister *));
+
+ for (i = _av7_cp_reg_count; i < new_count; i++)
+ _armv7_cp_registers[i] = NULL;
+
+ _av7_cp_reg_count = new_count;
+
+ }
+
+ else
+ result = NULL;
+
+ if (_armv7_cp_registers[index] == NULL)
+ {
+ if (result != NULL)
+ _armv7_cp_registers[index] = result;
+ else
+ _armv7_cp_registers[index] = _g_armv7_cp_register_new(index);
+ }
+
+ result = _armv7_cp_registers[index];
+
+ G_UNLOCK(_av7_cp_reg_mutex);
+
+ g_object_ref(G_OBJECT(result));
+
+ bad_index:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Vide totalement le cache des registres ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void clean_armv7_cp_register_cache(void)
+{
+ size_t i; /* Boucle de parcours */
+
+ G_LOCK(_av7_cp_reg_mutex);
+
+ for (i = 0; i < _av7_cp_reg_count; i++)
+ g_object_unref(G_OBJECT(_armv7_cp_registers[i]));
+
+ if (_armv7_cp_registers != NULL)
+ free(_armv7_cp_registers);
+
+ _armv7_cp_registers = NULL;
+ _av7_cp_reg_count = 0;
+
+ G_UNLOCK(_av7_cp_reg_mutex);
+
+}
diff --git a/plugins/arm/v7/registers/coproc.h b/plugins/arm/v7/registers/coproc.h
new file mode 100644
index 0000000..200b721
--- /dev/null
+++ b/plugins/arm/v7/registers/coproc.h
@@ -0,0 +1,70 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * coproc.h - prototypes pour les aides auxiliaires relatives aux registres de co-processeur ARMv7
+ *
+ * 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_REGISTERS_COPROC_H
+#define _PLUGINS_ARM_V7_REGISTERS_COPROC_H
+
+
+#include <glib-object.h>
+#include <stdint.h>
+
+
+#include <arch/register.h>
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+#define G_TYPE_ARMV7_CP_REGISTER g_armv7_cp_register_get_type()
+#define G_ARMV7_CP_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_ARMV7_CP_REGISTER, GArmV7CpRegister))
+#define G_IS_ARMV7_CP_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_ARMV7_CP_REGISTER))
+#define G_ARMV7_CP_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_CP_REGISTER, GArmV7CpRegisterClass))
+#define G_IS_ARMV7_CP_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_CP_REGISTER))
+#define G_ARMV7_CP_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_CP_REGISTER, GArmV7CpRegisterClass))
+
+
+/* Représentation d'un registre de co-processeur ARMv7 (instance) */
+typedef struct _GArmV7CpRegister GArmV7CpRegister;
+
+/* Représentation d'un registre de co-processeur ARMv7 (classe) */
+typedef struct _GArmV7CpRegisterClass GArmV7CpRegisterClass;
+
+
+/* Indique le type défini pour une représentation d'un registre de co-processeur ARMv7. */
+GType g_armv7_cp_register_get_type(void);
+
+/* Crée une réprésentation de registre de co-processeur ARMv7. */
+GArchRegister *g_armv7_cp_register_new(uint8_t);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Vide totalement le cache des registres de co-processeur ARMv7. */
+void clean_armv7_cp_register_cache(void);
+
+
+
+#endif /* _PLUGINS_ARM_V7_REGISTERS_COPROC_H */
diff --git a/plugins/arm/v7/registers/simd.c b/plugins/arm/v7/registers/simd.c
new file mode 100644
index 0000000..1a71fc7
--- /dev/null
+++ b/plugins/arm/v7/registers/simd.c
@@ -0,0 +1,534 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * simd.c - aides auxiliaires relatives aux registres SIMD ARMv7
+ *
+ * Copyright (C) 2018 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "simd.h"
+
+
+#include <assert.h>
+#include <stdio.h>
+
+
+#include "../register-int.h"
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+/* Représentation d'un registre ARMv7 (instance) */
+struct _GArmV7SIMDRegister
+{
+ GArmV7Register parent; /* Instance parente */
+
+ SIMDRegisterMapping mapping; /* Type de registre */
+
+};
+
+/* Représentation d'un registre ARMv7 (classe) */
+struct _GArmV7SIMDRegisterClass
+{
+ GArmV7RegisterClass parent; /* Classe parente */
+
+};
+
+
+#define MAX_REGNAME_LEN 4
+
+
+/* Initialise la classe des registres SIMD ARMv7. */
+static void g_armv7_simd_register_class_init(GArmV7SIMDRegisterClass *);
+
+/* Initialise une instance de registre SIMD ARMv7. */
+static void g_armv7_simd_register_init(GArmV7SIMDRegister *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_simd_register_dispose(GArmV7SIMDRegister *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_simd_register_finalize(GArmV7SIMDRegister *);
+
+/* Traduit un registre en version humainement lisible. */
+static void g_armv7_simd_register_print(const GArmV7SIMDRegister *, GBufferLine *, AsmSyntax);
+
+/* Crée une réprésentation de registre SIMD ARMv7. */
+static GArchRegister *_g_armv7_simd_register_new(SIMDRegisterMapping, uint8_t);
+
+
+
+/* --------------------- TRANSPOSITIONS VIA CACHE DES REGISTRES --------------------- */
+
+
+/* Charge un registre depuis une mémoire tampon. */
+static GArchRegister *g_armv7_simd_register_unserialize(GArmV7SIMDRegister *, GAsmStorage *, packed_buffer *);
+
+/* Sauvegarde un registre dans une mémoire tampon. */
+static bool g_armv7_simd_register_serialize(const GArmV7SIMDRegister *, GAsmStorage *, packed_buffer *);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Conservation des registres utilisés */
+static GArchRegister **_armv7_simd_registers[SRM_COUNT] = { NULL, NULL, NULL };
+static size_t _av7_simd_reg_count[SRM_COUNT] = { 0, 0, 0 };
+G_LOCK_DEFINE_STATIC(_av7_simd_reg_mutex);
+
+
+/* Fournit le singleton associé à un registre SIMD ARMv7. */
+static GArchRegister *get_armv7_simd_register(SIMDRegisterMapping, uint8_t);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION UNITAIRE DES REGISTRES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une représentation d'un registre SIMD ARMv7. */
+G_DEFINE_TYPE(GArmV7SIMDRegister, g_armv7_simd_register, G_TYPE_ARMV7_REGISTER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des registres SIMD ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_simd_register_class_init(GArmV7SIMDRegisterClass *klass)
+{
+ GObjectClass *object_class; /* Autre version de la classe */
+ GArchRegisterClass *reg_class; /* Classe de haut niveau */
+
+ object_class = G_OBJECT_CLASS(klass);
+
+ object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_simd_register_dispose;
+ object_class->finalize = (GObjectFinalizeFunc)g_armv7_simd_register_finalize;
+
+ reg_class = G_ARCH_REGISTER_CLASS(klass);
+
+ reg_class->print = (reg_print_fc)g_armv7_simd_register_print;
+ reg_class->unserialize = (reg_unserialize_fc)g_armv7_simd_register_unserialize;
+ reg_class->serialize = (reg_serialize_fc)g_armv7_simd_register_serialize;
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance à initialiser. *
+* *
+* Description : Initialise une instance de registre SIMD ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_simd_register_init(GArmV7SIMDRegister *reg)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_simd_register_dispose(GArmV7SIMDRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_simd_register_parent_class)->dispose(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_simd_register_finalize(GArmV7SIMDRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_simd_register_parent_class)->finalize(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre à transcrire. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un registre en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_simd_register_print(const GArmV7SIMDRegister *reg, GBufferLine *line, AsmSyntax syntax)
+{
+ char key[MAX_REGNAME_LEN]; /* Mot clef principal */
+ size_t klen; /* Taille de ce mot clef */
+
+ switch (reg->mapping)
+ {
+ case SRM_SINGLE_WORD:
+ klen = snprintf(key, MAX_REGNAME_LEN, "s%hhu", G_ARM_REGISTER(reg)->index);
+ break;
+
+ case SRM_DOUBLE_WORD:
+ klen = snprintf(key, MAX_REGNAME_LEN, "d%hhu", G_ARM_REGISTER(reg)->index);
+ break;
+
+ case SRM_QUAD_WORD:
+ klen = snprintf(key, MAX_REGNAME_LEN, "q%hhu", G_ARM_REGISTER(reg)->index);
+ break;
+
+ default:
+ assert(false);
+ klen = snprintf(key, MAX_REGNAME_LEN, "x??");
+ break;
+
+ }
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, key, klen, RTT_REGISTER, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : mapping = type de registre demandé. *
+* index = indice du registre correspondant. *
+* *
+* Description : Crée une réprésentation de registre SIMD ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *_g_armv7_simd_register_new(SIMDRegisterMapping mapping, uint8_t index)
+{
+ GArmV7SIMDRegister *result; /* Structure à retourner */
+ uint8_t max; /* Borne supérieure de limite */
+
+ switch (mapping)
+ {
+ case SRM_SINGLE_WORD:
+ max = 31;
+ break;
+
+ case SRM_DOUBLE_WORD:
+ max = 31;
+ break;
+
+ case SRM_QUAD_WORD:
+ max = 15;
+ break;
+
+ default:
+ assert(false);
+ goto bad_mapping;
+ break;
+
+ }
+
+ if (index > max)
+ goto bad_index;
+
+ result = g_object_new(G_TYPE_ARMV7_SIMD_REGISTER, NULL);
+
+ G_ARM_REGISTER(result)->index = index;
+
+ result->mapping = mapping;
+
+ return G_ARCH_REGISTER(result);
+
+ bad_mapping:
+ bad_index:
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : mapping = type de registre demandé. *
+* index = indice du registre correspondant. *
+* *
+* Description : Crée une réprésentation de registre SIMD ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchRegister *g_armv7_simd_register_new(SIMDRegisterMapping mapping, uint8_t index)
+{
+ GArchRegister *result; /* Structure à retourner */
+
+ result = get_armv7_simd_register(mapping, index);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* TRANSPOSITIONS VIA CACHE DES OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre d'architecture à constituer. *
+* storage = mécanisme de sauvegarde à manipuler. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Charge un registre depuis une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *g_armv7_simd_register_unserialize(GArmV7SIMDRegister *reg, GAsmStorage *storage, packed_buffer *pbuf)
+{
+ GArchRegister *result; /* Instance à retourner */
+ SIMDRegisterMapping mapping; /* Type de registre */
+ bool status; /* Bilan d'une extraction */
+ uint8_t index; /* Indice du registre */
+ GArchRegisterClass *parent; /* Classe parente à consulter */
+
+ status = extract_packed_buffer(pbuf, &mapping, sizeof(SIMDRegisterMapping), true);
+
+ if (status)
+ status = extract_packed_buffer(pbuf, &index, sizeof(uint8_t), false);
+
+ if (status)
+ {
+ result = get_armv7_simd_register(mapping, index);
+
+ if (result == NULL)
+ g_object_unref(G_OBJECT(reg));
+
+ }
+
+ else
+ {
+ g_object_unref(G_OBJECT(reg));
+ result = NULL;
+ }
+
+ if (result != NULL)
+ {
+ parent = G_ARCH_REGISTER_CLASS(g_armv7_simd_register_parent_class);
+
+ result = parent->unserialize(G_ARCH_REGISTER(reg), storage, pbuf);
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre d'architecture à consulter. *
+* storage = mécanisme de sauvegarde à manipuler. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Sauvegarde un registre dans une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_armv7_simd_register_serialize(const GArmV7SIMDRegister *reg, GAsmStorage *storage, packed_buffer *pbuf)
+{
+ bool result; /* Bilan à retourner */
+ GArchRegisterClass *parent; /* Classe parente à consulter */
+
+ result = extend_packed_buffer(pbuf, &reg->mapping, sizeof(SIMDRegisterMapping), true);
+
+ if (result)
+ {
+ parent = G_ARCH_REGISTER_CLASS(g_armv7_simd_register_parent_class);
+
+ result = parent->serialize(G_ARCH_REGISTER(reg), storage, pbuf);
+
+ }
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION SOUS FORME DE SINGLETONS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : mapping = type de registre demandé. *
+* index = indice du registre correspondant. *
+* *
+* Description : Fournit le singleton associé à un registre SIMD ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *get_armv7_simd_register(SIMDRegisterMapping mapping, uint8_t index)
+{
+ GArchRegister *result; /* Structure à retourner */
+ size_t new_count; /* Nouvelle taille à considérer*/
+ size_t i; /* Boucle de parcours */
+
+ assert(mapping < SRM_COUNT);
+
+ G_LOCK(_av7_simd_reg_mutex);
+
+ if (index >= _av7_simd_reg_count[mapping])
+ {
+ /**
+ * On valide déjà le fait que le registre puisse être créé
+ * avant de réaliser une allocation potentiellement énorme
+ * avec un indice démesuré.
+ */
+
+ result = _g_armv7_simd_register_new(mapping, index);
+
+ if (result == NULL)
+ goto bad_index;
+
+ new_count = index + 1;
+
+ _armv7_simd_registers[mapping] = realloc(_armv7_simd_registers[mapping],
+ new_count * sizeof(GArchRegister *));
+
+ for (i = _av7_simd_reg_count[mapping]; i < new_count; i++)
+ _armv7_simd_registers[mapping][i] = NULL;
+
+ _av7_simd_reg_count[mapping] = new_count;
+
+ }
+
+ else
+ result = NULL;
+
+ if (_armv7_simd_registers[mapping][index] == NULL)
+ {
+ if (result != NULL)
+ _armv7_simd_registers[mapping][index] = result;
+ else
+ _armv7_simd_registers[mapping][index] = _g_armv7_simd_register_new(mapping, index);
+ }
+
+ result = _armv7_simd_registers[mapping][index];
+
+ G_UNLOCK(_av7_simd_reg_mutex);
+
+ g_object_ref(G_OBJECT(result));
+
+ bad_index:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Vide totalement le cache des registres SIMD ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void clean_armv7_simd_register_cache(void)
+{
+ SIMDRegisterMapping i; /* Boucle de parcours #1 */
+ size_t k; /* Boucle de parcours #2 */
+
+ G_LOCK(_av7_simd_reg_mutex);
+
+ for (i = 0; i < SRM_COUNT; i++)
+ {
+ for (k = 0; k < _av7_simd_reg_count[i]; k++)
+ g_object_unref(G_OBJECT(_armv7_simd_registers[i][k]));
+
+ if (_armv7_simd_registers[i] != NULL)
+ free(_armv7_simd_registers[i]);
+
+ _armv7_simd_registers[i] = NULL;
+ _av7_simd_reg_count[i] = 0;
+
+ }
+
+ G_UNLOCK(_av7_simd_reg_mutex);
+
+}
diff --git a/plugins/arm/v7/registers/simd.h b/plugins/arm/v7/registers/simd.h
new file mode 100644
index 0000000..9d731ac
--- /dev/null
+++ b/plugins/arm/v7/registers/simd.h
@@ -0,0 +1,82 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * simd.h - prototypes pour les aides auxiliaires relatives aux registres SIMD ARMv7
+ *
+ * Copyright (C) 2018 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_REGISTERS_SIMD_H
+#define _PLUGINS_ARM_V7_REGISTERS_SIMD_H
+
+
+#include <glib-object.h>
+#include <stdint.h>
+
+
+#include <arch/register.h>
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+#define G_TYPE_ARMV7_SIMD_REGISTER g_armv7_simd_register_get_type()
+#define G_ARMV7_SIMD_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_ARMV7_SIMD_REGISTER, GArmV7SIMDRegister))
+#define G_IS_ARMV7_SIMD_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_ARMV7_SIMD_REGISTER))
+#define G_ARMV7_SIMD_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_SIMD_REGISTER, GArmV7SIMDRegisterClass))
+#define G_IS_ARMV7_SIMD_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_SIMD_REGISTER))
+#define G_ARMV7_SIMD_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_SIMD_REGISTER, GArmV7SIMDRegisterClass))
+
+
+/* Représentation d'un registre SIMD ARMv7 (instance) */
+typedef struct _GArmV7SIMDRegister GArmV7SIMDRegister;
+
+/* Représentation d'un registre SIMD ARMv7 (classe) */
+typedef struct _GArmV7SIMDRegisterClass GArmV7SIMDRegisterClass;
+
+
+/* Types de registre */
+typedef enum _SIMDRegisterMapping
+{
+ SRM_SINGLE_WORD, /* Simple mot */
+ SRM_DOUBLE_WORD, /* Double mot */
+ SRM_QUAD_WORD, /* Quadruple mot */
+
+ SRM_COUNT
+
+} SIMDRegisterMapping;
+
+
+/* Indique le type défini pour une représentation d'un registre SIMD ARMv7. */
+GType g_armv7_simd_register_get_type(void);
+
+/* Crée une réprésentation de registre SIMD ARMv7. */
+GArchRegister *g_armv7_simd_register_new(SIMDRegisterMapping, uint8_t);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Vide totalement le cache des registres SIMD ARMv7. */
+void clean_armv7_simd_register_cache(void);
+
+
+
+#endif /* _PLUGINS_ARM_V7_REGISTERS_SIMD_H */
diff --git a/plugins/arm/v7/registers/special.c b/plugins/arm/v7/registers/special.c
new file mode 100644
index 0000000..ce3d859
--- /dev/null
+++ b/plugins/arm/v7/registers/special.c
@@ -0,0 +1,485 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * special.c - aides auxiliaires relatives aux registres spéciaux ARMv7
+ *
+ * Copyright (C) 2018 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "special.h"
+
+
+#include <stdio.h>
+
+
+#include "../register-int.h"
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+/* Représentation d'un registre spécial ARMv7 (instance) */
+struct _GArmV7SpecialRegister
+{
+ GArmV7Register parent; /* Instance parente */
+
+};
+
+/* Représentation d'un registre spécial ARMv7 (classe) */
+struct _GArmV7SpecialRegisterClass
+{
+ GArmV7RegisterClass parent; /* Classe parente - */
+
+};
+
+
+#define MAX_REGNAME_LEN 12
+
+
+/* Initialise la classe des registres spéciaux ARMv7. */
+static void g_armv7_special_register_class_init(GArmV7SpecialRegisterClass *);
+
+/* Initialise une instance de registre spécial ARMv7. */
+static void g_armv7_special_register_init(GArmV7SpecialRegister *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_special_register_dispose(GArmV7SpecialRegister *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_special_register_finalize(GArmV7SpecialRegister *);
+
+/* Traduit un registre en version humainement lisible. */
+static void g_armv7_special_register_print(const GArmV7SpecialRegister *, GBufferLine *, AsmSyntax);
+
+/* Crée une réprésentation de registre spécial ARMv7. */
+static GArchRegister *_g_armv7_special_register_new(SpecRegTarget);
+
+
+
+/* --------------------- TRANSPOSITIONS VIA CACHE DES REGISTRES --------------------- */
+
+
+/* Charge un registre depuis une mémoire tampon. */
+static GArchRegister *g_armv7_special_register_unserialize(GArmV7SpecialRegister *, GAsmStorage *, packed_buffer *);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Conservation des registres utilisés */
+static GArchRegister **_armv7_special_registers = NULL;
+static size_t _av7_special_reg_count = 0;
+G_LOCK_DEFINE_STATIC(_av7_special_reg_mutex);
+
+
+/* Fournit le singleton associé à un registre spécial ARMv7. */
+static GArchRegister *get_armv7_special_register(SpecRegTarget);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION UNITAIRE DES REGISTRES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une représentation d'un registre spécial ARMv7. */
+G_DEFINE_TYPE(GArmV7SpecialRegister, g_armv7_special_register, G_TYPE_ARMV7_REGISTER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des registres spéciaux ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_special_register_class_init(GArmV7SpecialRegisterClass *klass)
+{
+ GObjectClass *object_class; /* Autre version de la classe */
+ GArchRegisterClass *reg_class; /* Classe de haut niveau */
+
+ object_class = G_OBJECT_CLASS(klass);
+ reg_class = G_ARCH_REGISTER_CLASS(klass);
+
+ object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_special_register_dispose;
+ object_class->finalize = (GObjectFinalizeFunc)g_armv7_special_register_finalize;
+
+ reg_class->print = (reg_print_fc)g_armv7_special_register_print;
+ reg_class->unserialize = (reg_unserialize_fc)g_armv7_special_register_unserialize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance à initialiser. *
+* *
+* Description : Initialise une instance de registre spécial ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_special_register_init(GArmV7SpecialRegister *reg)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_special_register_dispose(GArmV7SpecialRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_special_register_parent_class)->dispose(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_special_register_finalize(GArmV7SpecialRegister *reg)
+{
+ G_OBJECT_CLASS(g_armv7_special_register_parent_class)->finalize(G_OBJECT(reg));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre à transcrire. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un registre en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_special_register_print(const GArmV7SpecialRegister *reg, GBufferLine *line, AsmSyntax syntax)
+{
+ SpecRegTarget target; /* Registre ciblé */
+ char key[MAX_REGNAME_LEN]; /* Mot clef principal */
+ size_t klen; /* Taille de ce mot clef */
+
+ target = G_ARM_REGISTER(reg)->index;
+
+ switch (target)
+ {
+ case SRT_APSR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "APSR");
+ break;
+
+ case SRT_CPSR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "CPSR");
+ break;
+
+ case SRT_SPSR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "SPSR");
+ break;
+
+ case SRT_APSR_NZCVQ:
+ klen = snprintf(key, MAX_REGNAME_LEN, "APSR_nzcvq");
+ break;
+
+ case SRT_APSR_G:
+ klen = snprintf(key, MAX_REGNAME_LEN, "APSR_g");
+ break;
+
+ case SRT_APSR_NZCVQG:
+ klen = snprintf(key, MAX_REGNAME_LEN, "APSR_nzcvqg");
+ break;
+
+ case SRT_FPSID:
+ klen = snprintf(key, MAX_REGNAME_LEN, "FPSID");
+ break;
+
+ case SRT_FPSCR:
+ klen = snprintf(key, MAX_REGNAME_LEN, "FPSCR");
+ break;
+
+ case SRT_MVFR1:
+ klen = snprintf(key, MAX_REGNAME_LEN, "MVFR1");
+ break;
+
+ case SRT_MVFR0:
+ klen = snprintf(key, MAX_REGNAME_LEN, "MVFR0");
+ break;
+
+ case SRT_FPEXC:
+ klen = snprintf(key, MAX_REGNAME_LEN, "FPEXC");
+ break;
+
+ default:
+ klen = snprintf(key, MAX_REGNAME_LEN, "???");
+ break;
+
+ }
+
+ g_buffer_line_append_text(line, BLC_ASSEMBLY, key, klen, RTT_REGISTER, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : target = registre effectivement ciblé. *
+* *
+* Description : Crée une réprésentation de registre spécial ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *_g_armv7_special_register_new(SpecRegTarget target)
+{
+ GArmV7SpecialRegister *result; /* Structure à retourner */
+
+ if (target >= SRT_CPSR)
+ goto bad_index;
+
+ result = g_object_new(G_TYPE_ARMV7_SPECIAL_REGISTER, NULL);
+
+ G_ARM_REGISTER(result)->index = target;
+
+ return G_ARCH_REGISTER(result);
+
+ bad_index:
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : target = registre effectivement ciblé. *
+* *
+* Description : Crée une réprésentation de registre spécial ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchRegister *g_armv7_special_register_new(SpecRegTarget target)
+{
+ GArchRegister *result; /* Structure à retourner */
+
+ result = get_armv7_special_register(target);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* TRANSPOSITIONS VIA CACHE DES OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre d'architecture à constituer. *
+* storage = mécanisme de sauvegarde à manipuler. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Charge un registre depuis une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *g_armv7_special_register_unserialize(GArmV7SpecialRegister *reg, GAsmStorage *storage, packed_buffer *pbuf)
+{
+ GArchRegister *result; /* Instance à retourner */
+ uint8_t index; /* Indice du registre */
+ bool status; /* Bilan d'une extraction */
+ GArchRegisterClass *parent; /* Classe parente à consulter */
+
+ status = extract_packed_buffer(pbuf, &index, sizeof(uint8_t), false);
+
+ if (status)
+ {
+ result = get_armv7_special_register(index);
+
+ if (result == NULL)
+ g_object_unref(G_OBJECT(reg));
+
+ }
+
+ else
+ {
+ g_object_unref(G_OBJECT(reg));
+ result = NULL;
+ }
+
+ if (result != NULL)
+ {
+ parent = G_ARCH_REGISTER_CLASS(g_armv7_special_register_parent_class);
+
+ result = parent->unserialize(result, storage, pbuf);
+
+ }
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION SOUS FORME DE SINGLETONS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : target = registre effectivement ciblé. *
+* *
+* Description : Fournit le singleton associé à un registre spécial ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GArchRegister *get_armv7_special_register(SpecRegTarget target)
+{
+ GArchRegister *result; /* Structure à retourner */
+ size_t new_count; /* Nouvelle taille à considérer*/
+ size_t i; /* Boucle de parcours */
+
+ G_LOCK(_av7_special_reg_mutex);
+
+ if (target >= _av7_special_reg_count)
+ {
+ /**
+ * On valide déjà le fait que le registre puisse être créé
+ * avant de réaliser une allocation potentiellement énorme
+ * avec un indice démesuré.
+ */
+
+ result = _g_armv7_special_register_new(target);
+
+ if (result == NULL)
+ goto bad_index;
+
+ new_count = target + 1;
+
+ _armv7_special_registers = realloc(_armv7_special_registers, new_count * sizeof(GArchRegister *));
+
+ for (i = _av7_special_reg_count; i < new_count; i++)
+ _armv7_special_registers[i] = NULL;
+
+ _av7_special_reg_count = new_count;
+
+ }
+
+ else
+ result = NULL;
+
+ if (_armv7_special_registers[target] == NULL)
+ {
+ if (result != NULL)
+ _armv7_special_registers[target] = result;
+ else
+ _armv7_special_registers[target] = _g_armv7_special_register_new(target);
+ }
+
+ result = _armv7_special_registers[target];
+
+ G_UNLOCK(_av7_special_reg_mutex);
+
+ g_object_ref(G_OBJECT(result));
+
+ bad_index:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Vide totalement le cache des registres spéciaux ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void clean_armv7_special_register_cache(void)
+{
+ size_t i; /* Boucle de parcours */
+
+ G_LOCK(_av7_special_reg_mutex);
+
+ for (i = 0; i < _av7_special_reg_count; i++)
+ g_object_unref(G_OBJECT(_armv7_special_registers[i]));
+
+ if (_armv7_special_registers != NULL)
+ free(_armv7_special_registers);
+
+ _armv7_special_registers = NULL;
+ _av7_special_reg_count = 0;
+
+ G_UNLOCK(_av7_special_reg_mutex);
+
+}
diff --git a/plugins/arm/v7/registers/special.h b/plugins/arm/v7/registers/special.h
new file mode 100644
index 0000000..ef23a9a
--- /dev/null
+++ b/plugins/arm/v7/registers/special.h
@@ -0,0 +1,90 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * special.h - prototypes pour les aides auxiliaires relatives aux registres spéciaux ARMv7
+ *
+ * Copyright (C) 2018 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_ARM_V7_REGISTERS_SPECIAL_H
+#define _PLUGINS_ARM_V7_REGISTERS_SPECIAL_H
+
+
+#include <glib-object.h>
+#include <stdint.h>
+
+
+#include <arch/register.h>
+
+
+
+/* ------------------------- GESTION UNITAIRE DES REGISTRES ------------------------- */
+
+
+#define G_TYPE_ARMV7_SPECIAL_REGISTER g_armv7_special_register_get_type()
+#define G_ARMV7_SPECIAL_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_ARMV7_SPECIAL_REGISTER, GArmV7SpecialRegister))
+#define G_IS_ARMV7_SPECIAL_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_ARMV7_SPECIAL_REGISTER))
+#define G_ARMV7_SPECIAL_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARMV7_SPECIAL_REGISTER, GArmV7SpecialRegisterClass))
+#define G_IS_ARMV7_SPECIAL_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARMV7_SPECIAL_REGISTER))
+#define G_ARMV7_SPECIAL_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARMV7_SPECIAL_REGISTER, GArmV7SpecialRegisterClass))
+
+
+/* Représentation d'un registre spécial ARMv7 (instance) */
+typedef struct _GArmV7SpecialRegister GArmV7SpecialRegister;
+
+/* Représentation d'un registre spécial ARMv7 (classe) */
+typedef struct _GArmV7SpecialRegisterClass GArmV7SpecialRegisterClass;
+
+
+/* Désignation des registres spéciaux */
+typedef enum _SpecRegTarget
+{
+ SRT_APSR,
+ SRT_CPSR,
+ SRT_SPSR,
+ SRT_APSR_NZCVQ,
+ SRT_APSR_G,
+ SRT_APSR_NZCVQG,
+ SRT_FPSID,
+ SRT_FPSCR,
+ SRT_MVFR1,
+ SRT_MVFR0,
+ SRT_FPEXC,
+
+ SRT_COUNT
+
+} SpecRegTarget;
+
+
+/* Indique le type défini pour une représentation d'un registre spécial ARMv7. */
+GType g_armv7_special_register_get_type(void);
+
+/* Crée une réprésentation de registre spécial ARMv7. */
+GArchRegister *g_armv7_special_register_new(SpecRegTarget);
+
+
+
+/* ------------------------ GESTION SOUS FORME DE SINGLETONS ------------------------ */
+
+
+/* Vide totalement le cache des registres spéciaux ARMv7. */
+void clean_armv7_special_register_cache(void);
+
+
+
+#endif /* _PLUGINS_ARM_V7_REGISTERS_SPECIAL_H */