diff options
Diffstat (limited to 'src/arch')
| -rw-r--r-- | src/arch/processor-int.h | 36 | ||||
| -rw-r--r-- | src/arch/processor.c | 7 | 
2 files changed, 8 insertions, 35 deletions
| 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; | 
