From 2be3bca7ff0f8ab40615fdbf72c149cd6439b0ac Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Thu, 9 Jul 2015 23:05:13 +0000 Subject: Tried to use virtual addresses as often as possible. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@545 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 14 ++++++++++++++ pixmaps/chrysalide.xcf | Bin 869393 -> 869393 bytes src/analysis/disass/area.c | 23 ++++++++++++++++++++++- src/analysis/disass/fetch.c | 5 ++++- src/arch/arm/v7/fetch.c | 13 ++++++++++++- 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index deb9b2c..4e31145 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +15-07-10 Cyrille Bagard + + * pixmaps/chrysalide.xcf: + Update the picture. + + * src/analysis/disass/area.c: + Typo. + + * src/analysis/disass/fetch.c: + Try to use virtual addresses as often as possible. + + * src/arch/arm/v7/fetch.c: + Fix a bug when computing destination addresses. + 15-07-04 Cyrille Bagard * pixmaps/before-after.png: diff --git a/pixmaps/chrysalide.xcf b/pixmaps/chrysalide.xcf index 91370a6..f951faf 100644 Binary files a/pixmaps/chrysalide.xcf and b/pixmaps/chrysalide.xcf differ diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c index 6ce9272..a0ad90e 100644 --- a/src/analysis/disass/area.c +++ b/src/analysis/disass/area.c @@ -614,7 +614,7 @@ bool load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons } - assert(1 && !is_range_blank_in_mem_areas(*list, *count, &range)); + assert(!is_range_blank_in_mem_areas(*list, *count, &range)); if (g_arch_instruction_is_return(instr)) @@ -1569,6 +1569,27 @@ size_t find_memory_area_by_addr(mem_area *list, size_t count, const vmpa2t *addr } + /* + if (addr->virtual == 0x8540) + { + size_t i; + + for (i = 0; i < count; i++) + printf("[%zu] AREAS :: 0x%08x + %x\n", i, + (unsigned int)list[i].range.addr.virtual, + (unsigned int)list[i].range.length); + + + + + printf(" == CMP == 0x%08x / 0x%08x\n", + (unsigned int)addr->physical, + (unsigned int)addr->virtual); + + } + */ + + found = bsearch(addr, list, count, sizeof(mem_area), (__compar_fn_t)find_mem_area); result = (found != NULL ? found - list : count); diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c index 16b81c8..b30d5a6 100644 --- a/src/analysis/disass/fetch.c +++ b/src/analysis/disass/fetch.c @@ -63,6 +63,7 @@ static void ensure_all_mem_areas_are_filled(mem_area **, size_t *, const GLoaded static void follow_execution_flow(const GLoadedBinary *binary, GProcContext *ctx, mem_area **areas, size_t *count, status_blob_info *info, virt_t virt) { vmpa2t addr; /* Conversion en pleine adresse*/ + GExeFormat *format; /* Format du fichier binaire */ size_t index; /* Zone trouvée à traiter */ printf("-- follow 0x%08x\n", (unsigned int)virt); @@ -73,9 +74,11 @@ static void follow_execution_flow(const GLoadedBinary *binary, GProcContext *ctx while (g_proc_context_has_drop_points(ctx)) { virt = g_proc_context_pop_drop_point(ctx); - init_vmpa(&addr, VMPA_NO_PHYSICAL, 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); diff --git a/src/arch/arm/v7/fetch.c b/src/arch/arm/v7/fetch.c index 18d61f0..246d136 100644 --- a/src/arch/arm/v7/fetch.c +++ b/src/arch/arm/v7/fetch.c @@ -139,7 +139,18 @@ void help_fetching_with_instruction_bl_with_orig(GArchInstruction *instr, GArchP assert(get_mrange_length(range) == 4); - pc += 4; + switch (iset) + { + case AV7IS_ARM: + pc += 8; + break; + case AV7IS_THUMB: + pc += 4; + break; + default: + assert(0); + break; + } op = g_arch_instruction_get_operand(instr, 0); -- cgit v0.11.2-87-g4458