summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/area.c25
-rw-r--r--src/analysis/disass/fetch.c7
2 files changed, 17 insertions, 15 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index 4c54a27..a7c44c0 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -474,8 +474,7 @@ bool load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons
GBinFormat *format; /* Format du fichier binaire */
GArchProcessor *proc; /* Architecture du binaire */
- off_t bin_length; /* Taille des données à lire */
- bin_t *bin_data; /* Données binaires à lire */
+ GBinContent *content; /* Données binaires à lire */
phys_t diff; /* Volume de données traité */
phys_t alen; /* Taille de l'aire utilisée */
@@ -510,7 +509,8 @@ bool load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons
format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
proc = g_loaded_binary_get_processor(binary);
- bin_data = g_loaded_binary_get_data(binary, &bin_length);
+ content = g_binary_format_get_conten_(format);
+ /* TODO : unref */
area = (*list) + *index;
@@ -532,8 +532,6 @@ bool load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons
printf(" START @ 0x%08x\n", (unsigned int)get_virt_addr(&pos));
- bin_length = (get_phy_addr(get_mrange_addr(&area->range)) + alen);
-
for (i = diff; i < alen; i += diff)
{
@@ -544,7 +542,9 @@ bool load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons
copy_vmpa(&prev, &pos);
- instr = g_arch_processor_disassemble(proc, ctx, bin_data, &pos, bin_length);
+ instr = g_arch_processor_disassemble(proc, ctx, content, &pos);
+
+ /* TODO : valider que la taille de l'instruction obtenue ne dépasse pas la zone */
//printf(" @ 0x%08x -> %p\n", (uint32_t)get_virt_addr(&prev), instr);
@@ -660,10 +660,9 @@ bool load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons
static void load_data_from_mem_area(mem_area *area, mem_area *list, size_t count, const GLoadedBinary *binary, GProcContext *ctx, const vmpa2t *start, status_blob_info *info)
{
GBinFormat *format; /* Format du fichier binaire */
+ GBinContent *content; /* Données binaires à lire */
GArchProcessor *proc; /* Architecture du binaire */
SourceEndian endianness; /* Boutisme de cette machine */
- off_t bin_length; /* Taille des données à lire */
- bin_t *bin_data; /* Données binaires à lire */
phys_t diff; /* Volume de données traité */
phys_t alen; /* Taille de l'aire utilisée */
phys_t i; /* Boucle de parcours */
@@ -681,13 +680,13 @@ 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));
+ content = g_binary_format_get_conten_(format);
+ /* TODO g_object_unref(G_OBJECT(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);
alen = get_mrange_length(&area->range);
@@ -718,7 +717,7 @@ static void load_data_from_mem_area(mem_area *area, mem_area *list, size_t count
init_mrange(&range, &pos, 4);
if (is_range_blank_in_mem_areas(list, count, &range))
- instr = g_raw_instruction_new_array_old(bin_data, MDS_32_BITS, 1, &pos, bin_length, endianness);
+ instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, &pos, endianness);
}
*/
@@ -728,7 +727,7 @@ static void load_data_from_mem_area(mem_area *area, mem_area *list, size_t count
init_mrange(&range, &pos, 2);
if (is_range_blank_in_mem_areas(list, count, &range))
- instr = g_raw_instruction_new_array_old(bin_data, MDS_16_BITS, 1, &pos, bin_length, endianness);
+ instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endianness);
}
@@ -738,7 +737,7 @@ static void load_data_from_mem_area(mem_area *area, mem_area *list, size_t count
init_mrange(&range, &pos, 1);
if (is_range_blank_in_mem_areas(list, count, &range))
- instr = g_raw_instruction_new_array_old(bin_data, MDS_8_BITS, 1, &pos, bin_length, endianness);
+ instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, &pos, endianness);
else
{
/**
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index b30d5a6..d7de724 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -148,7 +148,8 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
GBinFormat *format; /* Format du fichier binaire */
GArchProcessor *proc; /* Architecture du binaire */
GProcContext *ctx; /* Contexte de désassemblage */
- off_t length; /* Taille des données à lire */
+ GBinContent *content; /* Contenu binaire à manipuler */
+ phys_t length; /* Taille des données à lire */
mem_area *areas; /* Zone de productions */
size_t count; /* Nombre de ces zones */
status_blob_info *info; /* Informations de progression */
@@ -168,7 +169,9 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
/* Définition à la découpe des parties à traiter */
- g_loaded_binary_get_data(binary, &length);
+ content = g_binary_format_get_conten_(format);
+ length = g_binary_content_compute_size(content);
+
areas = compute_memory_areas(G_EXE_FORMAT(format), length, &count);
/**