summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-02-09 20:15:52 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-02-09 20:15:52 (GMT)
commit8d326041a0379b87e54be44506d544367567e89b (patch)
treea3c3555c27c30858155fbee4df0ca236f33774f8 /src/analysis/disass
parentb70f428256963385a140e9eb503624106df5aa9b (diff)
Registered all the supported processors in the system code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@467 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/area.c10
-rw-r--r--src/analysis/disass/disassembler.c5
-rw-r--r--src/analysis/disass/fetch.c13
-rw-r--r--src/analysis/disass/output.c6
-rw-r--r--src/analysis/disass/output.h3
5 files changed, 22 insertions, 15 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index 17df2af..a6e58cd 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -440,7 +440,7 @@ void load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons
/* Récupération des informations de base */
format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
- proc = get_arch_processor_from_format(G_EXE_FORMAT(format));
+ proc = g_loaded_binary_get_processor(binary);
bin_data = g_loaded_binary_get_data(binary, &bin_length);
area = (*list) + *index;
@@ -581,6 +581,9 @@ void load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons
printf("\n");
+ g_object_unref(G_OBJECT(proc));
+
+
}
@@ -626,8 +629,11 @@ static void load_data_from_mem_area(mem_area *area, mem_area *list, size_t count
/* Récupération des informations de base */
format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
- proc = get_arch_processor_from_format(G_EXE_FORMAT(format));
+
+ proc = g_loaded_binary_get_processor(binary);
endianness = g_arch_processor_get_endianness(proc);
+ g_object_unref(G_OBJECT(proc));
+
bin_data = g_loaded_binary_get_data(binary, &bin_length);
diff = compute_vmpa_diff(get_mrange_addr(&area->range), start);
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index ac6eb5b..c39073c 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -199,6 +199,7 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkExtSta
bstatus_id_t id; /* Identifiant de statut */
+ GArchProcessor *proc; /* Architecture du binaire */
@@ -268,10 +269,12 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkExtSta
qsort(routines, routines_count, sizeof(GBinRoutine *), (__compar_fn_t)g_binary_routine_compare);
+ proc = g_loaded_binary_get_processor(disass->binary);
- print_disassembled_instructions(disass->buffer, disass->format, *disass->instrs,
+ print_disassembled_instructions(disass->buffer, disass->format, proc, *disass->instrs,
routines, routines_count, statusbar, id);
+ g_object_unref(G_OBJECT(proc));
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index b912ff2..16b81c8 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -143,7 +143,7 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
{
GArchInstruction *result; /* Instruction désassemblées */
GBinFormat *format; /* Format du fichier binaire */
- //GArchProcessor *proc; /* Architecture du binaire */
+ GArchProcessor *proc; /* Architecture du binaire */
GProcContext *ctx; /* Contexte de désassemblage */
off_t length; /* Taille des données à lire */
mem_area *areas; /* Zone de productions */
@@ -158,15 +158,10 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
double done; /* Portion de travail accompli */
format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
-
- /*
- proc = get_arch_processor_from_format(G_EXE_FORMAT(format));
+ proc = g_loaded_binary_get_processor(binary);
ctx = g_arch_processor_get_context(proc);
- */
-
- ctx = g_binary_format_get_disassembling_context(format);
-
+ g_binary_format_setup_disassembling_context(format, ctx);
/* Définition à la découpe des parties à traiter */
@@ -234,6 +229,8 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
/* free */
+ g_object_unref(G_OBJECT(proc));
+
return result;
}
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index 87d0407..2ecb5f4 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -49,10 +49,10 @@
* *
******************************************************************************/
-void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *format, const GArchInstruction *instrs, GBinRoutine * const *routines, size_t count, GtkExtStatusBar *statusbar, bstatus_id_t id)
+void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *format, GArchProcessor *proc, const GArchInstruction *instrs, GBinRoutine * const *routines, size_t count, GtkExtStatusBar *statusbar, bstatus_id_t id)
{
GLangOutput *output; /* Modèle de sortie adéquat */
- GArchProcessor *proc; /* Architecture du binaire */
+ //GArchProcessor *proc; /* Architecture du binaire */
MemoryDataSize msize; /* Taille du bus d'adresses */
const bin_t *content; /* Contenu binaire global */
@@ -121,7 +121,7 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
- proc = get_arch_processor_from_format(format);
+ //proc = get_arch_processor_from_format(format);
msize = g_arch_processor_get_memory_size(proc);
content = g_binary_format_get_content(G_BIN_FORMAT(format), NULL);
diff --git a/src/analysis/disass/output.h b/src/analysis/disass/output.h
index 04cb643..549fa23 100644
--- a/src/analysis/disass/output.h
+++ b/src/analysis/disass/output.h
@@ -27,13 +27,14 @@
#include "../routine.h"
#include "../../arch/instruction.h"
+#include "../../arch/processor.h"
#include "../../glibext/gcodebuffer.h"
#include "../../gtkext/gtkextstatusbar.h"
/* Transcrit du code désassemblé en texte humainement lisible. */
-void print_disassembled_instructions(GCodeBuffer *, const GExeFormat *, const GArchInstruction *, GBinRoutine * const *, size_t, GtkExtStatusBar *, bstatus_id_t);
+void print_disassembled_instructions(GCodeBuffer *, const GExeFormat *, GArchProcessor *, const GArchInstruction *, GBinRoutine * const *, size_t, GtkExtStatusBar *, bstatus_id_t);