diff options
Diffstat (limited to 'src/arch/instruction.h')
-rw-r--r-- | src/arch/instruction.h | 48 |
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); |