summaryrefslogtreecommitdiff
path: root/src/arch/arm/instruction.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-06-30 13:01:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-06-30 13:01:38 (GMT)
commite5314b83cf2521f4a1fee5d3cbb5011d7ac7bff7 (patch)
tree3af6d5b430d3a07753e273e9ddb1ff656e706661 /src/arch/arm/instruction.c
parent0f3bbcb376ee4f76142ac4ddf729403fecac2641 (diff)
Provided first basic support for a few ARM instructions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@354 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/arm/instruction.c')
-rw-r--r--src/arch/arm/instruction.c128
1 files changed, 128 insertions, 0 deletions
diff --git a/src/arch/arm/instruction.c b/src/arch/arm/instruction.c
new file mode 100644
index 0000000..eb67e4f
--- /dev/null
+++ b/src/arch/arm/instruction.c
@@ -0,0 +1,128 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * instruction.c - gestion des instructions de la ARM
+ *
+ * Copyright (C) 2013 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * 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"
+
+
+
+
+
+/* Initialise la classe des instructions pour Arm. */
+static void g_arm_instruction_class_init(GArmInstructionClass *);
+
+/* Initialise une instance d'opérande d'architecture Arm. */
+static void g_arm_instruction_init(GArmInstruction *);
+
+
+
+
+
+
+/* Indique le type défini pour une instruction d'architecture Arm. */
+G_DEFINE_TYPE(GArmInstruction, g_arm_instruction, G_TYPE_ARCH_INSTRUCTION);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des instructions pour ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_arm_instruction_class_init(GArmInstructionClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instance à initialiser. *
+* *
+* Description : Initialise une instance d'instruction d'architecture ARM. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_arm_instruction_init(GArmInstruction *instr)
+{
+ GArchInstruction *parent; /* Instance parente */
+
+ parent = G_ARCH_INSTRUCTION(instr);
+
+ /* ... TODO ! */
+
+}
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* AIDE A LA MISE EN PLACE D'INSTRUCTIONS */
+/* ---------------------------------------------------------------------------------- */
+
+
+
+#if 0
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. *
+* len = taille totale des données à analyser. *
+* *
+* Description : Recherche l'identifiant de la prochaine instruction. *
+* *
+* Retour : Identifiant de la prochaine instruction à tenter de charger. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+ArmOpcodes arm_guess_next_instruction(const bin_t *data, off_t pos, off_t len)
+{
+ ArmOpcodes result; /* Identifiant à retourner */
+
+ result = (ArmOpcodes)data[pos];
+
+ /* Si l'instruction est marquée comme non utilisée... */
+ if (_instructions[result].keyword == NULL)
+ result = DOP_COUNT;
+
+ return result;
+
+}
+
+#endif