summaryrefslogtreecommitdiff
path: root/tools/coder.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/coder.h')
-rw-r--r--tools/coder.h158
1 files changed, 158 insertions, 0 deletions
diff --git a/tools/coder.h b/tools/coder.h
new file mode 100644
index 0000000..c96f787
--- /dev/null
+++ b/tools/coder.h
@@ -0,0 +1,158 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * coder.h - prototypes pour la lecture automatisée des spécifications d'architecture
+ *
+ * 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/>.
+ */
+
+
+#ifndef _ARCH_ARM_V7_OPDEFS_CODER_H
+#define _ARCH_ARM_V7_OPDEFS_CODER_H
+
+
+#include <stdbool.h>
+
+
+
+/* Suivi des constructions */
+typedef struct _rented_coder rented_coder;
+
+
+
+/* -------------------------- CONSTRUCTION SELON COMMANDES -------------------------- */
+
+
+/* Débute la définition d'une fonction de désassemblage. */
+rented_coder *create_coder(void);
+
+/* Supprime le codeur de la mémoire. */
+void delete_coder(rented_coder *);
+
+/* Détermine si les propriétés de base d'un codeur sont là. */
+bool do_basic_checks_with_coder(const rented_coder *);
+
+/* Spécifie le répertoire de base pour les sorties de code. */
+void set_coder_output_directory(rented_coder *, const char *);
+
+/* Détermine l'architecture visée par les traitements. */
+void set_coder_arch(rented_coder *, const char *);
+
+/* Définit la base des protections des fichiers d'en-tête. */
+void set_coder_header_base(rented_coder *, const char *);
+
+/* Enregistre une correspondance en matière d'encodage. */
+void register_encoding_in_coder(rented_coder *, const char *, const char *);
+
+/* Constitue la matière d'un système de macros. */
+void define_macro_for_coder(rented_coder *, const char *, const char *);
+
+/* Enregistre les contours d'une instruction d'assemblage. */
+void save_notes_for_coder(rented_coder *, char *, char *, const char *);
+
+
+
+/* --------------------------- REPRESENTATION D'ENCODAGES --------------------------- */
+
+
+
+/* Enregistre une définition supplémentaire. */
+void push_encoding_spec(rented_coder *, char *, unsigned int);
+
+
+
+/* --------------------------- GESTION DES CHAMPS DE BITS --------------------------- */
+
+
+/* Note la présence d'un champ remarquable dans une définition. */
+void register_named_field_in_coder(rented_coder *, char *, unsigned int);
+
+/* Note la présence d'un bit invariable dans une définition. */
+void register_bit_in_coder(rented_coder *, int);
+
+/* Indique le nombre de bits traités. */
+unsigned int count_coder_bits(const rented_coder *);
+
+
+
+/* ---------------------------- SYNTAXE DES INSTRUCTIONS ---------------------------- */
+
+
+/* Enregistre la présence d'un nouvel opérande. */
+void register_syntax_item_in_coder(rented_coder *, char *, bool);
+
+
+
+/* ---------------------------- CONVERSION DES ARGUMENTS ---------------------------- */
+
+
+/* Enregistre la function de conversion du brut à l'utile. */
+void register_conversion_in_coder(rented_coder *, char *, char *, char *);
+
+
+
+/* --------------------------- CONDITIONS ET CONSEQUENCES --------------------------- */
+
+
+/* Types de comparaison */
+typedef enum _CondCompType
+{
+ CCT_EQUAL, /* Egalité '==' */
+ CCT_DIFF /* Différence '!=' */
+
+} CondCompType;
+
+/* Types de combinaison d'expressions */
+typedef enum _CondOpType
+{
+ COT_AND, /* Combinaison ET ('&&') */
+ COT_OR /* Combinaison OU ('||') */
+
+} CondOpType;
+
+/* Conséquence en cas de condition remplie */
+typedef enum _CondActionType
+{
+ CAT_SEE /* Renvoi vers une instruction */
+
+} CondActionType;
+
+
+/* Expression d'une condition */
+typedef struct _cond_expr cond_expr;
+
+
+/* Crée une expression conditionnelle simple. */
+cond_expr *build_simple_cond_expression(char *, CondCompType, char *);
+
+/* Crée une expression conditionnelle composée. */
+cond_expr *build_composed_cond_expression(cond_expr *, CondOpType, cond_expr *);
+
+/* Ajoute une règle complète à la définition d'un codage. */
+void add_conditional_rule_to_coder(rented_coder *, cond_expr *, CondActionType, const char *);
+
+
+
+/* --------------------------- GENERATIONS DE CODE SOURCE --------------------------- */
+
+
+/* Débute la définition des fonctions issues des spécifications. */
+bool dump_all_routines_using_coder(const rented_coder *);
+
+
+
+#endif /* _ARCH_ARM_V7_OPDEFS_CODER_H */