From e1cf7de1c136e39c67facea8395f58cb3afff790 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sun, 17 Jun 2018 15:14:42 +0200 Subject: Let the file format compute locations from virtual addresses. --- src/arch/link.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/arch/link.c b/src/arch/link.c index a5b8ca1..c11fe54 100644 --- a/src/arch/link.c +++ b/src/arch/link.c @@ -61,10 +61,10 @@ void handle_jump_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcCon g_arch_instruction_unlock_operands(instr); - if (G_IS_IMM_OPERAND(op) && g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &virt)) + if (G_IS_IMM_OPERAND(op) + && g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &virt) + && g_exe_format_translate_address_into_vmpa(format, virt, &addr)) { - init_vmpa(&addr, VMPA_NO_PHYSICAL, virt); - target = g_arch_processor_find_instr_by_address(proc, &addr); if (target != NULL) @@ -125,10 +125,7 @@ void handle_branch_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcC else if (G_IS_IMM_OPERAND(op)) { if (g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &virt)) - { - init_vmpa(&addr, VMPA_NO_PHYSICAL, virt); - defined = true; - } + defined = g_exe_format_translate_address_into_vmpa(format, virt, &addr); } g_object_unref(G_OBJECT(op)); @@ -193,10 +190,10 @@ void handle_call_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcCon g_arch_instruction_unlock_operands(instr); - if (G_IS_IMM_OPERAND(op) && g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &virt)) + if (G_IS_IMM_OPERAND(op) + && g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &virt) + && g_exe_format_translate_address_into_vmpa(format, virt, &addr)) { - init_vmpa(&addr, VMPA_NO_PHYSICAL, virt); - target = g_arch_processor_find_instr_by_address(proc, &addr); if (target != NULL) -- cgit v0.11.2-87-g4458