summaryrefslogtreecommitdiff
path: root/src/arch/dalvik
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-01-15 14:47:04 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-01-15 14:47:04 (GMT)
commitaf2ac16182b6243f17e06ec75e441014159abe5e (patch)
treef0e82673bf5e63e3b06244c2139d8f10dca0203f /src/arch/dalvik
parent56e060d11c238ac7c7b3ecf0eb0527bbaebd5b4b (diff)
Improved symbol resolving using fully defined locations.
Diffstat (limited to 'src/arch/dalvik')
-rw-r--r--src/arch/dalvik/link.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/arch/dalvik/link.c b/src/arch/dalvik/link.c
index 3295c76..f92541b 100644
--- a/src/arch/dalvik/link.c
+++ b/src/arch/dalvik/link.c
@@ -80,8 +80,9 @@ typedef struct _case_comment
void handle_dalvik_packed_switch_links(GArchInstruction *instr, GArchProcessor *proc, GProcContext *context, GExeFormat *format)
{
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 */
GArchInstruction *switch_ins; /* Instruction de branchements */
const mrange_t *range; /* Zone d'occupation */
const vmpa2t *start_addr; /* Adresse de référentiel */
@@ -104,24 +105,25 @@ void handle_dalvik_packed_switch_links(GArchInstruction *instr, GArchProcessor *
op = g_arch_instruction_get_operand(instr, 1);
- 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)
{
- /* TODO : utiliser format pour contruire une adresse avec une position physique,
- * ce qui accélèrerait les recherches.
- */
- init_vmpa(&addr, VMPA_NO_PHYSICAL, virt);
-
switch_ins = g_arch_processor_find_instr_by_address(proc, &addr);
if (G_IS_DALVIK_SWITCH_INSTR(switch_ins))