diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | plugins/arm/v7/processor.c | 9 | ||||
-rw-r--r-- | plugins/dalvik/processor.c | 6 | ||||
-rw-r--r-- | src/arch/processor-int.h | 36 | ||||
-rw-r--r-- | src/arch/processor.c | 7 |
5 files changed, 25 insertions, 45 deletions
@@ -1,3 +1,15 @@ +18-01-17 Cyrille Bagard <nocbos@gmail.com> + + * plugins/arm/v7/processor.c: + * plugins/dalvik/processor.c: + Update code. + + * src/arch/processor-int.h: + Clean the definition of architecture processors. + + * src/arch/processor.c: + Update code. + 18-01-16 Cyrille Bagard <nocbos@gmail.com> * configure.ac: diff --git a/plugins/arm/v7/processor.c b/plugins/arm/v7/processor.c index 4295b51..5bbe808 100644 --- a/plugins/arm/v7/processor.c +++ b/plugins/arm/v7/processor.c @@ -101,6 +101,8 @@ static void g_armv7_processor_class_init(GArmV7ProcessorClass *klass) object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_processor_dispose; object_class->finalize = (GObjectFinalizeFunc)g_armv7_processor_finalize; + proc->get_ctx = (get_processor_context_fc)g_armv7_processor_get_context; + proc->disassemble = (disass_instr_fc)g_armv7_processor_disassemble; } @@ -120,7 +122,6 @@ static void g_armv7_processor_class_init(GArmV7ProcessorClass *klass) static void g_armv7_processor_init(GArmV7Processor *proc) { - GArchProcessor *parent; /* Instance parente */ parent = G_ARCH_PROCESSOR(proc); @@ -129,12 +130,6 @@ static void g_armv7_processor_init(GArmV7Processor *proc) parent->memsize = MDS_32_BITS; parent->inssize = MDS_32_BITS; - - - - parent->get_ctx = (get_processor_context_fc)g_armv7_processor_get_context; - - } diff --git a/plugins/dalvik/processor.c b/plugins/dalvik/processor.c index 16d6644..ff8b805 100644 --- a/plugins/dalvik/processor.c +++ b/plugins/dalvik/processor.c @@ -110,6 +110,9 @@ static void g_dalvik_processor_class_init(GDalvikProcessorClass *klass) proc = G_ARCH_PROCESSOR_CLASS(klass); + proc->get_ctx = (get_processor_context_fc)g_dalvik_processor_get_context; + //proc->get_dec_ctx = (get_decomp_context_fc)g_dalvik_processor_get_decomp_context; + proc->disassemble = (disass_instr_fc)g_dalvik_processor_disassemble; } @@ -137,9 +140,6 @@ static void g_dalvik_processor_init(GDalvikProcessor *proc) parent->memsize = MDS_32_BITS; parent->inssize = MDS_16_BITS; - parent->get_ctx = (get_processor_context_fc)g_dalvik_processor_get_context; - //parent->get_dec_ctx = (get_decomp_context_fc)g_dalvik_processor_get_decomp_context; - } diff --git a/src/arch/processor-int.h b/src/arch/processor-int.h index a308bb8..00152c7 100644 --- a/src/arch/processor-int.h +++ b/src/arch/processor-int.h @@ -25,29 +25,14 @@ #define _ARCH_PROCESSOR_INT_H - - - - -/* TODO : nettoyer ! */ - -#include <stdint.h> -#include <sys/types.h> - - -#include "operand.h" /* TODO: AsmSyntax ? */ -#include "instruction.h" #include "processor.h" - - /* Taille des pré-allocations pour les instructions */ #define COV_ALLOC_BLOCK 100 - /* Fournit un contexte propre au processeur d'une architecture. */ typedef GProcContext * (* get_processor_context_fc) (const GArchProcessor *); @@ -58,7 +43,6 @@ typedef GProcContext * (* get_processor_context_fc) (const GArchProcessor *); typedef GArchInstruction * (* disass_instr_fc) (const GArchProcessor *, GProcContext *, const GBinContent *, vmpa2t *, GExeFormat *); - /* Description d'une erreur */ typedef struct _proc_error { @@ -89,9 +73,6 @@ struct _GArchProcessor MemoryDataSize memsize; /* Taille de l'espace mémoire */ MemoryDataSize inssize; /* Taille min. d'encodage */ - get_processor_context_fc get_ctx; /* Obtention d'un contexte #1 */ - //get_decomp_context_fc get_dec_ctx; /* Obtention d'un contexte #2 */ - GArchInstruction **instructions; /* Instructions désassemblées */ size_t instr_count; /* Taille de la liste aplatie */ unsigned int stamp; /* Marque de suivi des modifs */ @@ -113,29 +94,18 @@ struct _GArchProcessor }; - - - - - - /* Définition générique d'un processeur d'architecture (classe) */ struct _GArchProcessorClass { GObjectClass parent; /* A laisser en premier */ + get_processor_context_fc get_ctx; /* Obtention d'un contexte #1 */ + //get_decomp_context_fc get_dec_ctx; /* Obtention d'un contexte #2 */ + disass_instr_fc disassemble; /* Traduction en instructions */ }; - -#define SKIPPED_INSTR ((void *)-1) - - - - - - #endif /* _ARCH_PROCESSOR_INT_H */ diff --git a/src/arch/processor.c b/src/arch/processor.c index 78ded34..c08e8da 100644 --- a/src/arch/processor.c +++ b/src/arch/processor.c @@ -218,9 +218,12 @@ static void g_arch_processor_finalize(GArchProcessor *proc) GProcContext *g_arch_processor_get_context(const GArchProcessor *proc) { GProcContext *result; /* Contexte à retourner */ + GArchProcessorClass *class; /* Classe de l'instance active */ - if (proc->get_ctx != NULL) - result = proc->get_ctx(proc); + class = G_ARCH_PROCESSOR_GET_CLASS(proc); + + if (class->get_ctx != NULL) + result = class->get_ctx(proc); else result = NULL; |