summaryrefslogtreecommitdiff
path: root/src/analysis/disass/fetch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/disass/fetch.c')
-rw-r--r--src/analysis/disass/fetch.c146
1 files changed, 22 insertions, 124 deletions
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index ab3f3c7..9df9248 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -35,13 +35,7 @@
-
-
-
-
-
/* ------------------------- RECUPERATIONS EN TOILE DE FOND ------------------------- */
-/* ------------------------ DESASSEMBLAGE DE BINAIRE DIFFERE ------------------------ */
#define G_TYPE_DELAYED_FETCHING g_delayed_fetching_get_type()
@@ -62,7 +56,7 @@ typedef struct _GDelayedFetching
GExeFormat *format; /* Format du fichier binaire */
GProcContext *ctx; /* Contexte de désassemblage */
- mem_area_v2 *areas; /* Zone de productions */
+ mem_area *areas; /* Zone de productions */
size_t count; /* Nombre de ces zones */
GtkStatusStack *status; /* Barre de statut */
@@ -100,29 +94,18 @@ static void g_delayed_fetching_finalize(GDelayedFetching *);
static GDelayedFetching *g_delayed_fetching_new(const GDelayedFetching *, DisassPriorityLevel, virt_t);
/* Assure la récupération d'instructions en différé. */
-static void g_delayed_fetching_process(GDelayedFetching *, GtkExtStatusBar *);
-
-
-
-
-
-
+static void g_delayed_fetching_process(GDelayedFetching *, GtkStatusStack *);
-
-/* ------------------------ DESASSEMBLAGE DE BINAIRE DIFFERE ------------------------ */
/* ------------------------ DESASSEMBLAGE DE BINAIRE DIFFERE ------------------------ */
+/* Poursuit l'analyse à partir des points d'entrée découverts. */
+static void follow_execution_flow(GProcContext *, const GDelayedFetching *);
-
-/* Suit un flot d'exécution pour désassembler du code. */
-static void follow_execution_flow(const GLoadedBinary *, GProcContext *, mem_area **, size_t *, status_blob_info *);
-
-
-
-
+/* Etudie le besoin d'attendre d'avantage de prochaines tâches. */
+static bool check_if_extra_wait_is_needed(GWorkQueue *, wgroup_id_t, GProcContext *);
@@ -131,12 +114,6 @@ static void follow_execution_flow(const GLoadedBinary *, GProcContext *, mem_are
/* ---------------------------------------------------------------------------------- */
-
-
-
-
-
-
/* Indique le type défini pour les tâches de récupération différée. */
G_DEFINE_TYPE(GDelayedFetching, g_delayed_fetching, G_TYPE_DELAYED_WORK);
@@ -280,8 +257,8 @@ static GDelayedFetching *g_delayed_fetching_new(const GDelayedFetching *template
/******************************************************************************
* *
-* Paramètres : fetching = récupération à mener. *
-* statusbar = barre de statut à tenir informée. *
+* Paramètres : fetching = récupération à mener. *
+* status = barre de statut à tenir informée. *
* *
* Description : Assure la récupération d'instructions en différé. *
* *
@@ -291,18 +268,18 @@ static GDelayedFetching *g_delayed_fetching_new(const GDelayedFetching *template
* *
******************************************************************************/
-static void g_delayed_fetching_process(GDelayedFetching *fetching, GtkExtStatusBar *statusbar)
+static void g_delayed_fetching_process(GDelayedFetching *fetching, GtkStatusStack *status)
{
vmpa2t addr; /* Conversion en pleine adresse*/
- mem_area_v2 *area; /* Zone trouvée à traiter */
+ mem_area *area; /* Zone trouvée à traiter */
if (!g_exe_format_translate_address_into_vmpa(fetching->format, fetching->virt, &addr))
- return/*init_vmpa(&addr, VMPA_NO_PHYSICAL, fetching->virt)*/;
+ return;
- area = find_memory_area_by_addr_v2(fetching->areas, fetching->count, &addr);
+ area = find_memory_area_by_addr(fetching->areas, fetching->count, &addr);
if (area != NULL)
- load_code_from_mem_area_v2(area, fetching->areas, fetching->count,
+ load_code_from_mem_area(area, fetching->areas, fetching->count,
fetching->ctx, &addr, fetching->level < 2,
fetching->status, fetching->id);
@@ -310,21 +287,9 @@ static void g_delayed_fetching_process(GDelayedFetching *fetching, GtkExtStatusB
-
-
-
-
-
-
-
-/* Poursuit l'analyse à partir des points d'entrée découverts. */
-static void follow_execution_flow_v2(GProcContext *, const GDelayedFetching *);
-
-/* Etudie le besoin d'attendre d'avantage de prochaines tâches. */
-static bool check_if_extra_wait_is_needed(GWorkQueue *, wgroup_id_t, GProcContext *);
-
-
-
+/* ---------------------------------------------------------------------------------- */
+/* DESASSEMBLAGE DE BINAIRE DIFFERE */
+/* ---------------------------------------------------------------------------------- */
/******************************************************************************
@@ -340,7 +305,7 @@ static bool check_if_extra_wait_is_needed(GWorkQueue *, wgroup_id_t, GProcContex
* *
******************************************************************************/
-static void follow_execution_flow_v2(GProcContext *ctx, const GDelayedFetching *template)
+static void follow_execution_flow(GProcContext *ctx, const GDelayedFetching *template)
{
GWorkQueue *queue; /* Gestionnaire de différés */
gint *remaining_counter; /* Compteur à considérer */
@@ -410,73 +375,6 @@ static bool check_if_extra_wait_is_needed(GWorkQueue *queue, wgroup_id_t id, GPr
}
-
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = représentation de binaire chargé. *
-* ctx = contexte offert en soutien à un désassemblage. *
-* areas = liste de zones contenant des données à traiter. *
-* count = nombre de ces aires à disposition. *
-* info = informations liées à l'affichage de la progression. *
-* *
-* Description : Suit un flot d'exécution pour désassembler du code. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void follow_execution_flow(const GLoadedBinary *binary, GProcContext *ctx, mem_area **areas, size_t *count, status_blob_info *info)
-{
-#if 0
- virt_t virt; /* Adresse de départ dépilée */
- vmpa2t addr; /* Conversion en pleine adresse*/
- GExeFormat *format; /* Format du fichier binaire */
- size_t index; /* Zone trouvée à traiter */
-
- while (g_proc_context_has_drop_points(ctx))
- {
- g_proc_context_pop_drop_point(ctx, &virt);
-
- format = g_loaded_binary_get_format(binary);
-
- if (!g_exe_format_translate_address_into_vmpa(format, virt, &addr))
- init_vmpa(&addr, VMPA_NO_PHYSICAL, virt);
-
- printf(" ++ point 0x%08x\n", (unsigned int)virt);
-
-
- printf("looking area for 0x%08x\n", (unsigned int)virt);
-
- index = find_memory_area_by_addr(*areas, *count, &addr);
- if (index == *count) continue;
-
- assert(index < *count);
-
- load_code_from_mem_area(areas, count, &index, binary, ctx, &addr, info);
-
-
-
- printf(" ++\n");
-
-
- }
-#endif
-}
-
-static GDelayedFetching template; /* Patron des tâches à venir */
-
/******************************************************************************
* *
* Paramètres : binary = représentation de binaire chargé. *
@@ -495,7 +393,7 @@ static GDelayedFetching template; /* Patron des tâches à venir
GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GProcContext *ctx, wgroup_id_t gid, GtkStatusStack *status)
{
GArchInstruction *result; /* Instruction désassemblées */
- //GDelayedFetching template; /* Patron des tâches à venir */
+ GDelayedFetching template; /* Patron des tâches à venir */
GBinFormat *format; /* Format du fichier binaire */
GBinContent *content; /* Contenu binaire à manipuler */
phys_t length; /* Taille des données à lire */
@@ -515,7 +413,7 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GProcC
length = g_binary_content_compute_size(content);
g_object_unref(G_OBJECT(content));
- template.areas = compute_memory_areas_v2(binary, length, &template.count);
+ template.areas = compute_memory_areas(binary, length, &template.count);
template.status = status;
@@ -537,7 +435,7 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GProcC
(wait_for_incoming_works_cb)check_if_extra_wait_is_needed,
template.ctx);
- g_signal_connect(template.ctx, "drop-point-pushed", G_CALLBACK(follow_execution_flow_v2), &template);
+ g_signal_connect(template.ctx, "drop-point-pushed", G_CALLBACK(follow_execution_flow), &template);
template.id = gtk_status_stack_add_activity(status,
_("Disassembling following the execution flow..."),
@@ -567,7 +465,7 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GProcC
gtk_status_stack_update_activity(status, template.id, _("Collecting disassembled instructions..."));
- result = collect_instructions_from_mem_areas_v2(template.areas, template.count);
+ result = collect_instructions_from_mem_areas(template.areas, template.count);
gtk_status_stack_remove_activity(status, template.id);
@@ -575,7 +473,7 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GProcC
//g_object_unref(G_OBJECT(template.format));
- /* TODO / del(areas); */
+ release_mem_areas(template.areas, template.count);
return result;