summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/processor-int.h7
-rw-r--r--src/arch/processor.c10
-rw-r--r--src/arch/processor.h2
3 files changed, 13 insertions, 6 deletions
diff --git a/src/arch/processor-int.h b/src/arch/processor-int.h
index 821ce06..34ba66a 100644
--- a/src/arch/processor-int.h
+++ b/src/arch/processor-int.h
@@ -33,6 +33,9 @@
#define COV_ALLOC_BLOCK 100
+/* Fournit la désignation interne du processeur d'architecture. */
+typedef char * (* get_processor_key_fc) (const GArchProcessor *);
+
/* Fournit un contexte propre au processeur d'une architecture. */
typedef GProcContext * (* get_processor_context_fc) (const GArchProcessor *);
@@ -92,7 +95,6 @@ struct _GArchProcessorClass
{
GObjectClass parent; /* A laisser en premier */
- const char *key; /* Désignation interne */
const char *desc; /* Description humaine liée */
SourceEndian endianness; /* Boutisme de l'architecture */
@@ -100,7 +102,8 @@ struct _GArchProcessorClass
MemoryDataSize inssize; /* Taille min. d'encodage */
bool virt_space; /* Présence d'espace virtuel ? */
- get_processor_context_fc get_ctx; /* Obtention d'un contexte #1 */
+ get_processor_key_fc get_key; /* Code représentant la classe */
+ get_processor_context_fc get_ctx; /* Obtention d'un contexte */
disass_instr_fc disassemble; /* Traduction en instructions */
diff --git a/src/arch/processor.c b/src/arch/processor.c
index 777b01e..7dbd8eb 100644
--- a/src/arch/processor.c
+++ b/src/arch/processor.c
@@ -282,14 +282,18 @@ static GProcContext *_g_arch_processor_get_context(const GArchProcessor *proc)
* *
******************************************************************************/
-const char *g_arch_processor_get_key(const GArchProcessor *proc)
+char *g_arch_processor_get_key(const GArchProcessor *proc)
{
- const char *result; /* Désignation à renvoyer */
+ char *result; /* Désignation à renvoyer */
GArchProcessorClass *class; /* Classe de l'instance */
class = G_ARCH_PROCESSOR_GET_CLASS(proc);
- result = class->key;
+ if (class->get_key == NULL)
+ result = NULL;
+
+ else
+ result = class->get_key(proc);
return result;
diff --git a/src/arch/processor.h b/src/arch/processor.h
index d3d4623..7edf341 100644
--- a/src/arch/processor.h
+++ b/src/arch/processor.h
@@ -56,7 +56,7 @@ typedef struct _GArchProcessorClass GArchProcessorClass;
GType g_arch_processor_get_type(void);
/* Fournit la désignation interne du processeur d'architecture. */
-const char *g_arch_processor_get_key(const GArchProcessor *);
+char *g_arch_processor_get_key(const GArchProcessor *);
/* Fournit le nom humain de l'architecture visée. */
const char *g_arch_processor_get_desc(const GArchProcessor *);