summaryrefslogtreecommitdiff
path: root/src/arch/x86/operand.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-05-17 22:59:55 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-05-17 22:59:55 (GMT)
commit4d0ff0c23862c242d533d9b2d34e8812ef99ad61 (patch)
tree3b8504b8d3946a8bc9a702b819138ab1e5501be6 /src/arch/x86/operand.h
parent96cb6971ee3ca529958b8cb1e8e55a6eb4e60eae (diff)
Used only the new format of processor/instructions/operands for x86.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@64 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/operand.h')
-rw-r--r--src/arch/x86/operand.h127
1 files changed, 92 insertions, 35 deletions
diff --git a/src/arch/x86/operand.h b/src/arch/x86/operand.h
index c9ade39..bc495a0 100644
--- a/src/arch/x86/operand.h
+++ b/src/arch/x86/operand.h
@@ -26,75 +26,132 @@
#include <stdbool.h>
-#include <stdint.h>
-#include "instruction.h"
+#include "../instruction.h"
-/* Définition d'une opérande x86 */
-typedef struct _asm_x86_operand asm_x86_operand;
+/* ---------------------- COQUILLE VIDE POUR LES OPERANDES X86 ---------------------- */
+#define G_TYPE_X86_OPERAND g_x86_operand_get_type()
+#define G_X86_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_x86_operand_get_type(), GX86Operand))
+#define G_IS_X86_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_x86_operand_get_type()))
+#define G_X86_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_x86_operand_get_type(), GX86OperandIface))
-/* Crée une opérande vierge pour x86. */
-asm_x86_operand *create_new_x86_operand(void);
+/* Définition d'un opérande de la x86 (instance) */
+typedef struct _GX86Operand GX86Operand;
+/* Définition d'un opérande de la x86 (classe) */
+typedef struct _GX86OperandClass GX86OperandClass;
-/* Crée une opérande renvoyant vers un registre 16 ou 32 bits. */
-asm_x86_operand *x86_create_reg1632_operand(uint8_t, bool, uint8_t);
-/* Crée une opérande renvoyant vers un registre 16 ou 32 bits. */
-asm_x86_operand *x86_create_reg1632_operand_from_modrm(uint8_t, bool, bool);
+/* Indique le type défini par la GLib pour un opérande de x86. */
+GType g_x86_operand_get_type(void);
-/* Crée une opérande renvoyant vers un contenu 16 ou 32 bits. */
-asm_x86_operand *x86_create_content1632_operand(const uint8_t *, off_t *, off_t, bool, bool);
+/* ------------------------ OPERANDES VISANT UN REGISTRE X86 ------------------------ */
-/* Crée une opérande renvoyant vers un registre 8 bits. */
-asm_x86_operand *x86_create_r8_operand(uint8_t, bool);
-/* Crée une opérande à partir d'un registre/une mémoire 8 bits. */
-asm_x86_operand *x86_create_rm8_operand(const uint8_t *, off_t *, off_t, ...);
+#define G_TYPE_X86_REGISTER_OPERAND g_x86_register_operand_get_type()
+#define G_X86_REGISTER_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_x86_register_operand_get_type(), GX86RegisterOperand))
+#define G_IS_X86_REGISTER_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_x86_register_operand_get_type()))
+#define G_X86_REGISTER_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_x86_register_operand_get_type(), GX86RegisterOperandIface))
-/* Crée une opérande renvoyant vers un registre 16 ou 32 bits. */
-asm_x86_operand *x86_create_r1632_operand(uint8_t, bool, bool);
-/* Crée une opérande à partir d'un registre/une mémoire 16/32b. */
-asm_x86_operand *x86_create_rm1632_operand(const uint8_t *, off_t *, off_t, bool, ...);
+/* Définition d'un opérande visant un registre x86 (instance) */
+typedef struct _GX86RegisterOperand GX86RegisterOperand;
+/* Définition d'un opérande visant un registre x86 (classe) */
+typedef struct _GX86RegisterOperandClass GX86RegisterOperandClass;
-/* Traduit une opérande de registre en texte. */
-void x86_print_reg_operand(const asm_x86_operand *, char *, size_t, AsmSyntax);
+/* Indique le type défini par la GLib pour un opérande de registre x86. */
+GType g_x86_register_operand_get_type(void);
+/* Crée un opérande visant un registre X86. */
+GArchOperand *g_x86_register_operand_new_from_opcode(const bin_t *, off_t *, off_t, AsmOperandSize, bin_t);
+/* Crée un opérande visant un registre X86. */
+GArchOperand *g_x86_register_operand_new_from_mod_rm(const bin_t *, off_t *, off_t, AsmOperandSize, bool);
+
+/* Crée un opérande visant un registre X86 donnée. */
+GArchOperand *g_x86_register_operand_new_from_index(bin_t, AsmOperandSize);
+
+
+
+/* ----------------------- OPERANDES COMPLEXES DE TYPE MOD/RM ----------------------- */
+
+
+#define G_TYPE_X86_MOD_RM_OPERAND g_x86_mod_rm_operand_get_type()
+#define G_X86_MOD_RM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_x86_mod_rm_operand_get_type(), GX86ModRmOperand))
+#define G_IS_X86_MOD_RM_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_x86_mod_rm_operand_get_type()))
+#define G_X86_MOD_RM_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_x86_mod_rm_operand_get_type(), GX86ModRmOperandIface))
-/* ------------------------ OPERANDES D'EMPLACEMENTS MEMOIRE ------------------------ */
+/* Définition d'un opérande x86 de type ModRM (instance) */
+typedef struct _GX86ModRMOperand GX86ModRMOperand;
-/* Crée une opérande à partir d'un emplacement mémoire 8 bits. */
-asm_x86_operand *x86_create_moffs8_operand(const uint8_t *, off_t *, off_t);
+/* Définition d'un opérande x86 de type ModRM (classe) */
+typedef struct _GX86ModRMOperandClass GX86ModRMOperandClass;
-/* Crée une opérande à partir d'un emplacement mémoire 16/32b. */
-asm_x86_operand *x86_create_moffs1632_operand(const uint8_t *, off_t *, off_t, bool);
-/* Traduit une opérande d'emplacement mémoire en texte. */
-void x86_print_moffs_operand(const asm_x86_operand *, char *, size_t, AsmSyntax);
+/* Indique le type défini par la GLib pour un opérande x86 de type ModRM. */
+GType g_x86_mod_rm_operand_get_type(void);
+
+/* Crée un opérande x86 de type ModRM. */
+GArchOperand *g_x86_mod_rm_operand_new(const bin_t *, off_t *, off_t, AsmOperandSize);
/* ------------------------- OPERANDES D'ADRESSES RELATIVES ------------------------- */
-/* Crée une opérande à partir d'une adresse relative (8 bits). */
-asm_x86_operand *x86_create_rel8_operand_in_32b(uint64_t, const uint8_t *, off_t *, off_t);
+#define G_TYPE_X86_RELATIVE_OPERAND g_x86_relative_operand_get_type()
+#define G_X86_RELATIVE_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_x86_relative_operand_get_type(), GX86RelativeOperand))
+#define G_IS_X86_RELATIVE_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_x86_relative_operand_get_type()))
+#define G_X86_RELATIVE_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_x86_relative_operand_get_type(), GX86RelativeOperandIface))
+
+
+/* Définition d'un opérande x86 d'adresse relative (instance) */
+typedef struct _GX86RelativeOperand GX86RelativeOperand;
+
+/* Définition d'un opérande x86 d'adresse relative (classe) */
+typedef struct _GX86RelativeOperandClass GX86RelativeOperandClass;
+
+
+/* Indique le type défini par la GLib pour un opérande x86 d'adresse relative. */
+GType g_x86_relative_operand_get_type(void);
+
+/* Crée un opérande X86 d'adresse relative. */
+GArchOperand *g_x86_relative_operand_new(const bin_t *, off_t *, off_t, AsmOperandSize, vmpa_t);
+
+
+
+/* ------------------------ OPERANDES D'EMPLACEMENTS MEMOIRE ------------------------ */
+
+
+#define G_TYPE_X86_MOFFS_OPERAND g_x86_moffs_operand_get_type()
+#define G_X86_MOFFS_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_x86_moffs_operand_get_type(), GX86MoffsOperand))
+#define G_IS_X86_MOFFS_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_x86_moffs_operand_get_type()))
+#define G_X86_MOFFS_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_x86_moffs_operand_get_type(), GX86MoffsOperandIface))
+
+
+/* Définition d'un opérande visant un emplacement mémoire x86 (instance) */
+typedef struct _GX86MOffsOperand GX86MOffsOperand;
+
+/* Définition d'un opérande visant un emplacement mémoire x86 (classe) */
+typedef struct _GX86MOffsOperandClass GX86MOffsOperandClass;
+
+
+/* Indique le type défini par la GLib pour un opérande d'emplacement mémoire x86. */
+GType g_x86_moffs_operand_get_type(void);
-/* Crée une opérande à partir d'une adresse relative (16/32b). */
-asm_x86_operand *x86_create_rel1632_operand_in_32b(uint64_t, const uint8_t *, off_t *, off_t, bool);
+/* Crée un opérande d'emplacement mémoire x86. */
+GArchOperand *g_x86_moffs_operand_new(const bin_t *, off_t *, off_t, AsmOperandSize);
@@ -136,10 +193,10 @@ typedef enum _X86OperandType
/* Procède à la lecture d'un opérande donné. */
-bool x86_read_one_operand(asm_x86_instr *, const uint8_t *, off_t *, off_t, X86OperandType, ...);
+bool x86_read_one_operand(GArchInstruction *, const bin_t *data, off_t *pos, off_t, X86OperandType, ...);
/* Procède à la lecture de deux opérandes donnés. */
-bool x86_read_two_operands(asm_x86_instr *, const uint8_t *, off_t *, off_t, X86OperandType, X86OperandType, ...);
+bool x86_read_two_operands(GArchInstruction *, const bin_t *data, off_t *pos, off_t, X86OperandType, X86OperandType, ...);