summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/instruction.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/dalvik/instruction.c')
-rw-r--r--src/arch/dalvik/instruction.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/arch/dalvik/instruction.c b/src/arch/dalvik/instruction.c
index 49b5573..d494fb4 100644
--- a/src/arch/dalvik/instruction.c
+++ b/src/arch/dalvik/instruction.c
@@ -26,6 +26,7 @@
#include "instruction-int.h"
#include "decomp/translate.h"
+#include "operands/target.h"
#include "../instruction-int.h"
@@ -452,7 +453,49 @@ static const char *dalvik_get_instruction_text(const GDalvikInstruction *instr,
static InstructionLinkType dalvik_get_instruction_link(const GDalvikInstruction *instr, vmpa_t *addr)
{
- return ILT_NONE/*instr->get_link(instr, addr)*/;
+ InstructionLinkType result; /* Type de lien à retourner */
+ GArchOperand *operand; /* Opérande à manipuler */
+ const GImmOperand *imm; /* Valeur immédiate */
+
+ switch (instr->type)
+ {
+ case DOP_IF_EQ:
+ case DOP_IF_NE:
+ case DOP_IF_LT:
+ case DOP_IF_GE:
+ case DOP_IF_GT:
+ case DOP_IF_LE:
+
+ operand = g_arch_instruction_get_operand(G_ARCH_INSTRUCTION(instr), 2);
+ imm = g_dalvik_target_operand_get_value(G_DALVIK_TARGET_OPERAND(operand));
+
+ if (g_imm_operand_to_vmpa_t(imm, addr)) result = ILT_JUMP_IF_TRUE;
+ else result = ILT_NONE;
+
+ break;
+
+ case DOP_IF_EQZ:
+ case DOP_IF_NEZ:
+ case DOP_IF_LTZ:
+ case DOP_IF_GEZ:
+ case DOP_IF_GTZ:
+ case DOP_IF_LEZ:
+
+ operand = g_arch_instruction_get_operand(G_ARCH_INSTRUCTION(instr), 1);
+ imm = g_dalvik_target_operand_get_value(G_DALVIK_TARGET_OPERAND(operand));
+
+ if (g_imm_operand_to_vmpa_t(imm, addr)) result = ILT_JUMP_IF_TRUE;
+ else result = ILT_NONE;
+
+ break;
+
+ default:
+ result = ILT_NONE;
+ break;
+
+ }
+
+ return result;
}