summaryrefslogtreecommitdiff
path: root/src/analysis/blocks/raccess.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/blocks/raccess.h')
-rw-r--r--src/analysis/blocks/raccess.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/analysis/blocks/raccess.h b/src/analysis/blocks/raccess.h
new file mode 100644
index 0000000..cc2fd00
--- /dev/null
+++ b/src/analysis/blocks/raccess.h
@@ -0,0 +1,105 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * raccess.h - prototypes pour le suivi des accès aux registres
+ *
+ * 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/>.
+ */
+
+
+#ifndef _ANALYSIS_BLOCKS_RACCESS_H
+#define _ANALYSIS_BLOCKS_RACCESS_H
+
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <stdbool.h>
+
+
+#include "../../arch/register.h"
+
+
+
+/* Note sur le premier accès */
+typedef enum _RegAccessType
+{
+ RAT_NONE = (0 << 0), /* Registre non rencontré */
+ RAT_READ = (1 << 0), /* Lecture */
+ RAT_WRITE = (1 << 1) /* Ecriture */
+
+} RegAccessType;
+
+/* Description minimale des accès à un registre */
+typedef struct _reg_access
+{
+ GArchRegister *reg; /* Register concerné */
+
+ RegAccessType first_access; /* Type du premier accès */
+ vmpa_t last_write; /* Dernière écriture */
+
+} reg_access;
+
+
+#define G_TYPE_RACCESS_LIST g_raccess_list_get_type()
+#define G_RACCESS_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_raccess_list_get_type(), GRAccessList))
+#define G_IS_RACCESS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_raccess_list_get_type()))
+#define G_RACCESS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_RACCESS_LIST, GRAccessListClass))
+#define G_IS_RACCESS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_RACCESS_LIST))
+#define G_RACCESS_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_RACCESS_LIST, GRAccessListClass))
+
+
+/* Description d'une liste d'accès à des registres (instance) */
+typedef struct _GRAccessList GRAccessList;
+
+/* Description d'une liste d'accès à des registres (classe) */
+typedef struct _GRAccessListClass GRAccessListClass;
+
+
+/* Indique le type défini pour une liste d'accès à des registres. */
+GType g_raccess_list_get_type(void);
+
+/* Crée une liste d'accès à des registres. */
+GRAccessList *g_raccess_list_new(void);
+
+/* Intègre une liste d'accès à des registres dans une autre. */
+void g_raccess_list_merge(GRAccessList *, GRAccessList *);
+
+/* Compare un accès registre avec un autre. */
+int compare_reg_accesses(const reg_access *, const reg_access *);
+
+/* Recherche des informations existantes sur un registre. */
+reg_access *g_raccess_list_find(const GRAccessList *, GArchRegister *);
+
+/* Recherche des informations existantes sur un registre. */
+void g_raccess_list_add(GRAccessList *, const reg_access *);
+
+/* Dénombre les accès aux registres comptabilisés. */
+size_t g_raccess_list_count(const GRAccessList *);
+
+/* Fournit un accès donné de la liste. */
+reg_access *g_raccess_list_get(const GRAccessList *, size_t);
+
+/* Retire un accès donné de la liste. */
+void g_raccess_list_delete(GRAccessList *, reg_access *);
+
+/* Retire un accès donné de la liste. */
+void g_raccess_list_delete_by_index(GRAccessList *, size_t);
+
+
+
+#endif /* _ANALYSIS_BLOCKS_RACCESS_H */