summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-06-08 12:46:23 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-06-08 12:46:23 (GMT)
commitfc8324b66dee0abf0a5e5e3cc570e1aed96b80c8 (patch)
tree04b9220e34b8bdc3449cd73e54a32c5037be5f0c /src/arch
parentdd75712aac8f70d18f07787d5d484d426600edeb (diff)
Refreshed the panel dealing with found symbols.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@72 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/jvm/processor.c1
-rw-r--r--src/arch/mips/processor.c1
-rw-r--r--src/arch/processor-int.h1
-rw-r--r--src/arch/processor.c60
-rw-r--r--src/arch/processor.h29
-rw-r--r--src/arch/x86/processor.c1
6 files changed, 71 insertions, 22 deletions
diff --git a/src/arch/jvm/processor.c b/src/arch/jvm/processor.c
index 8226afc..034b864 100644
--- a/src/arch/jvm/processor.c
+++ b/src/arch/jvm/processor.c
@@ -98,6 +98,7 @@ static void g_jvm_processor_init(GJvmProcessor *proc)
parent = G_ARCH_PROCESSOR(proc);
parent->endianness = SRE_BIG;
+ parent->memsize = MDS_32_BITS;
parent->decode = (decode_instruction_fc)g_jvm_processor_decode_instruction;
diff --git a/src/arch/mips/processor.c b/src/arch/mips/processor.c
index c28c7b4..7e921c1 100644
--- a/src/arch/mips/processor.c
+++ b/src/arch/mips/processor.c
@@ -97,6 +97,7 @@ static void g_mips_processor_init(GMipsProcessor *proc)
parent = G_ARCH_PROCESSOR(proc);
parent->endianness = SRE_BIG;
+ parent->memsize = MDS_32_BITS;
parent->decode = (decode_instruction_fc)g_mips_processor_decode_instruction;
diff --git a/src/arch/processor-int.h b/src/arch/processor-int.h
index bbe2384..fc9097e 100644
--- a/src/arch/processor-int.h
+++ b/src/arch/processor-int.h
@@ -58,6 +58,7 @@ struct _GArchProcessor
GObject parent; /* A laisser en premier */
SourceEndian endianness; /* Boutisme de l'architecture */
+ MemoryDataSize memsize; /* Taille de l'espace mémoire */
decode_instruction_fc decode; /* Traduction en instructions */
diff --git a/src/arch/processor.c b/src/arch/processor.c
index 317e893..c8630d7 100644
--- a/src/arch/processor.c
+++ b/src/arch/processor.c
@@ -132,6 +132,25 @@ SourceEndian g_arch_processor_get_endianness(const GArchProcessor *proc)
/******************************************************************************
* *
+* Paramètres : proc = processeur d'architecture à consulter. *
+* *
+* Description : Fournit la taille de l'espace mémoire d'une architecture. *
+* *
+* Retour : Taille de l'espace mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+MemoryDataSize g_arch_processor_get_memory_size(const GArchProcessor *proc)
+{
+ return proc->memsize;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : proc = architecture visée par la procédure. *
* data = flux de données à analyser. *
* pos = position courante dans ce flux. [OUT] *
@@ -216,3 +235,44 @@ GArchProcessor *get_arch_processor_for_type(ArchProcessorType type)
return _processors_list[type];
}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = exécutable d'origine. *
+* *
+* Description : Fournit le processeur d'architecture lié à un format. *
+* *
+* Retour : Processeur d'architecture trouvé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchProcessor *get_arch_processor_from_format(const exe_format *format)
+{
+ GArchProcessor *result; /* Conversion à retourner */
+
+ switch (get_exe_target_machine(format))
+ {
+ case FTM_JVM:
+ result = get_arch_processor_for_type(APT_JVM);
+ break;
+
+ case FTM_MIPS:
+ result = get_arch_processor_for_type(APT_MIPS);
+ break;
+
+ case FTM_386:
+ result = get_arch_processor_for_type(APT_386);
+ break;
+
+ default:
+ result = NULL;
+ break;
+
+ }
+
+ return result;
+
+}
diff --git a/src/arch/processor.h b/src/arch/processor.h
index 5726197..8529d50 100644
--- a/src/arch/processor.h
+++ b/src/arch/processor.h
@@ -25,31 +25,10 @@
#define _ARCH_PROCESSOR_H
-#include <sys/types.h>
-
-
-#include "operand.h" /* AsmSyntax */
-#include "instruction.h"
-
-
-
-/* FIXME : lieu de définition temporaire */
-
-/* Mode d'adressage à utiliser */
-typedef enum _AdressMode
-{
- ADM_32BITS, /* Adresses sur 32 bits */
- ADM_64BITS /* Adresses sur 64 bits */
-
-} AdressMode;
-
-
-
-
-
#include <glib-object.h>
+#include "instruction.h"
#include "../common/endianness.h"
@@ -73,6 +52,9 @@ GType g_arch_processor_get_type(void);
/* Fournit le boustime du processeur d'une architecture. */
SourceEndian g_arch_processor_get_endianness(const GArchProcessor *);
+/* Fournit la taille de l'espace mémoire d'une architecture. */
+MemoryDataSize g_arch_processor_get_memory_size(const GArchProcessor *);
+
/* Décode une instruction dans un flux de données. */
GArchInstruction *g_arch_processor_decode_instruction(const GArchProcessor *, const bin_t *, off_t *, off_t, off_t, vmpa_t);
@@ -99,6 +81,9 @@ bool init_all_processors(void);
/* Fournit le processeur d'architecture correspondant à un type. */
GArchProcessor *get_arch_processor_for_type(ArchProcessorType);
+/* Fournit le processeur d'architecture lié à un format. */
+GArchProcessor *get_arch_processor_from_format(const exe_format *);
+
#endif /* _ARCH_PROCESSOR_H */
diff --git a/src/arch/x86/processor.c b/src/arch/x86/processor.c
index 8af84b2..7370da1 100644
--- a/src/arch/x86/processor.c
+++ b/src/arch/x86/processor.c
@@ -97,6 +97,7 @@ static void g_x86_processor_init(GX86Processor *proc)
parent = G_ARCH_PROCESSOR(proc);
parent->endianness = SRE_BIG;
+ parent->memsize = MDS_32_BITS;
parent->decode = (decode_instruction_fc)g_x86_processor_decode_instruction;