summaryrefslogtreecommitdiff
path: root/src/arch/mips
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/mips
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/mips')
-rw-r--r--src/arch/mips/processor.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/arch/mips/processor.c b/src/arch/mips/processor.c
index aa288b1..15de6cc 100644
--- a/src/arch/mips/processor.c
+++ b/src/arch/mips/processor.c
@@ -51,6 +51,12 @@ static void g_mips_processor_class_init(GMipsProcessorClass *);
/* Initialise la classe des lignes de descriptions initiales. */
static void g_mips_processor_init(GMipsProcessor *);
+/* Supprime toutes les références externes. */
+static void g_mips_processor_dispose(GMipsProcessor *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_mips_processor_finalize(GMipsProcessor *);
+
/* Décode une instruction dans un flux de données. */
static GArchInstruction *g_mips_processor_decode_instruction(const GMipsProcessor *, const bin_t *, off_t *, off_t, vmpa_t);
@@ -74,6 +80,17 @@ G_DEFINE_TYPE(GMipsProcessor, g_mips_processor, G_TYPE_ARCH_PROCESSOR);
static void g_mips_processor_class_init(GMipsProcessorClass *klass)
{
+ GObjectClass *object; /* Autre version de la classe */
+ GArchProcessorClass *proc; /* Encore une autre vision... */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_mips_processor_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_mips_processor_finalize;
+
+ proc = G_ARCH_PROCESSOR_CLASS(klass);
+
+ proc->decode = (decode_instruction_fc)g_mips_processor_decode_instruction;
}
@@ -99,7 +116,43 @@ static void g_mips_processor_init(GMipsProcessor *proc)
parent->endianness = SRE_BIG;
parent->memsize = MDS_32_BITS;
- parent->decode = (decode_instruction_fc)g_mips_processor_decode_instruction;
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_mips_processor_dispose(GMipsProcessor *proc)
+{
+ G_OBJECT_CLASS(g_mips_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_mips_processor_finalize(GMipsProcessor *proc)
+{
+ G_OBJECT_CLASS(g_mips_processor_parent_class)->finalize(G_OBJECT(proc));
}