summaryrefslogtreecommitdiff
path: root/src/arch/instruction.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-01-31 21:29:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-01-31 21:29:49 (GMT)
commit0936f64aac6a4fa9ebc08962bc9cac663f210c00 (patch)
treee888b4d7b547680bb26082913216bc637073e734 /src/arch/instruction.h
parentb6341581220e92114b0838a15a1c1cec1078efc2 (diff)
Saved the first steps of switch instructions decompilation.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@335 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/instruction.h')
-rw-r--r--src/arch/instruction.h48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index 051ce51..ae53dbb 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -25,35 +25,18 @@
#define _ARCH_INSTRUCTION_H
-#include <stdbool.h>
-#include <glib-object.h>
#include <sys/types.h>
-#include "archbase.h"
-#include "operand.h"
+#include "immediate.h"
#include "register.h"
+#include "../analysis/type.h"
#include "../decomp/context.h"
#include "../decomp/instruction.h"
#include "../format/executable.h"
-/* Typage des instructions rencontrées */
-typedef enum _InstructionLinkType
-{
- ILT_NONE, /* Aucune instruction visée */
- ILT_EXEC_FLOW, /* Raccord attendu entre blocs */
- ILT_JUMP, /* Saut inconditionnel */
- ILT_CASE_JUMP, /* Saut suite à aiguillage */
- ILT_JUMP_IF_TRUE, /* Saut conditionnel (si vrai) */
- ILT_JUMP_IF_FALSE, /* Saut conditionnel (si faux) */
- ILT_CALL, /* Appel d'une fonction */
- ILT_CATCH_EXCEPTION /* Gestion d'une exception */
-
-} InstructionLinkType;
-
-
#define G_TYPE_ARCH_INSTRUCTION g_arch_instruction_get_type()
#define G_ARCH_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_arch_instruction_get_type(), GArchInstruction))
#define G_IS_ARCH_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_arch_instruction_get_type()))
@@ -99,6 +82,29 @@ void g_arch_instruction_get_rw_registers(const GArchInstruction *, GArchRegister
/* ------------------- DEFINITION DES LIAISONS ENTRE INSTRUCTIONS ------------------- */
+/* Typage des instructions rencontrées */
+typedef enum _InstructionLinkType
+{
+ ILT_NONE, /* Aucune instruction visée */
+ ILT_EXEC_FLOW, /* Raccord attendu entre blocs */
+ ILT_JUMP, /* Saut inconditionnel */
+ ILT_CASE_JUMP, /* Saut suite à aiguillage */
+ ILT_JUMP_IF_TRUE, /* Saut conditionnel (si vrai) */
+ ILT_JUMP_IF_FALSE, /* Saut conditionnel (si faux) */
+ ILT_CALL, /* Appel d'une fonction */
+ ILT_CATCH_EXCEPTION /* Gestion d'une exception */
+
+} InstructionLinkType;
+
+/* Informations complémentaires pour un lien */
+typedef union _link_extra_info
+{
+ GImmOperand *imm; /* Valeur d'un cas de switch() */
+ GDataType *type; /* Type d'une exception */
+
+} link_extra_info;
+
+
/* Informe sur une éventuelle référence à une autre instruction. */
InstructionLinkType g_arch_instruction_get_link(const GArchInstruction *, vmpa_t *);
@@ -106,7 +112,7 @@ InstructionLinkType g_arch_instruction_get_link(const GArchInstruction *, vmpa_t
bool g_arch_instruction_is_return(const GArchInstruction *instr);
/* Etablit un lien entre deux instructions. */
-void g_arch_instruction_link_with(GArchInstruction *, GArchInstruction *, InstructionLinkType);
+void g_arch_instruction_link_with(GArchInstruction *, GArchInstruction *, InstructionLinkType, ...);
/* Indique si l'instruction a une ou plusieurs origines. */
bool g_arch_instruction_has_sources(const GArchInstruction *);
@@ -115,7 +121,7 @@ bool g_arch_instruction_has_sources(const GArchInstruction *);
bool g_arch_instruction_has_destinations(const GArchInstruction *);
/* Fournit les destinations d'une instruction donnée. */
-size_t g_arch_instruction_get_destinations(const GArchInstruction *, GArchInstruction ***, InstructionLinkType **);
+size_t g_arch_instruction_get_destinations(const GArchInstruction *, GArchInstruction ***, InstructionLinkType **, link_extra_info **);
/* Fournit la destination d'une instruction et d'un type donné. */
GArchInstruction *g_arch_instruction_get_given_destination(const GArchInstruction *, InstructionLinkType);