summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-07-31 05:53:06 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-07-31 05:53:06 (GMT)
commita5d8e3fc30cda2e13d30f099e93ab1b182fdc0bd (patch)
treecf183906b2301cd3c726af820292fd0f2458bfa1 /src/arch/x86
parentdc436357ff29158dddd836d368d152d42d5b086b (diff)
Improved the way code is decoded by avoiding to propagate the base address everywhere.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@385 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/processor.c63
1 files changed, 58 insertions, 5 deletions
diff --git a/src/arch/x86/processor.c b/src/arch/x86/processor.c
index 7590532..38c3d20 100644
--- a/src/arch/x86/processor.c
+++ b/src/arch/x86/processor.c
@@ -45,12 +45,18 @@ struct _GX86ProcessorClass
};
-/* Initialise la classe des lignes de descriptions initiales. */
+/* Initialise la classe des processeurs x86. */
static void g_x86_processor_class_init(GX86ProcessorClass *);
-/* Initialise la classe des lignes de descriptions initiales. */
+/* Initialise une instance de processeur x86. */
static void g_x86_processor_init(GX86Processor *);
+/* Supprime toutes les références externes. */
+static void g_x86_processor_dispose(GX86Processor *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_x86_processor_finalize(GX86Processor *);
+
/* Décode une instruction dans un flux de données. */
static GArchInstruction *g_x86_processor_decode_instruction(const GX86Processor *, const bin_t *, off_t *, off_t, vmpa_t);
@@ -64,7 +70,7 @@ G_DEFINE_TYPE(GX86Processor, g_x86_processor, G_TYPE_ARCH_PROCESSOR);
* *
* Paramètres : klass = classe à initialiser. *
* *
-* Description : Initialise la classe des lignes de descriptions initiales. *
+* Description : Initialise la classe des processeurs x86. *
* *
* Retour : - *
* *
@@ -74,6 +80,17 @@ G_DEFINE_TYPE(GX86Processor, g_x86_processor, G_TYPE_ARCH_PROCESSOR);
static void g_x86_processor_class_init(GX86ProcessorClass *klass)
{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchProcessorClass *proc; /* Encore une autre vision... */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_x86_processor_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_x86_processor_finalize;
+
+ proc = G_ARCH_PROCESSOR_CLASS(klass);
+
+ proc->decode = (decode_instruction_fc)g_x86_processor_decode_instruction;
}
@@ -82,7 +99,7 @@ static void g_x86_processor_class_init(GX86ProcessorClass *klass)
* *
* Paramètres : proc = instance à initialiser. *
* *
-* Description : Initialise la classe des lignes de descriptions initiales. *
+* Description : Initialise une instance de processeur x86. *
* *
* Retour : - *
* *
@@ -100,7 +117,43 @@ static void g_x86_processor_init(GX86Processor *proc)
parent->memsize = MDS_32_BITS;
parent->inssize = MDS_8_BITS;
- parent->decode = (decode_instruction_fc)g_x86_processor_decode_instruction;
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_x86_processor_dispose(GX86Processor *proc)
+{
+ G_OBJECT_CLASS(g_x86_processor_parent_class)->dispose(G_OBJECT(proc));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : bookmark = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_x86_processor_finalize(GX86Processor *proc)
+{
+ G_OBJECT_CLASS(g_x86_processor_parent_class)->finalize(G_OBJECT(proc));
}