summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/arm/v7/core.c2
-rw-r--r--plugins/arm/v7/processor.c21
-rw-r--r--plugins/dalvik/processor.c13
-rw-r--r--plugins/dalvik/v35/core.c2
-rw-r--r--plugins/dalvik/v35/processor.c3
-rw-r--r--plugins/pychrysalide/arch/processor.c33
-rw-r--r--plugins/pychrysalide/core/processors.c63
-rw-r--r--plugins/pychrysalide/format/executable.c2
-rw-r--r--plugins/ropgadgets/finder.c2
-rw-r--r--src/analysis/binary.c15
-rw-r--r--src/arch/processor-int.h13
-rw-r--r--src/arch/processor.c88
-rw-r--r--src/arch/processor.h6
-rw-r--r--src/core/processors.c84
-rw-r--r--src/core/processors.h7
15 files changed, 183 insertions, 171 deletions
diff --git a/plugins/arm/v7/core.c b/plugins/arm/v7/core.c
index 5fd355c..6849171 100644
--- a/plugins/arm/v7/core.c
+++ b/plugins/arm/v7/core.c
@@ -106,7 +106,7 @@ bool init_armv7_core(void)
register_armv7_gtypes();
- result = register_processor_type("armv7", "ARM v7", G_TYPE_ARMV7_PROCESSOR);
+ result = register_processor_type(G_TYPE_ARMV7_PROCESSOR);
return result;
diff --git a/plugins/arm/v7/processor.c b/plugins/arm/v7/processor.c
index b7a73f4..fca1415 100644
--- a/plugins/arm/v7/processor.c
+++ b/plugins/arm/v7/processor.c
@@ -96,11 +96,20 @@ static void g_armv7_processor_class_init(GArmV7ProcessorClass *klass)
GArchProcessorClass *proc; /* Encore une autre vision... */
object_class = G_OBJECT_CLASS(klass);
- proc = G_ARCH_PROCESSOR_CLASS(klass);
object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_processor_dispose;
object_class->finalize = (GObjectFinalizeFunc)g_armv7_processor_finalize;
+ proc = G_ARCH_PROCESSOR_CLASS(klass);
+
+ proc->key = "armv7";
+ proc->desc = "ARM v7";
+
+ proc->endianness = SRE_LITTLE;
+ proc->memsize = MDS_32_BITS;
+ proc->inssize = MDS_32_BITS;
+ proc->virt_space = true;
+
proc->get_ctx = (get_processor_context_fc)g_armv7_processor_get_context;
proc->disassemble = (disass_instr_fc)g_armv7_processor_disassemble;
@@ -122,14 +131,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);
-
- parent->endianness = SRE_LITTLE;
- parent->memsize = MDS_32_BITS;
- parent->inssize = MDS_32_BITS;
- parent->virt_space = true;
}
@@ -238,7 +239,7 @@ static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *pr
uint32_t raw32; /* Donnée 32 bits à analyser */
ArmV7InstrSet iset; /* Type de jeu d'instructions */
- endian = G_ARCH_PROCESSOR(proc)->endianness;
+ endian = G_ARCH_PROCESSOR_GET_CLASS(proc)->endianness;
iset = g_armv7_context_find_encoding(ctx, get_virt_addr(pos));
diff --git a/plugins/dalvik/processor.c b/plugins/dalvik/processor.c
index 5c5ecb6..429c431 100644
--- a/plugins/dalvik/processor.c
+++ b/plugins/dalvik/processor.c
@@ -83,6 +83,11 @@ static void g_dalvik_processor_class_init(GDalvikProcessorClass *klass)
proc = G_ARCH_PROCESSOR_CLASS(klass);
+ proc->endianness = SRE_LITTLE;
+ proc->memsize = MDS_32_BITS;
+ proc->inssize = MDS_16_BITS;
+ proc->virt_space = false;
+
proc->get_ctx = (get_processor_context_fc)g_dalvik_processor_get_context;
}
@@ -102,14 +107,6 @@ static void g_dalvik_processor_class_init(GDalvikProcessorClass *klass)
static void g_dalvik_processor_init(GDalvikProcessor *proc)
{
- GArchProcessor *parent; /* Instance parente */
-
- parent = G_ARCH_PROCESSOR(proc);
-
- parent->endianness = SRE_LITTLE;
- parent->memsize = MDS_32_BITS;
- parent->inssize = MDS_16_BITS;
- parent->virt_space = false;
}
diff --git a/plugins/dalvik/v35/core.c b/plugins/dalvik/v35/core.c
index 7e36691..1ecaf82 100644
--- a/plugins/dalvik/v35/core.c
+++ b/plugins/dalvik/v35/core.c
@@ -74,7 +74,7 @@ bool init_dalvik35_core(void)
register_dalvik35_gtypes();
- result = register_processor_type("dalvik35", "Dalvik Virtual Machine v35", G_TYPE_DALVIK35_PROCESSOR);
+ result = register_processor_type(G_TYPE_DALVIK35_PROCESSOR);
return result;
diff --git a/plugins/dalvik/v35/processor.c b/plugins/dalvik/v35/processor.c
index b1c13d2..507373b 100644
--- a/plugins/dalvik/v35/processor.c
+++ b/plugins/dalvik/v35/processor.c
@@ -97,6 +97,9 @@ static void g_dalvik35_processor_class_init(GDalvik35ProcessorClass *klass)
proc = G_ARCH_PROCESSOR_CLASS(klass);
+ proc->key = "dalvik35";
+ proc->desc = "Dalvik Virtual Machine v35";
+
proc->disassemble = (disass_instr_fc)g_dalvik35_processor_disassemble;
}
diff --git a/plugins/pychrysalide/arch/processor.c b/plugins/pychrysalide/arch/processor.c
index 94ba7df..f356a91 100644
--- a/plugins/pychrysalide/arch/processor.c
+++ b/plugins/pychrysalide/arch/processor.c
@@ -208,6 +208,23 @@ static PyObject *py_arch_processor_new(PyTypeObject *type, PyObject *args, PyObj
static void py_arch_processor_init_gclass(GArchProcessorClass *class, gpointer unused)
{
+ GType type; /* Type d'instances concerné */
+ GArchProcessor *pattern; /* Patron de données à copier */
+
+ type = G_TYPE_FROM_CLASS(class);
+
+ pattern = get_dynamic_type_pattern(type);
+
+ if (pattern != NULL)
+ {
+ /*
+ class->endianness = pattern->endianness;
+ class->memsize = pattern->memsize;
+ class->inssize = pattern->inssize;
+ class->virt_space = pattern->virt_space;
+ */
+ }
+
class->get_ctx = py_arch_processor_get_context_wrapper;
class->disassemble = py_arch_processor_disassemble_wrapper;
@@ -230,20 +247,6 @@ static void py_arch_processor_init_gclass(GArchProcessorClass *class, gpointer u
static void py_arch_processor_init_ginstance(GArchProcessor *proc, GArchProcessor *class)
{
- GType type; /* Type d'instances concerné */
- GArchProcessor *pattern; /* Patron de données à copier */
-
- type = G_TYPE_FROM_INSTANCE(proc);
-
- pattern = get_dynamic_type_pattern(type);
-
- if (pattern != NULL)
- {
- proc->endianness = pattern->endianness;
- proc->memsize = pattern->memsize;
- proc->inssize = pattern->inssize;
- proc->virt_space = pattern->virt_space;
- }
}
@@ -294,10 +297,12 @@ static int py_arch_processor_init(PyObject *self, PyObject *args, PyObject *kwds
proc = G_ARCH_PROCESSOR(pygobject_get(self));
+ /*
proc->endianness = endianness;
proc->memsize = mem_size;
proc->inssize = ins_min_size;
proc->virt_space = vspace;
+ */
register_dynamic_type_pattern(G_OBJECT(proc));
diff --git a/plugins/pychrysalide/core/processors.c b/plugins/pychrysalide/core/processors.c
index 56498f3..47e4643 100644
--- a/plugins/pychrysalide/core/processors.c
+++ b/plugins/pychrysalide/core/processors.c
@@ -43,11 +43,8 @@
/* Enregistre un processeur pour une architecture donnée. */
static PyObject *py_processors_register_type(PyObject *, PyObject *);
-/* Fournit le nom humain de l'architecture visée. */
-static PyObject *py_processors_get_description(PyObject *, PyObject *);
-
/* Fournit le processeur d'architecture correspondant à un nom. */
-static PyObject *py_processors_get_for_name(PyObject *, PyObject *);
+static PyObject *py_processors_get_for_key(PyObject *, PyObject *);
@@ -67,8 +64,6 @@ static PyObject *py_processors_get_for_name(PyObject *, PyObject *);
static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
- const char *name; /* Nom technique de processeur */
- const char *desc; /* description humaine liée */
PyObject *type; /* Type d'une instance future */
int ret; /* Bilan de lecture des args. */
PyObject *new_args; /* Nouveaux arguments épurés */
@@ -77,7 +72,7 @@ static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
GType instance; /* Type pour futures instances */
bool status; /* Bilan d'un enregistrement */
- ret = PyArg_ParseTuple(args, "ssO!", &name, &desc, &PyType_Type, &type);
+ ret = PyArg_ParseTuple(args, "O!", &PyType_Type, &type);
if (!ret) return NULL;
ret = PyObject_IsSubclass(type, (PyObject *)get_python_arch_processor_type());;
@@ -112,7 +107,7 @@ static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
Py_DECREF(dummy);
- status = register_processor_type(name, desc, instance);
+ status = register_processor_type(instance);
result = status ? Py_True : Py_False;
Py_INCREF(result);
@@ -127,45 +122,6 @@ static PyObject *py_processors_register_type(PyObject *self, PyObject *args)
* Paramètres : self = objet Python concerné par l'appel. *
* args = arguments fournis à l'appel. *
* *
-* Description : Fournit le nom humain de l'architecture visée. *
-* *
-* Retour : Désignation humaine trouvée ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_processors_get_description(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Bilan à retourner */
- const char *name; /* Nom technique de processeur */
- int ret; /* Bilan de lecture des args. */
- const char *desc; /* Description humaine obtenue */
-
- ret = PyArg_ParseTuple(args, "s", &name);
- if (!ret) return NULL;
-
- desc = get_arch_processor_description(name);
-
- if (desc != NULL)
- result = PyUnicode_FromString(desc);
-
- else
- {
- result = Py_None;
- Py_INCREF(result);
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* args = arguments fournis à l'appel. *
-* *
* Description : Fournit le processeur d'architecture correspondant à un nom. *
* *
* Retour : Processeur d'architecture trouvé. *
@@ -174,7 +130,7 @@ static PyObject *py_processors_get_description(PyObject *self, PyObject *args)
* *
******************************************************************************/
-static PyObject *py_processors_get_for_name(PyObject *self, PyObject *args)
+static PyObject *py_processors_get_for_key(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
const char *name; /* Nom technique de processeur */
@@ -184,7 +140,7 @@ static PyObject *py_processors_get_for_name(PyObject *self, PyObject *args)
ret = PyArg_ParseTuple(args, "s", &name);
if (!ret) return NULL;
- proc = get_arch_processor_for_name(name);
+ proc = get_arch_processor_for_key(name);
if (proc != NULL)
{
@@ -226,14 +182,9 @@ bool populate_core_module_with_processors(void)
"register_processor(name, desc, cls, /)\n--\n\nRegister an an architecture processor by its name, description and class type."
},
{
- "get_processor_description", py_processors_get_description,
- METH_VARARGS,
- "get_processor_description(name, /)\n--\n\nProvide the description of a given architecture processor."
- },
- {
- "get_processor_for_name", py_processors_get_for_name,
+ "get_processor_for_key", py_processors_get_for_key,
METH_VARARGS,
- "get_processor_for_name(name, /)\n--\n\nProvide an instance of an architecture processor for a given name."
+ "get_processor_for_key(name, /)\n--\n\nProvide an instance of an architecture processor for a given name."
},
{ NULL }
diff --git a/plugins/pychrysalide/format/executable.c b/plugins/pychrysalide/format/executable.c
index 5621d26..f49a459 100644
--- a/plugins/pychrysalide/format/executable.c
+++ b/plugins/pychrysalide/format/executable.c
@@ -361,7 +361,7 @@ int convert_to_vmpa_using_executable(PyObject *obj, exe_cv_info_t *info)
{
arch = g_exe_format_get_target_machine(info->format);
- conv.proc = get_arch_processor_for_name(arch);
+ conv.proc = get_arch_processor_for_key(arch);
if (conv.proc != NULL)
{
diff --git a/plugins/ropgadgets/finder.c b/plugins/ropgadgets/finder.c
index b9a4500..5d0e9c2 100644
--- a/plugins/ropgadgets/finder.c
+++ b/plugins/ropgadgets/finder.c
@@ -387,7 +387,7 @@ found_rop_list *list_all_gadgets(GExeFormat *format, unsigned int max_depth, upd
domain.content = g_binary_format_get_content(G_BIN_FORMAT(format));
target = g_exe_format_get_target_machine(format);
- domain.proc = get_arch_processor_for_name(target);
+ domain.proc = get_arch_processor_for_key(target);
bool collect_x_ranges(GBinPortion *portion, GBinPortion *parent, BinaryPortionVisit visit, void *unused)
{
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 2bcc88d..cfb4ea0 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -1701,8 +1701,8 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool cache, wgroup_id
{
bool result; /* Bilan à retourner */
GBinFormat *format; /* Format lié au binaire */
- const char *desc; /* Description humaine associée*/
const char *arch; /* Architecture d'exécution */
+ const char *desc; /* Description humaine associée*/
bool has_virt; /* Présence de virtuel ? */
GProcContext *context; /* Contexte de suivi dédié */
GWidthTracker *tracker; /* Gestionnaire de largeur */
@@ -1724,26 +1724,27 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool cache, wgroup_id
/* Architecture visée */
arch = g_exe_format_get_target_machine(binary->format);
- desc = get_arch_processor_description(arch);
- if (desc == NULL)
+ if (arch == NULL)
{
log_simple_message(LMT_INFO, _("Unknown architecture"));
result = false;
goto glba_exit;
}
- else
- log_variadic_message(LMT_INFO, _("Detected architecture: %s"), desc);
- binary->proc = get_arch_processor_for_name(arch);
+ binary->proc = get_arch_processor_for_key(arch);
if (binary->proc == NULL)
{
- log_simple_message(LMT_ERROR, _("Unable to load the required processor"));
+ log_variadic_message(LMT_ERROR, _("Unable to load the required processor (%s)"), arch);
result = false;
goto glba_exit;
}
+ desc = g_arch_processor_get_desc(binary->proc);
+
+ log_variadic_message(LMT_INFO, _("Detected architecture: %s"), desc);
+
g_signal_connect(binary->proc, "changed", G_CALLBACK(on_binary_processor_changed), binary);
has_virt = g_arch_processor_has_virtual_space(binary->proc);
diff --git a/src/arch/processor-int.h b/src/arch/processor-int.h
index 475fadc..d29539b 100644
--- a/src/arch/processor-int.h
+++ b/src/arch/processor-int.h
@@ -66,11 +66,6 @@ struct _GArchProcessor
{
GObject parent; /* A laisser en premier */
- SourceEndian endianness; /* Boutisme de l'architecture */
- MemoryDataSize memsize; /* Taille de l'espace mémoire */
- MemoryDataSize inssize; /* Taille min. d'encodage */
- bool virt_space; /* Présence d'espace virtuel ? */
-
GArchInstruction **instructions; /* Instructions désassemblées */
size_t instr_count; /* Taille de la liste aplatie */
unsigned int stamp; /* Marque de suivi des modifs */
@@ -97,6 +92,14 @@ 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 */
+ MemoryDataSize memsize; /* Taille de l'espace mémoire */
+ 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 */
disass_instr_fc disassemble; /* Traduction en instructions */
diff --git a/src/arch/processor.c b/src/arch/processor.c
index dccd12e..644a1ca 100644
--- a/src/arch/processor.c
+++ b/src/arch/processor.c
@@ -275,6 +275,58 @@ static GProcContext *_g_arch_processor_get_context(const GArchProcessor *proc)
* *
* Paramètres : proc = processeur d'architecture à consulter. *
* *
+* Description : Fournit la désignation interne du processeur d'architecture. *
+* *
+* Retour : Simple chaîne de caractères. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const char *g_arch_processor_get_key(const GArchProcessor *proc)
+{
+ const char *result; /* Désignation à renvoyer */
+ GArchProcessorClass *class; /* Classe de l'instance */
+
+ class = G_ARCH_PROCESSOR_GET_CLASS(proc);
+
+ result = class->key;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = processeur d'architecture à consulter. *
+* *
+* Description : Fournit le nom humain de l'architecture visée. *
+* *
+* Retour : Désignation humaine associée au processeur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const char *g_arch_processor_get_desc(const GArchProcessor *proc)
+{
+ const char *result; /* Désignation à renvoyer */
+ GArchProcessorClass *class; /* Classe de l'instance */
+
+ class = G_ARCH_PROCESSOR_GET_CLASS(proc);
+
+ result = class->desc;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = processeur d'architecture à consulter. *
+* *
* Description : Fournit le boustime du processeur d'une architecture. *
* *
* Retour : Boutisme associé au processeur. *
@@ -285,7 +337,14 @@ static GProcContext *_g_arch_processor_get_context(const GArchProcessor *proc)
SourceEndian g_arch_processor_get_endianness(const GArchProcessor *proc)
{
- return proc->endianness;
+ SourceEndian result; /* Boutisme à retourner */
+ GArchProcessorClass *class; /* Classe de l'instance */
+
+ class = G_ARCH_PROCESSOR_GET_CLASS(proc);
+
+ result = class->endianness;
+
+ return result;
}
@@ -304,7 +363,14 @@ SourceEndian g_arch_processor_get_endianness(const GArchProcessor *proc)
MemoryDataSize g_arch_processor_get_memory_size(const GArchProcessor *proc)
{
- return proc->memsize;
+ MemoryDataSize result; /* Taille à retourner */
+ GArchProcessorClass *class; /* Classe de l'instance */
+
+ class = G_ARCH_PROCESSOR_GET_CLASS(proc);
+
+ result = class->memsize;
+
+ return result;
}
@@ -323,7 +389,14 @@ MemoryDataSize g_arch_processor_get_memory_size(const GArchProcessor *proc)
MemoryDataSize g_arch_processor_get_instruction_min_size(const GArchProcessor *proc)
{
- return proc->inssize;
+ MemoryDataSize result; /* Taille à retourner */
+ GArchProcessorClass *class; /* Classe de l'instance */
+
+ class = G_ARCH_PROCESSOR_GET_CLASS(proc);
+
+ result = class->inssize;
+
+ return result;
}
@@ -342,7 +415,14 @@ MemoryDataSize g_arch_processor_get_instruction_min_size(const GArchProcessor *p
bool g_arch_processor_has_virtual_space(const GArchProcessor *proc)
{
- return proc->virt_space;
+ bool result; /* Indication à retourner */
+ GArchProcessorClass *class; /* Classe de l'instance */
+
+ class = G_ARCH_PROCESSOR_GET_CLASS(proc);
+
+ result = class->virt_space;
+
+ return result;
}
diff --git a/src/arch/processor.h b/src/arch/processor.h
index 26eddb1..0b33a50 100644
--- a/src/arch/processor.h
+++ b/src/arch/processor.h
@@ -55,6 +55,12 @@ typedef struct _GArchProcessorClass GArchProcessorClass;
/* Indique le type défini pour un processeur d'architecture. */
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 *);
+
+/* Fournit le nom humain de l'architecture visée. */
+const char *g_arch_processor_get_desc(const GArchProcessor *);
+
/* Fournit le boustime du processeur d'une architecture. */
SourceEndian g_arch_processor_get_endianness(const GArchProcessor *);
diff --git a/src/core/processors.c b/src/core/processors.c
index 631e819..42d4e4b 100644
--- a/src/core/processors.c
+++ b/src/core/processors.c
@@ -40,9 +40,8 @@
/* Caractéristiques d'un processeur */
typedef struct _proc_t
{
- char *name; /* Clef pour un accès rapide */
- char *desc; /* Désignation humaine */
- GType instance; /* Type à manipuler en interne */
+ char *key; /* Clef pour un accès rapide */
+ GType type; /* Type à manipuler en interne */
} proc_t;
@@ -85,9 +84,7 @@ void register_arch_gtypes(void)
/******************************************************************************
* *
-* Paramètres : name = désignation rapide et interne d'un processeur. *
-* desc = désignation humaine de l'architecture. *
-* instance = type GLib représentant le type à instancier. *
+* Paramètres : type = type GLib représentant le type à instancier. *
* *
* Description : Enregistre un processeur pour une architecture donnée. *
* *
@@ -97,32 +94,39 @@ void register_arch_gtypes(void)
* *
******************************************************************************/
-bool register_processor_type(const char *name, const char *desc, GType instance)
+bool register_processor_type(GType type)
{
bool result; /* Bilan à retourner */
+ GArchProcessor *proc; /* Instance pour consultation */
+ const char *key; /* Désignation associée */
proc_t *new; /* Nouvel élément à définir */
+ proc = g_object_new(type, NULL);
+
+ key = g_arch_processor_get_key(proc);
+
G_LOCK(_pdef_access);
- new = find_processor_by_key(name);
+ new = find_processor_by_key(key);
result = (new == NULL);
if (result)
{
- _processors_definitions = (proc_t *)realloc(_processors_definitions,
- ++_processors_definitions_count * sizeof(proc_t));
+ _processors_definitions = realloc(_processors_definitions,
+ ++_processors_definitions_count * sizeof(proc_t));
new = &_processors_definitions[_processors_definitions_count - 1];
- new->name = strdup(name);
- new->desc = strdup(desc);
- new->instance = instance;
+ new->key = strdup(key);
+ new->type = type;
}
G_UNLOCK(_pdef_access);
+ g_object_unref(G_OBJECT(proc));
+
return result;
}
@@ -147,10 +151,7 @@ void unload_processors_definitions(void)
G_LOCK(_pdef_access);
for (i = 0; i < _processors_definitions_count; i++)
- {
- free(_processors_definitions[i].name);
- free(_processors_definitions[i].desc);
- }
+ free(_processors_definitions[i].key);
if (_processors_definitions != NULL)
free(_processors_definitions);
@@ -165,7 +166,7 @@ void unload_processors_definitions(void)
/******************************************************************************
* *
-* Paramètres : name = nom technique du processeur recherché. *
+* Paramètres : key = nom technique du processeur recherché. *
* *
* Description : Retrouve l'enregistrement correspondant à une architecture. *
* *
@@ -175,7 +176,7 @@ void unload_processors_definitions(void)
* *
******************************************************************************/
-static proc_t *find_processor_by_key(const char *name)
+static proc_t *find_processor_by_key(const char *key)
{
proc_t *result; /* Trouvaille à retourner */
size_t i; /* Boucle de parcours */
@@ -186,9 +187,9 @@ static proc_t *find_processor_by_key(const char *name)
result = NULL;
- if (name != NULL)
+ if (key != NULL)
for (i = 0; i < _processors_definitions_count; i++)
- if (strcmp(_processors_definitions[i].name, name) == 0)
+ if (strcmp(_processors_definitions[i].key, key) == 0)
result = &_processors_definitions[i];
return result;
@@ -198,40 +199,7 @@ static proc_t *find_processor_by_key(const char *name)
/******************************************************************************
* *
-* Paramètres : name = nom technique du processeur recherché. *
-* *
-* Description : Fournit le nom humain de l'architecture visée. *
-* *
-* Retour : Désignation humaine trouvée ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const char *get_arch_processor_description(const char *name)
-{
- const char *result; /* Description à retourner */
- proc_t *def; /* Définition d'architecture */
-
- G_LOCK(_pdef_access);
-
- def = find_processor_by_key(name);
-
- if (def == NULL)
- result = NULL;
- else
- result = def->desc;
-
- G_UNLOCK(_pdef_access);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : name = nom technique du processeur recherché. *
+* Paramètres : key = nom technique du processeur recherché. *
* *
* Description : Fournit le processeur d'architecture correspondant à un nom. *
* *
@@ -241,19 +209,19 @@ const char *get_arch_processor_description(const char *name)
* *
******************************************************************************/
-GArchProcessor *get_arch_processor_for_name(const char *name)
+GArchProcessor *get_arch_processor_for_key(const char *key)
{
GArchProcessor *result; /* Instance à retourner */
proc_t *def; /* Définition d'architecture */
G_LOCK(_pdef_access);
- def = find_processor_by_key(name);
+ def = find_processor_by_key(key);
if (def == NULL)
result = NULL;
else
- result = g_object_new(def->instance, NULL);
+ result = g_object_new(def->type, NULL);
G_UNLOCK(_pdef_access);
diff --git a/src/core/processors.h b/src/core/processors.h
index 975c716..034f219 100644
--- a/src/core/processors.h
+++ b/src/core/processors.h
@@ -36,16 +36,13 @@
void register_arch_gtypes(void);
/* Enregistre un processeur pour une architecture donnée. */
-bool register_processor_type(const char *, const char *, GType);
+bool register_processor_type(GType);
/* Décharge toutes les définitions de processeurs. */
void unload_processors_definitions(void);
-/* Fournit le nom humain de l'architecture visée. */
-const char *get_arch_processor_description(const char *);
-
/* Fournit le processeur d'architecture correspondant à un nom. */
-GArchProcessor *get_arch_processor_for_name(const char *);
+GArchProcessor *get_arch_processor_for_key(const char *);