diff options
Diffstat (limited to 'src/arch/instruction.h')
-rw-r--r-- | src/arch/instruction.h | 59 |
1 files changed, 55 insertions, 4 deletions
diff --git a/src/arch/instruction.h b/src/arch/instruction.h index 6af865b..2df38af 100644 --- a/src/arch/instruction.h +++ b/src/arch/instruction.h @@ -35,11 +35,62 @@ typedef struct _asm_instr asm_instr; -/* Crée une instruction de type 'db' à partir de données. */ -asm_instr *create_db_instruction(const uint8_t *, off_t *, off_t); -/* Indique la position et/ou la taille d'une instruction. */ -void get_asm_instr_offset_and_length(const asm_instr *, off_t *, off_t *); + + +#include <glib-object.h> +#include <sys/types.h> + + +#include "archbase.h" +#include "operand.h" +#include "../format/exe_format.h" + + + +/* Typage des instructions rencontrées */ +typedef enum _ArchInstructionType +{ + AIT_OTHER, /* Instruction inintéressante */ + + AIT_DB, /* Instruction non décodée */ + + AIT_PUSH, /* Empilement de valeur */ + AIT_POP, /* Dépilement de valeur */ + AIT_JUMP, /* Saut à une adresse */ + + AIT_CALL /* Appel d'une fonction */ + +} ArchInstructionType; + + +#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())) +#define G_ARCH_INSTRUCTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_arch_instruction_get_type(), GArchInstructionIface)) + + +/* Définition générique d'une instruction d'architecture (instance) */ +typedef struct _GArchInstruction GArchInstruction; + +/* Définition générique d'une instruction d'architecture (classe) */ +typedef struct _GArchInstructionClass GArchInstructionClass; + + +/* Indique le type défini pour une instruction d'architecture. */ +GType g_arch_instruction_get_type(void); + +/* Définit la localisation d'une instruction. */ +void g_arch_instruction_set_location(GArchInstruction *, off_t, off_t, vmpa_t); + +/* Fournit la localisation d'une instruction. */ +void g_arch_instruction_get_location(GArchInstruction *, off_t *, off_t *, vmpa_t *); + +/* Attache une seule opérande à une instruction. */ +void g_arch_instruction_attach_one_operand(GArchInstruction *, GArchOperand *); + +/* Traduit une instruction en version humainement lisible. */ +char *g_arch_instruction_get_text(const GArchInstruction *, const exe_format *, AsmSyntax); |