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/arch/link.c | |
parent | 56e060d11c238ac7c7b3ecf0eb0527bbaebd5b4b (diff) |
Improved symbol resolving using fully defined locations.
Diffstat (limited to 'src/arch/link.c')
-rw-r--r-- | src/arch/link.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/arch/link.c b/src/arch/link.c index 8b02aa8..0e11521 100644 --- a/src/arch/link.c +++ b/src/arch/link.c @@ -95,8 +95,9 @@ void handle_jump_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcCon void handle_branch_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcContext *context, GExeFormat *format, size_t index) { GArchOperand *op; /* Opérande numérique en place */ - virt_t virt; /* Adresse virtuelle */ + bool defined; /* Adresse définie ? */ vmpa2t addr; /* Adresse de destination */ + virt_t virt; /* Adresse virtuelle */ instr_iter_t *iter; /* Parcours d'instructions */ GArchInstruction *target; /* Ligne visée par la référence*/ @@ -104,21 +105,25 @@ void handle_branch_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcC op = g_arch_instruction_get_operand(instr, index); - virt = VMPA_NO_VIRTUAL; + defined = false; if (G_IS_TARGET_OPERAND(op)) - virt = g_target_operand_get_addr(G_TARGET_OPERAND(op)); + { + g_target_operand_get_addr(G_TARGET_OPERAND(op), &addr); + defined = true; + } else if (G_IS_IMM_OPERAND(op)) { - if (!g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &virt)) - virt = VMPA_NO_VIRTUAL; + if (g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &virt)) + { + init_vmpa(&addr, VMPA_NO_PHYSICAL, virt); + defined = true; + } } - if (virt != VMPA_NO_VIRTUAL) + if (defined) { - init_vmpa(&addr, VMPA_NO_PHYSICAL, virt); - iter = g_arch_processor_get_iter_from_address(proc, &addr); if (iter != NULL) |