summaryrefslogtreecommitdiff
path: root/src/arch/arm/v7/instruction.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/arm/v7/instruction.c')
-rw-r--r--src/arch/arm/v7/instruction.c206
1 files changed, 206 insertions, 0 deletions
diff --git a/src/arch/arm/v7/instruction.c b/src/arch/arm/v7/instruction.c
new file mode 100644
index 0000000..0fc95c9
--- /dev/null
+++ b/src/arch/arm/v7/instruction.c
@@ -0,0 +1,206 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * instruction.c - gestion des instructions ARMv7
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 "instruction.h"
+
+
+#include "../instruction-int.h"
+
+
+
+/* Définition d'une instruction d'architecture ARMv7 (instance) */
+struct _GArmV7Instruction
+{
+ GArmInstruction parent; /* Instance parente */
+
+ bool setflags; /* Mise à jour des drapeaux */
+
+};
+
+
+/* Définition d'une instruction d'architecture ARMv7 (classe) */
+struct _GArmV7InstructionClass
+{
+ GArmInstructionClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des instructions ARMv7. */
+static void g_armv7_instruction_class_init(GArmV7InstructionClass *);
+
+/* Initialise une instance d'instruction ARMv7. */
+static void g_armv7_instruction_init(GArmV7Instruction *);
+
+/* Supprime toutes les références externes. */
+static void g_armv7_instruction_dispose(GArmV7Instruction *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_armv7_instruction_finalize(GArmV7Instruction *);
+
+
+
+/* Indique le type défini pour une représentation d'une instruction ARMv7. */
+G_DEFINE_TYPE(GArmV7Instruction, g_armv7_instruction, G_TYPE_ARM_INSTRUCTION);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des instructions ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_instruction_class_init(GArmV7InstructionClass *klass)
+{
+ GObjectClass *object_class; /* Autre version de la classe */
+
+ object_class = G_OBJECT_CLASS(klass);
+
+ object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_instruction_dispose;
+ object_class->finalize = (GObjectFinalizeFunc)g_armv7_instruction_finalize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instance à initialiser. *
+* *
+* Description : Initialise une instance d'instruction ARMv7. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_instruction_init(GArmV7Instruction *instr)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_instruction_dispose(GArmV7Instruction *instr)
+{
+ G_OBJECT_CLASS(g_armv7_instruction_parent_class)->dispose(G_OBJECT(instr));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_armv7_instruction_finalize(GArmV7Instruction *instr)
+{
+ G_OBJECT_CLASS(g_armv7_instruction_parent_class)->finalize(G_OBJECT(instr));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée une instruction pour l'architecture ARMv7. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArmV7Instruction *g_armv7_instruction_new(void)
+{
+ GArmV7Instruction *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_ARMV7_INSTRUCTION, NULL);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction ARMv7 à mettre à jour. *
+* set = statut à enregistrer. *
+* *
+* Description : Définit si une instruction ARMv7 met à jour les drapeaux. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_armv7_instruction_define_setflags(GArmV7Instruction *instr, bool set)
+{
+ instr->setflags = set;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction ARMv7 à consulter. *
+* *
+* Description : Indique si une instruction ARMv7 met à jour les drapeaux. *
+* *
+* Retour : Statut des incidences de l'instruction. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_armv7_instruction_get_setflags(const GArmV7Instruction *instr)
+{
+ return instr->setflags;
+
+}