diff options
Diffstat (limited to 'plugins/mobicore')
-rw-r--r-- | plugins/mobicore/mclf.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/plugins/mobicore/mclf.c b/plugins/mobicore/mclf.c index edb6a4a..3cab4a6 100644 --- a/plugins/mobicore/mclf.c +++ b/plugins/mobicore/mclf.c @@ -54,7 +54,7 @@ static void g_mclf_format_finalize(GMCLFFormat *); static const char *g_mclf_format_get_target_machine(const GMCLFFormat *); /* Etend la définition des portions au sein d'un binaire. */ -static void g_mclf_format_refine_portions(const GMCLFFormat *, GPortionLayer *); +static void g_mclf_format_refine_portions(GMCLFFormat *); @@ -262,7 +262,6 @@ static const char *g_mclf_format_get_target_machine(const GMCLFFormat *format) /****************************************************************************** * * * Paramètres : format = informations chargées à consulter. * -* main = couche de portions principale à raffiner. * * * * Description : Etend la définition des portions au sein d'un binaire. * * * @@ -272,59 +271,54 @@ static const char *g_mclf_format_get_target_machine(const GMCLFFormat *format) * * ******************************************************************************/ -static void g_mclf_format_refine_portions(const GMCLFFormat *format, GPortionLayer *main) +static void g_mclf_format_refine_portions(GMCLFFormat *format) { - GPortionLayer *layer; /* Couche à mettre en place */ + GExeFormat *exe_format; /* Autre version du format */ + vmpa2t addr; /* Emplacement dans le binaire */ GBinPortion *new; /* Nouvelle portion définie */ char desc[MAX_PORTION_DESC]; /* Description d'une portion */ phys_t length; /* Taille de portion globale */ - vmpa2t addr; /* Emplacement dans le binaire */ - - layer = g_portion_layer_new(NO_LENGTH_YET, _("Segment")); - g_portion_layer_attach_sub(main, layer); + exe_format = G_EXE_FORMAT(format); /* Segment de code */ - new = g_binary_portion_new(BPC_CODE); + init_vmpa(&addr, 0, format->header.v1.text.start); + + new = g_binary_portion_new(BPC_CODE, &addr, format->header.v1.text.len); sprintf(desc, "%s \"%s\"", _("Segment"), "text"); g_binary_portion_set_desc(new, desc); - init_vmpa(&addr, 0, format->header.v1.text.start); - g_binary_portion_set_values(new, &addr, format->header.v1.text.len); - g_binary_portion_set_rights(new, PAC_WRITE | PAC_EXEC); - g_portion_layer_include(layer, new); + g_exe_format_include_portion(exe_format, new); /* Segment de données */ - new = g_binary_portion_new(BPC_DATA); + init_vmpa(&addr, format->header.v1.text.len, format->header.v1.data.start); + + new = g_binary_portion_new(BPC_DATA, &addr, format->header.v1.data.len); sprintf(desc, "%s \"%s\"", _("Segment"), "data"); g_binary_portion_set_desc(new, desc); - init_vmpa(&addr, format->header.v1.text.len, format->header.v1.data.start); - g_binary_portion_set_values(new, &addr, format->header.v1.data.len); - g_binary_portion_set_rights(new, PAC_READ | PAC_WRITE); - g_portion_layer_include(layer, new); + g_exe_format_include_portion(exe_format, new); /* Signature finale */ - new = g_binary_portion_new(BPC_DATA); + length = g_binary_content_compute_size(G_BIN_FORMAT(format)->content); + init_vmpa(&addr, length - 521, VMPA_NO_VIRTUAL); /* FIXME */ + + new = g_binary_portion_new(BPC_DATA, &addr, 521); sprintf(desc, "%s \"%s\"", _("Segment"), "sig"); g_binary_portion_set_desc(new, desc); - length = g_binary_content_compute_size(G_BIN_FORMAT(format)->content); - init_vmpa(&addr, length - 521, VMPA_NO_VIRTUAL); /* FIXME */ - g_binary_portion_set_values(new, &addr, 521); - g_binary_portion_set_rights(new, PAC_READ | PAC_WRITE); - g_portion_layer_include(layer, new); + g_exe_format_include_portion(exe_format, new); } |