diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-07-19 19:00:34 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-07-19 19:00:34 (GMT) |
commit | a4f40b1971fe208bd9c25adebaeff5614aee87ee (patch) | |
tree | 376d1832e345b0bf451cd8d06b97e0c2cd37fa86 /plugins/dalvik/link.c | |
parent | 5d94aa1a1e3af384307bb9d760410b61a33e7323 (diff) |
Created an interface for jumping to addresses from operands.
Diffstat (limited to 'plugins/dalvik/link.c')
-rw-r--r-- | plugins/dalvik/link.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/plugins/dalvik/link.c b/plugins/dalvik/link.c index 8eda3c9..8e34485 100644 --- a/plugins/dalvik/link.c +++ b/plugins/dalvik/link.c @@ -32,7 +32,7 @@ #include <i18n.h> #include <analysis/db/items/comment.h> -#include <arch/target.h> +#include <arch/targetableop.h> #include <common/extstr.h> #include <plugins/dex/pool.h> @@ -142,11 +142,10 @@ void handle_links_for_dalvik_string(GArchInstruction *instr, GArchProcessor *pro void handle_dalvik_packed_switch_links(GArchInstruction *instr, GArchProcessor *proc, GProcContext *context, GExeFormat *format) { GArchOperand *op; /* Opérande numérique en place */ + const mrange_t *range; /* Emplacement de l'instruction*/ 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 */ const int32_t *keys; /* Conditions de sauts */ const int32_t *targets; /* Positions relatives liées */ @@ -171,23 +170,17 @@ void handle_dalvik_packed_switch_links(GArchInstruction *instr, GArchProcessor * g_arch_instruction_unlock_operands(instr); - defined = false; - - if (G_IS_TARGET_OPERAND(op)) + if (G_IS_TARGETABLE_OPERAND(op)) { - g_target_operand_get_addr(G_TARGET_OPERAND(op), &addr); - defined = true; - } + range = g_arch_instruction_get_range(instr); - 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_targetable_operand_get_addr(G_TARGETABLE_OPERAND(op), get_mrange_addr(range), + G_BIN_FORMAT(format), proc, &addr); } + else + defined = false; + g_object_unref(G_OBJECT(op)); if (defined) |