summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/instruction.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-11-02 15:50:07 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-11-02 15:50:07 (GMT)
commitf5df6496fa50927d3d274c939a888afde652b7ad (patch)
tree281dbfdfdcb8765fea7036af274c63fb5acde8ff /src/arch/dalvik/instruction.c
parentc3aba0893c29cc098c029306fd7a4c8c1fa2eee2 (diff)
Improved the computing and the rendering of the graphic view.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@277 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
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;
}