summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-07-09 23:05:13 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-07-09 23:05:13 (GMT)
commit2be3bca7ff0f8ab40615fdbf72c149cd6439b0ac (patch)
tree0fc1bfc767eead1f33d41be737635d67b9ce5a84 /src/analysis/disass
parent66326b95195516864fc7721419250c4fef3f8f4b (diff)
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
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/area.c23
-rw-r--r--src/analysis/disass/fetch.c5
2 files changed, 26 insertions, 2 deletions
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);