summaryrefslogtreecommitdiff
path: root/src/arch/x86/operands
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/operands')
-rw-r--r--src/arch/x86/operands/Makefile.am19
-rw-r--r--src/arch/x86/operands/data.c197
-rw-r--r--src/arch/x86/operands/data.h60
-rw-r--r--src/arch/x86/operands/modrm.c430
-rw-r--r--src/arch/x86/operands/modrm.h70
-rw-r--r--src/arch/x86/operands/moffs.c180
-rw-r--r--src/arch/x86/operands/moffs.h59
-rw-r--r--src/arch/x86/operands/register.c263
-rw-r--r--src/arch/x86/operands/register.h66
-rw-r--r--src/arch/x86/operands/relative.c211
-rw-r--r--src/arch/x86/operands/relative.h63
11 files changed, 0 insertions, 1618 deletions
diff --git a/src/arch/x86/operands/Makefile.am b/src/arch/x86/operands/Makefile.am
deleted file mode 100644
index e04270a..0000000
--- a/src/arch/x86/operands/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-
-noinst_LTLIBRARIES = libarchx86operands.la
-
-libarchx86operands_la_SOURCES = \
- data.h data.c \
- modrm.h modrm.c \
- moffs.h moffs.c \
- register.h register.c \
- relative.h relative.c
-
-libarchx86_la_CFLAGS = $(AM_CFLAGS)
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-
-
-SUBDIRS =
diff --git a/src/arch/x86/operands/data.c b/src/arch/x86/operands/data.c
deleted file mode 100644
index ef03381..0000000
--- a/src/arch/x86/operands/data.c
+++ /dev/null
@@ -1,197 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * data.c - opérandes de manipulation de données
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "data.h"
-
-
-#include "../register.h"
-#include "../../operand-int.h"
-
-
-
-/* Définition d'un opérande x86 de manipulation de données (instance) */
-struct _GX86DataOperand
-{
- GArchOperand parent; /* Instance parente */
-
- GX86Register *reg; /* Registre représenté */
- bool dest; /* Déduction du type de segment*/
-
-};
-
-/* Définition d'un opérande x86 de manipulation de données (classe) */
-struct _GX86DataOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des opérandes x86 pointant des données. */
-static void g_x86_data_operand_class_init(GX86DataOperandClass *);
-
-/* Initialise une instance d'opérande x86 pointant des données. */
-static void g_x86_data_operand_init(GX86DataOperand *);
-
-
-
-/* Indique le type défini par la GLib pour un opérande x86 de manipulation de données. */
-G_DEFINE_TYPE(GX86DataOperand, g_x86_data_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérandes x86 pointant des données. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_data_operand_class_init(GX86DataOperandClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opérande pointant des données. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_data_operand_init(GX86DataOperand *operand)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : size = taille de l'opérande, et donc du registre. *
-* dest = indique si la cible est une destination ou une source.*
-* *
-* Description : Crée un opérande x86 de manipulation de données. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_x86_data_operand_new(MemoryDataSize size, bool dest)
-{
- GX86DataOperand *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_X86_DATA_OPERAND, NULL);
-
- result->reg = g_x86_register_new(MDS_32_BITS/* FIXME size*/, dest ? 0x07 : 0x06);
- result->dest = dest;
-
- return G_ARCH_OPERAND(result);
-
-}
-
-
-#if 0
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_data_operand_add_text(const GX86DataOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- GContentExporter *exporter; /* Autre vision de l'opérande */
-
- exporter = G_CONTENT_EXPORTER(operand);
-
- if (operand->dest)
- g_content_exporter_insert_text(exporter, stream, "es:", 3, RTT_SEGMENT);
- else
- g_content_exporter_insert_text(exporter, stream, "ds:", 3, RTT_SEGMENT);
-
- g_content_exporter_insert_text(exporter, stream, "[", 1, RTT_HOOK);
-
- g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->reg), options, rendering, stream);
-
- g_content_exporter_insert_text(exporter, stream, "]", 1, RTT_HOOK);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_data_operand_to_buffer(const GX86DataOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
-{
- GContentExporter *exporter; /* Autre vision de l'opérande */
-
- exporter = G_CONTENT_EXPORTER(operand);
-
- if (operand->dest)
- g_content_exporter_insert_into_buffer(G_CONTENT_EXPORTER(operand), buffer, BLC_ASSEMBLY,
- "es:", 3, RTT_SEGMENT);
- else
- g_content_exporter_insert_into_buffer(G_CONTENT_EXPORTER(operand), buffer, BLC_ASSEMBLY,
- "ds:", 3, RTT_SEGMENT);
-
- g_content_exporter_insert_into_buffer(G_CONTENT_EXPORTER(operand), buffer, BLC_ASSEMBLY,
- "[", 1, RTT_HOOK);
-
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->reg), buffer, options);
-
- g_content_exporter_insert_into_buffer(G_CONTENT_EXPORTER(operand), buffer, BLC_ASSEMBLY,
- "]", 1, RTT_HOOK);
-
-}
-#endif
diff --git a/src/arch/x86/operands/data.h b/src/arch/x86/operands/data.h
deleted file mode 100644
index fda4ba0..0000000
--- a/src/arch/x86/operands/data.h
+++ /dev/null
@@ -1,60 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * data.h - prototypes pour les opérandes de manipulation de données
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ARCH_X86_OPERANDS_DATA_H
-#define _ARCH_X86_OPERANDS_DATA_H
-
-
-#include <glib-object.h>
-
-
-#include "../../operand.h"
-#include "../../../common/endianness.h"
-
-
-
-#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_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_X86_DATA_OPERAND, GX86DataOperandClass))
-#define G_IS_X86_DATA_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_X86_DATA_OPERAND))
-#define G_X86_DATA_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_X86_DATA_OPERAND, GX86DataOperandClass))
-
-
-
-/* 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);
-
-
-
-#endif /* _ARCH_X86_OPERANDS_DATA_H */
diff --git a/src/arch/x86/operands/modrm.c b/src/arch/x86/operands/modrm.c
deleted file mode 100644
index f48fe28..0000000
--- a/src/arch/x86/operands/modrm.c
+++ /dev/null
@@ -1,430 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * modrm.c - opérandes de type mod/rm
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "modrm.h"
-
-
-#include <math.h>
-
-
-#include "register.h"
-#include "../../operand-int.h"
-
-
-
-/* Définition d'un opérande x86 de type ModRM (instance) */
-struct _GX86ModRMOperand
-{
- GArchOperand parent; /* Instance parente */
-
- uint8_t scale; /* Puissance de deux */
- GX86Register *index; /* Registre servant d'indice */
- GX86Register *base; /* Registre de base */
- GImmOperand *displacement; /* Décallage supplémentaire */
-
-};
-
-
-/* Définition d'un opérande x86 de type ModRM (classe) */
-struct _GX86ModRMOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des opérandes x86 de type ModRM. */
-static void g_x86_mod_rm_operand_class_init(GX86ModRMOperandClass *);
-
-/* Initialise une instance d'opérande x86 de type ModRM. */
-static void g_x86_mod_rm_operand_init(GX86ModRMOperand *);
-
-
-
-/* Indique le type défini par la GLib pour un opérande x86 de type ModRM. */
-G_DEFINE_TYPE(GX86ModRMOperand, g_x86_mod_rm_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérandes x86 de type ModRM. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_mod_rm_operand_class_init(GX86ModRMOperandClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opérande x86 de type ModRM. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_mod_rm_operand_init(GX86ModRMOperand *operand)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : data = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* len = taille totale des données à analyser. *
-* size = taille de l'opérande, et donc du registre. *
-* *
-* Description : Crée un opérande x86 de type ModRM. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_x86_mod_rm_operand_new(const bin_t *data, off_t *pos, off_t len, MemoryDataSize size)
-{
- GX86ModRMOperand *result; /* Structure à retourner */
- uint8_t mod; /* Modificateur présent */
- GX86Register *reg; /* Registre lu */
-
- mod = (data[*pos] & 0xc0);
-
- if (mod == 0xc0)
- return g_x86_register_operand_new_from_mod_rm(data, pos, len, size, true);
-
- reg = g_x86_register_new(size, data[*pos] & 0x07);
- if (reg == NULL) return NULL;
-
- (*pos)++;
-
- /* Vieille astuce de l'emplacement mémoire fixe ? */
- if (g_x86_register_is_base_pointer(reg) && mod == 0x00)
- {
- /* FIXME *///free_x86_register(reg);
- assert(0);
- return NULL;
- //return g_imm_operand_new_from_data_old(MDS_32_BITS/* FIXME */, data, pos, len, SRE_LITTLE /*FIXME*/);
- }
-
- result = g_object_new(G_TYPE_X86_MOD_RM_OPERAND, NULL);
-
- /* A la recherche d'un SIB */
- if (g_x86_register_is_stack_pointer(reg))
- {
- /* FIXME *///free_x86_register(reg);
-
- result->base = g_x86_register_new(size, data[*pos] & 0x07);
- if (result->base == NULL) goto gxmron_error;
-
- result->index = g_x86_register_new(size, (data[*pos] & 0x38) >> 3);
- if (result->index == NULL) goto gxmron_error;
-
- result->scale = ((data[*pos] & 0xc0) >> 6);
-
- if (g_x86_register_is_stack_pointer(result->index))
- {
- /* FIXME *///free_x86_register(result->index);
- result->index = result->base;
- result->base = NULL;
- }
-
- (*pos)++;
-
- }
-
- else result->index = reg;
-
- /* Décallage supplémentaire ? */
- switch (mod)
- {
- case 0x00:
- if (result->base != NULL && g_x86_register_is_base_pointer(result->base))
- {
- /* FIXME *///free_x86_register(result->base);
- result->base = NULL;
-
- assert(0);
- //result->displacement = g_imm_operand_new_from_data_old(size/* FIXME : !convert mds/aos */, data, pos, len, SRE_LITTLE /* FIXME */);
- if (result->displacement == NULL) goto gxmron_error;
-
- }
- break;
-
- case 0x40:
- assert(0);
- //result->displacement = g_imm_operand_new_from_data_old(MDS_8_BITS_SIGNED, data, pos, len, SRE_LITTLE /* FIXME */);
- if (result->displacement == NULL) goto gxmron_error;
- break;
-
- case 0x80:
- assert(0);
- //result->displacement = g_imm_operand_new_from_data_old(MDS_32_BITS_SIGNED/* FIXME ! 16/32 */, data, pos, len, SRE_LITTLE /* FIXME */);
- if (result->displacement == NULL) goto gxmron_error;
- break;
-
- }
-
- return G_ARCH_OPERAND(result);
-
- gxmron_error:
-
- /* FIXME free(result);*/
- return NULL;
-
-}
-
-#if 0
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_mod_rm_operand_add_text(const GX86ModRMOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- GContentExporter *exporter; /* Autre vision de l'opérande */
- char tmp[2]; /* Echelle en puissance de 2 */
-
- exporter = G_CONTENT_EXPORTER(operand);
-
- switch (g_rendering_options_get_syntax(options))
- {
- case ASX_INTEL:
-
- g_content_exporter_insert_text(exporter, stream, "[", 1, RTT_HOOK);
-
- if (operand->scale > 0)
- {
- snprintf(tmp, 2, "%d", (int)pow(2, operand->scale));
-
- g_content_exporter_insert_text(exporter, stream, tmp, 1, RTT_IMMEDIATE);
-
- g_content_exporter_insert_text(exporter, stream, "*", 1, RTT_SIGNS);
-
- }
-
- g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->index),
- options, rendering, stream);
-
- if (operand->base != NULL)
- {
- g_content_exporter_insert_text(exporter, stream, "+", 1, RTT_SIGNS);
-
- g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->base),
- options, rendering, stream);
-
- }
-
- if (operand->displacement != NULL)
- {
- if (g_imm_operand_is_negative(operand->displacement))
- g_content_exporter_insert_text(exporter, stream, "-", 1, RTT_SIGNS);
- else
- g_content_exporter_insert_text(exporter, stream, "+", 1, RTT_SIGNS);
-
- g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->displacement),
- options, rendering, stream);
-
- }
-
- g_content_exporter_insert_text(exporter, stream, "]", 1, RTT_HOOK);
-
- break;
-
- case ASX_ATT:
-
- /* TODO */
- g_content_exporter_insert_text(exporter, stream, "[ModRM]", 7, RTT_HOOK);
-
- break;
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_mod_rm_operand_to_buffer(const GX86ModRMOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
-{
- GContentExporter *exporter; /* Autre vision de l'opérande */
- char tmp[2]; /* Echelle en puissance de 2 */
-
- exporter = G_CONTENT_EXPORTER(operand);
-
- switch (g_rendering_options_get_syntax(options))
- {
- case ASX_INTEL:
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "[", 1, RTT_HOOK);
-
- if (operand->scale > 0)
- {
- snprintf(tmp, 2, "%d", (int)pow(2, operand->scale));
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- tmp, 1, RTT_IMMEDIATE);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "*", 1, RTT_SIGNS);
-
- }
-
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->index), buffer, options);
-
- if (operand->base != NULL)
- {
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "+", 1, RTT_SIGNS);
-
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->base), buffer, options);
-
- }
-
- if (operand->displacement != NULL)
- {
- if (g_imm_operand_is_negative(operand->displacement))
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "-", 1, RTT_SIGNS);
- else
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "+", 1, RTT_SIGNS);
-
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->displacement), buffer, options);
-
- }
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "]", 1, RTT_HOOK);
-
- break;
-
- case ASX_ATT:
-
- /* TODO */
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "[ModRM]", 7, RTT_HOOK);
-
- break;
-
- }
-
-}
-#endif
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à consulter. *
-* scale = facteur sous forme de puissance de deux. [OUT *
-* index = register principal de l'opérande. [OUT] *
-* *
-* Description : Fournit l'indice et l'échelle d'un opérande x86 ModRM. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_x86_mod_rm_operand_get_scale_and_index(const GX86ModRMOperand *operand, uint8_t *scale, const GX86Register **index)
-{
- *scale = operand->scale;
- *index = operand->index;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à consulter. *
-* *
-* Description : Fournit le registre de base d'un opérande x86 ModRM. *
-* *
-* Retour : Registre de base de l'opérande. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const GX86Register *g_x86_mod_rm_operand_get_base(const GX86ModRMOperand *operand)
-{
- return operand->base;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à consulter. *
-* *
-* Description : Fournit le décallage supplémentaire d'un opérande x86 ModRM. *
-* *
-* Retour : Décallage numérique pour l'opérande. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const GImmOperand *g_x86_mod_rm_operand_get_displacement(const GX86ModRMOperand *operand)
-{
- return operand->displacement;
-
-}
diff --git a/src/arch/x86/operands/modrm.h b/src/arch/x86/operands/modrm.h
deleted file mode 100644
index e424010..0000000
--- a/src/arch/x86/operands/modrm.h
+++ /dev/null
@@ -1,70 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * modrm.h - prototypes pour les opérandes de type mod/rm
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ARCH_X86_OPERANDS_MODRM_H
-#define _ARCH_X86_OPERANDS_MODRM_H
-
-
-#include <glib-object.h>
-
-
-#include "../register.h"
-#include "../../immediate.h"
-#include "../../operand.h"
-#include "../../../common/endianness.h"
-
-
-
-#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_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_X86_MOD_RM_OPERAND, GX86ModRMOperandClass))
-#define G_IS_X86_MOD_RM_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_X86_MOD_RM_OPERAND))
-#define G_X86_MOD_RM_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_X86_MOD_RM_OPERAND, GX86ModRMOperandClass))
-
-
-/* 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 *);
-
-
-
-#endif /* _ARCH_X86_OPERANDS_MODRM_H */
diff --git a/src/arch/x86/operands/moffs.c b/src/arch/x86/operands/moffs.c
deleted file mode 100644
index 4df00d5..0000000
--- a/src/arch/x86/operands/moffs.c
+++ /dev/null
@@ -1,180 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * moffs.c - opérandes d'emplacements mémoire
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "moffs.h"
-
-
-#include "../../immediate.h"
-#include "../../operand-int.h"
-
-
-
-/* Définition d'un opérande visant un emplacement mémoire x86 (instance) */
-struct _GX86MOffsOperand
-{
- GArchOperand parent; /* Instance parente */
-
- GImmOperand *offset; /* Adresse mémoire visée */
-
-};
-
-/* Définition d'un opérande visant un emplacement mémoire x86 (classe) */
-struct _GX86MOffsOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des opérandes d'emplacement mémoire x86. */
-static void g_x86_moffs_operand_class_init(GX86MOffsOperandClass *);
-
-/* Initialise une instance d'opérande d'emplacement mémoire x86. */
-static void g_x86_moffs_operand_init(GX86MOffsOperand *);
-
-
-
-/* Indique le type défini par la GLib pour un opérande d'emplacement mémoire x86. */
-G_DEFINE_TYPE(GX86MOffsOperand, g_x86_moffs_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérandes d'emplacement mémoire x86.*
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_moffs_operand_class_init(GX86MOffsOperandClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opérande d'emplacement mémoire x86.*
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_moffs_operand_init(GX86MOffsOperand *operand)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : data = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* len = taille totale des données à analyser. *
-* size = taille de l'opérande, et donc du registre. *
-* *
-* Description : Crée un opérande d'emplacement mémoire x86. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_x86_moffs_operand_new(const bin_t *data, off_t *pos, off_t len, MemoryDataSize size)
-{
- GX86MOffsOperand *result; /* Structure à retourner */
- GImmOperand *offset; /* Emplacement lu */
-
- result = NULL;
-
- assert(0);
- //offset = g_imm_operand_new_from_data_old(size, data, pos, len, SRE_LITTLE /* FIXME */);
-
- if (offset != NULL)
- {
- result = g_object_new(G_TYPE_X86_MOFFS_OPERAND, NULL);
- result->offset = offset;
- }
-
- return G_ARCH_OPERAND(result);
-
-}
-
-
-#if 0
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_moffs_operand_add_text(const GX86MOffsOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- g_content_exporter_insert_text(G_CONTENT_EXPORTER(operand), stream, "ds:", 3, RTT_SEGMENT);
-
- g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->offset), options, rendering, stream);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_moffs_operand_to_buffer(const GX86MOffsOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
-{
- g_content_exporter_insert_into_buffer(G_CONTENT_EXPORTER(operand), buffer, BLC_ASSEMBLY,
- "ds:", 3, RTT_SEGMENT);
-
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->offset), buffer, options);
-
-}
-#endif
diff --git a/src/arch/x86/operands/moffs.h b/src/arch/x86/operands/moffs.h
deleted file mode 100644
index 39cac34..0000000
--- a/src/arch/x86/operands/moffs.h
+++ /dev/null
@@ -1,59 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * moffs.h - prototypes pour les opérandes d'emplacements mémoire
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ARCH_X86_OPERANDS_MOFFS_H
-#define _ARCH_X86_OPERANDS_MOFFS_H
-
-
-#include <glib-object.h>
-
-
-#include "../../operand.h"
-#include "../../../common/endianness.h"
-
-
-
-#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_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_X86_MOFFS_OPERAND, GX86MoffsOperandClass))
-#define G_IS_X86_MOFFS_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_X86_MOFFS_OPERAND))
-#define G_X86_MOFFS_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_X86_MOFFS_OPERAND, GX86MoffsOperandClass))
-
-
-/* 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);
-
-
-
-#endif /* _ARCH_X86_OPERANDS_MOFFS_H */
diff --git a/src/arch/x86/operands/register.c b/src/arch/x86/operands/register.c
deleted file mode 100644
index 800bad6..0000000
--- a/src/arch/x86/operands/register.c
+++ /dev/null
@@ -1,263 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * register.c - opérandes visant un registre x86
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "register.h"
-
-
-#include "../../operand-int.h"
-
-
-
-/* Définition d'un opérande visant un registre x86 (instance) */
-struct _GX86RegisterOperand
-{
- GArchOperand parent; /* Instance parente */
-
- GX86Register *reg; /* Registre représenté */
-
-};
-
-
-/* Définition d'un opérande visant un registre x86 (classe) */
-struct _GX86RegisterOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des opérandes de registre x86. */
-static void g_x86_register_operand_class_init(GX86RegisterOperandClass *);
-
-/* Initialise une instance d'opérande de registre x86. */
-static void g_x86_register_operand_init(GX86RegisterOperand *);
-
-/* Compare un opérande avec un autre. */
-static bool g_x86_register_operand_compare(const GX86RegisterOperand *, const GX86RegisterOperand *);
-
-/* Traduit un opérande en version humainement lisible. */
-static void g_x86_register_operand_print(const GX86RegisterOperand *, GBufferLine *, AsmSyntax);
-
-
-
-/* Indique le type défini par la GLib pour un opérande de registre x86. */
-G_DEFINE_TYPE(GX86RegisterOperand, g_x86_register_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérandes de registre x86. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_register_operand_class_init(GX86RegisterOperandClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opérande de registre x86. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_register_operand_init(GX86RegisterOperand *operand)
-{
- GArchOperand *parent; /* Instance parente */
-
- parent = G_ARCH_OPERAND(operand);
-
- parent->compare = (operand_compare_fc)g_x86_register_operand_compare;
- parent->print = (operand_print_fc)g_x86_register_operand_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : data = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* len = taille totale des données à analyser. *
-* size = taille de l'opérande, et donc du registre. *
-* base = indice du premier registre. *
-* *
-* Description : Crée un opérande visant un registre x86. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_x86_register_operand_new_from_opcode(const bin_t *data, off_t *pos, off_t len, MemoryDataSize size, bin_t base)
-{
- GX86RegisterOperand *result; /* Structure à retourner */
- GX86Register *reg; /* Registre lu */
-
- reg = g_x86_register_new(size, data[*pos] - base);
-
- if (reg != NULL)
- {
- (*pos)++;
-
- result = g_object_new(G_TYPE_X86_REGISTER_OPERAND, NULL);
-
- result->reg = reg;
-
- }
- else result = NULL;
-
- return G_ARCH_OPERAND(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : data = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* len = taille totale des données à analyser. *
-* size = taille de l'opérande, et donc du registre. *
-* first = indique la partie du ModR/M à traiter. *
-* *
-* Description : Crée un opérande visant un registre x86. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_x86_register_operand_new_from_mod_rm(const bin_t *data, off_t *pos, off_t len, MemoryDataSize size, bool first)
-{
- GX86RegisterOperand *result; /* Structure à retourner */
- bin_t index; /* Registre lu */
- GX86Register *reg; /* Registre créé */
-
- if (first) index = data[*pos] & 0x07;
- else index = (data[*pos] & 0x38) >> 3;
-
- reg = g_x86_register_new(size, index);
-
- if (reg != NULL)
- {
- (*pos)++;
-
- result = g_object_new(G_TYPE_X86_REGISTER_OPERAND, NULL);
-
- result->reg = reg;
-
- }
- else result = NULL;
-
- return G_ARCH_OPERAND(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : index = indice du registre visé. *
-* size = taille de l'opérande, et donc du registre. *
-* *
-* Description : Crée un opérande visant un registre x86 donné. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_x86_register_operand_new_from_index(bin_t index, MemoryDataSize size)
-{
- GX86RegisterOperand *result; /* Structure à retourner */
- GX86Register *reg; /* Registre lu */
-
- reg = g_x86_register_new(size, index);
-
- if (reg != NULL)
- {
- result = g_object_new(G_TYPE_X86_REGISTER_OPERAND, NULL);
-
- result->reg = reg;
-
- }
- else result = NULL;
-
- return G_ARCH_OPERAND(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : a = premier opérande à consulter. *
-* b = second opérande à consulter. *
-* *
-* Description : Compare un opérande avec un autre. *
-* *
-* Retour : Bilan de la comparaison. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_x86_register_operand_compare(const GX86RegisterOperand *a, const GX86RegisterOperand *b)
-{
- return g_x86_register_compare(a->reg, b->reg);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à traiter. *
-* line = ligne tampon où imprimer l'opérande donné. *
-* syntax = type de représentation demandée. *
-* *
-* Description : Traduit un opérande en version humainement lisible. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_register_operand_print(const GX86RegisterOperand *operand, GBufferLine *line, AsmSyntax syntax)
-{
- g_x86_pool_operand_print(operand->reg, line, syntax);
-
-}
diff --git a/src/arch/x86/operands/register.h b/src/arch/x86/operands/register.h
deleted file mode 100644
index 8bee621..0000000
--- a/src/arch/x86/operands/register.h
+++ /dev/null
@@ -1,66 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * register.h - prototypes pour les opérandes visant un registre x86
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ARCH_X86_OPERANDS_REGISTER_H
-#define _ARCH_X86_OPERANDS_REGISTER_H
-
-
-#include <glib-object.h>
-
-
-#include "../register.h"
-#include "../../operand.h"
-#include "../../../common/endianness.h"
-
-
-
-#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_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_X86_REGISTER_OPERAND, GX86RegisterOperandClass))
-#define G_IS_X86_REGISTER_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_X86_REGISTER_OPERAND))
-#define G_X86_REGISTER_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_X86_REGISTER_OPERAND, GX86RegisterOperandClass))
-
-
-/* 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);
-
-
-
-#endif /* _ARCH_X86_OPERANDS_REGISTER_H */
diff --git a/src/arch/x86/operands/relative.c b/src/arch/x86/operands/relative.c
deleted file mode 100644
index 6c5b913..0000000
--- a/src/arch/x86/operands/relative.c
+++ /dev/null
@@ -1,211 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * relative.c - opérandes d'adresses relatives
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "relative.h"
-
-
-#include "../../operand-int.h"
-
-
-
-/* Définition d'un opérande x86 d'adresse relative (instance) */
-struct _GX86RelativeOperand
-{
- GArchOperand parent; /* Instance parente */
-
- GImmOperand *immediate; /* Adresse visée reconstituée */
-
-};
-
-/* Définition d'un opérande x86 d'adresse relative (classe) */
-struct _GX86RelativeOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des opérandes x86 d'adresse relative. */
-static void g_x86_relative_operand_class_init(GX86RelativeOperandClass *);
-
-/* Initialise une instance d'opérande x86 d'adresse relative. */
-static void g_x86_relative_operand_init(GX86RelativeOperand *);
-
-
-
-/* Indique le type défini par la GLib pour un opérande x86 d'adresse relative. */
-G_DEFINE_TYPE(GX86RelativeOperand, g_x86_relative_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérandes x86 d'adresse relative. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_relative_operand_class_init(GX86RelativeOperandClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opérande x86 d'adresse relative. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_relative_operand_init(GX86RelativeOperand *operand)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : data = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* len = taille totale des données à analyser. *
-* size = taille de l'opérande, et donc du registre. *
-* base = adresse de référence pour le calcul. *
-* *
-* Description : Crée un opérande X86 d'adresse relative. *
-* *
-* Retour : Opérande mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_x86_relative_operand_new(const bin_t *data, off_t *pos, off_t len, MemoryDataSize size, vmpa_t base)
-{
- GX86RelativeOperand *result; /* Structure à retourner */
- off_t init_pos; /* Position avant lecture */
- int8_t val8; /* Valeur sur 8 bits */
- int16_t val16; /* Valeur sur 16 bits */
- int32_t val32; /* Valeur sur 32 bits */
- vmpa_t address; /* Adresse finale visée */
-
- init_pos = *pos;
-
- switch (size)
- {
- case MDS_8_BITS_UNSIGNED:
- read_s8(&val8, data, pos, len, SRE_LITTLE /* FIXME */);
- address = base + (*pos - init_pos) + val8;
- break;
- case MDS_16_BITS_UNSIGNED:
- read_s16(&val16, data, pos, len, SRE_LITTLE /* FIXME */);
- address = base + (*pos - init_pos) + val16;
- break;
- case MDS_32_BITS_UNSIGNED:
- read_s32(&val32, data, pos, len, SRE_LITTLE /* FIXME */);
- address = base + (*pos - init_pos) + val32;
- break;
- default:
- return NULL;
- break;
- }
-
- result = g_object_new(G_TYPE_X86_RELATIVE_OPERAND, NULL);
- result->immediate = g_imm_operand_new_from_value(MDS_32_BITS/*FIXME*/, (uint32_t)address/* FIXME */);
-
- return G_ARCH_OPERAND(result);
-
-}
-
-
-#if 0
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_relative_operand_add_text(const GX86RelativeOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->immediate), options, rendering, stream);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_relative_operand_to_buffer(const GX86RelativeOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
-{
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->immediate), buffer, options);
-
-}
-#endif
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à traiter. *
-* *
-* Description : Fournit l'adresse représentée par une opérande X86. *
-* *
-* Retour : Valeur portée par l'opérande. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const GImmOperand *g_x86_relative_operand_get_value(const GX86RelativeOperand *operand)
-{
- return operand->immediate;
-
-}
diff --git a/src/arch/x86/operands/relative.h b/src/arch/x86/operands/relative.h
deleted file mode 100644
index cbd4c9b..0000000
--- a/src/arch/x86/operands/relative.h
+++ /dev/null
@@ -1,63 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * relative.h - prototypes pour les opérandes d'adresses relatives
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ARCH_X86_OPERANDS_RELATIVE_H
-#define _ARCH_X86_OPERANDS_RELATIVE_H
-
-
-#include <glib-object.h>
-
-
-#include "../../immediate.h"
-#include "../../operand.h"
-#include "../../../common/endianness.h"
-
-
-
-#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_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_X86_RELATIVE_OPERAND, GX86RelativeOperandClass))
-#define G_IS_X86_RELATIVE_OPERAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_X86_RELATIVE_OPERAND))
-#define G_X86_RELATIVE_OPERAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_X86_RELATIVE_OPERAND, GX86RelativeOperandClass))
-
-
-/* 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 *);
-
-
-
-#endif /* _ARCH_X86_OPERANDS_RELATIVE_H */