diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-10-18 00:28:06 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-10-18 00:28:06 (GMT) |
commit | f7d126acb7718d4a13ac64c0d71c7d019cc8c18c (patch) | |
tree | b4b32237b99344beba8c03333972efb8f108a5cf /src/arch/x86/operand.h | |
parent | 2cfb66fcd5e8293d1dd689691bdc8c3517dd183a (diff) |
Reorganized the code for the x86 architecture support.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@274 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86/operand.h')
-rw-r--r-- | src/arch/x86/operand.h | 169 |
1 files changed, 5 insertions, 164 deletions
diff --git a/src/arch/x86/operand.h b/src/arch/x86/operand.h index 17d8844..01a12c5 100644 --- a/src/arch/x86/operand.h +++ b/src/arch/x86/operand.h @@ -28,174 +28,15 @@ #include <stdbool.h> -#include "../immediate.h" +#include "operands/data.h" +#include "operands/modrm.h" +#include "operands/moffs.h" +#include "operands/register.h" +#include "operands/relative.h" #include "../instruction.h" -#include "registers.h" -/* ---------------------- 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)) - - -/* Définition d'un opérande de x86 (instance) */ -typedef struct _GX86Operand GX86Operand; - -/* Définition d'un opérande de x86 (classe) */ -typedef struct _GX86OperandClass GX86OperandClass; - - -/* Indique le type défini par la GLib pour un opérande de x86. */ -GType g_x86_operand_get_type(void); - - - -/* ------------------------ OPERANDES VISANT UN REGISTRE X86 ------------------------ */ - - -#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)) - - -/* 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; - - -/* 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, MemoryDataSize, 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, MemoryDataSize, bool); - -/* Crée un opérande visant un registre x86 donné. */ -GArchOperand *g_x86_register_operand_new_from_index(bin_t, MemoryDataSize); - - - -/* ----------------------- 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)) - - -/* Définition d'un opérande x86 de type ModRM (instance) */ -typedef struct _GX86ModRMOperand GX86ModRMOperand; - -/* Définition d'un opérande x86 de type ModRM (classe) */ -typedef struct _GX86ModRMOperandClass GX86ModRMOperandClass; - - -/* 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, MemoryDataSize); - -/* Fournit l'indice et l'échelle d'un opérande x86 ModRM. */ -void g_x86_mod_rm_operand_get_scale_and_index(const GX86ModRMOperand *operand, uint8_t *, const GX86Register **); - -/* Fournit le registre de base d'un opérande x86 ModRM. */ -const GX86Register *g_x86_mod_rm_operand_get_base(const GX86ModRMOperand *); - -/* Fournit le décallage supplémentaire d'un opérande x86 ModRM. */ -const GImmOperand *g_x86_mod_rm_operand_get_displacement(const GX86ModRMOperand *); - - - -/* ------------------------- OPERANDES D'ADRESSES RELATIVES ------------------------- */ - - -#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, MemoryDataSize, vmpa_t); - -/* Fournit l'adresse représentée par une opérande X86. */ -const GImmOperand *g_x86_relative_operand_get_value(const GX86RelativeOperand *); - - - -/* ------------------------ 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 un opérande d'emplacement mémoire x86. */ -GArchOperand *g_x86_moffs_operand_new(const bin_t *, off_t *, off_t, MemoryDataSize); - - - -/* ---------------------- OPERANDES DE MANIPULATION DE DONNEES ---------------------- */ - - -#define G_TYPE_X86_DATA_OPERAND g_x86_data_operand_get_type() -#define G_X86_DATA_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_x86_data_operand_get_type(), GX86DataOperand)) -#define G_IS_X86_DATA_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_x86_data_operand_get_type())) -#define G_X86_DATA_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_x86_data_operand_get_type(), GX86DataOperandIface)) - - -/* Définition d'un opérande x86 de manipulation de données (instance) */ -typedef struct _GX86DataOperand GX86DataOperand; - -/* Définition d'un opérande x86 de manipulation de données (classe) */ -typedef struct _GX86DataOperandClass GX86DataOperandClass; - - -/* Indique le type défini par la GLib pour un opérande x86 de manipulation de données. */ -GType g_x86_data_operand_get_type(void); - -/* Crée un opérande x86 de manipulation de données. */ -GArchOperand *g_x86_data_operand_new(MemoryDataSize, bool); - - - -/* ------------------------- AIDE A LA CREATION D'OPERANDES ------------------------- */ - - /* Construction d'identifiants typés */ #define X86_OTP_IMM_TYPE 0x8000 |