summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-06-17 13:14:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-06-17 13:14:42 (GMT)
commite1cf7de1c136e39c67facea8395f58cb3afff790 (patch)
treebbbd998fb3dc6b21079f7b9d1c719c52ff9a1a33
parent2c7e1c63e601ead0098929c62c582a650907b586 (diff)
Let the file format compute locations from virtual addresses.
-rw-r--r--src/arch/link.c17
1 files 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)