diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-01-15 14:47:04 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-01-15 14:47:04 (GMT) |
commit | af2ac16182b6243f17e06ec75e441014159abe5e (patch) | |
tree | f0e82673bf5e63e3b06244c2139d8f10dca0203f /src/analysis/disass/links.c | |
parent | 56e060d11c238ac7c7b3ecf0eb0527bbaebd5b4b (diff) |
Improved symbol resolving using fully defined locations.
Diffstat (limited to 'src/analysis/disass/links.c')
-rw-r--r-- | src/analysis/disass/links.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c index 77ec2af..d3434cb 100644 --- a/src/analysis/disass/links.c +++ b/src/analysis/disass/links.c @@ -139,6 +139,7 @@ static void convert_immediate_into_target(GArchInstruction *instr, size_t index, GImmOperand *imm; /* Version native de l'opérande*/ virt_t addr; /* Adresse visée par le saut */ MemoryDataSize msize; /* Taille de l'opérande */ + vmpa2t target; /* Défination finale précise */ GArchOperand *new; /* Instruction de ciblage */ op = g_arch_instruction_get_operand(instr, index); @@ -152,12 +153,16 @@ static void convert_immediate_into_target(GArchInstruction *instr, size_t index, { msize = g_imm_operand_get_size(imm); - new = g_target_operand_new(msize, addr); + if (g_exe_format_translate_address_into_vmpa(G_EXE_FORMAT(format), addr, &target)) + { + new = g_target_operand_new(msize, &target); + + if (!g_target_operand_resolve(G_TARGET_OPERAND(new), format, false)) + g_object_unref(G_OBJECT(new)); + else + g_arch_instruction_replace_operand(instr, new, op); - if (!g_target_operand_resolve(G_TARGET_OPERAND(new), format, false)) - g_object_unref(G_OBJECT(new)); - else - g_arch_instruction_replace_operand(instr, new, op); + } } @@ -184,7 +189,6 @@ void establish_links_for_instruction(GArchInstruction *instr, GBinFormat *format size_t count; /* Nombre d'opérandes présents */ size_t i; /* Boucle de parcours */ GArchOperand *op; /* Opérande numérique en place */ - virt_t virt; /* Adresse liée à une cible */ vmpa2t addr; /* Localisation plus complète */ GArchInstruction *target; /* Instruction visée au final */ @@ -203,8 +207,7 @@ void establish_links_for_instruction(GArchInstruction *instr, GBinFormat *format op = g_arch_instruction_get_operand(instr, i); if (!G_IS_TARGET_OPERAND(op)) continue; - virt = g_target_operand_get_addr(G_TARGET_OPERAND(op)); - init_vmpa(&addr, VMPA_NO_PHYSICAL, virt); + g_target_operand_get_addr(G_TARGET_OPERAND(op), &addr); target = g_arch_processor_find_instr_by_address(proc, &addr); |