From b0b35292cb22899b1b23556be452eb827e4010d7 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 21 Jan 2013 20:40:38 +0000
Subject: Fixed a little bug with source/destination operands of XXX/2addr
 instructions.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@329 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog                       | 5 +++++
 src/arch/dalvik/decomp/arithm.c | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d72e2aa..b40c159 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 13-01-21  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/arch/dalvik/decomp/arithm.c:
+	Fix a little bug with source/destination operands of XXX/2addr instructions.
+
+13-01-21  Cyrille Bagard <nocbos@gmail.com>
+
 	* plugins/pychrysa/gui/panels/log.c:
 	* plugins/pychrysa/gui/panels/log.h:
 	New entries: restore a fully functional access to the log panel.
diff --git a/src/arch/dalvik/decomp/arithm.c b/src/arch/dalvik/decomp/arithm.c
index 464694f..e2278aa 100644
--- a/src/arch/dalvik/decomp/arithm.c
+++ b/src/arch/dalvik/decomp/arithm.c
@@ -125,6 +125,7 @@ GDecInstruction *dalvik_decomp_instr_arithm_2addr(const GArchInstruction *instr,
     vmpa_t addr;                            /* Adresse de l'instruction    */
     GArchOperand *operand;                  /* Opérande de l'instruction   */
     GDecInstruction *op1;                   /* Premier opérande utilisé    */
+    GDecInstruction *op2;                   /* Second opérande utilisé     */
     GDecInstruction *dest;                  /* Enregistrement du résultat  */
     GDecInstruction *arithm;                /* Opération arithmétique      */
 
@@ -160,12 +161,13 @@ GDecInstruction *dalvik_decomp_instr_arithm_2addr(const GArchInstruction *instr,
     g_arch_instruction_get_location(instr, NULL, NULL, &addr);
 
     operand = g_arch_instruction_get_operand(instr, 1);
-    op1 = g_dec_context_convert_register(ctx, operand, false, addr);
+    op2 = g_dec_context_convert_register(ctx, operand, false, addr);
 
     operand = g_arch_instruction_get_operand(instr, 0);
+    op1 = g_dec_context_convert_register(ctx, operand, false, addr);
     dest = g_dec_context_convert_register(ctx, operand, true, addr);
 
-    arithm = g_arithm_expression_new(G_DEC_EXPRESSION(dest), type, G_DEC_EXPRESSION(op1));
+    arithm = g_arithm_expression_new(G_DEC_EXPRESSION(op1), type, G_DEC_EXPRESSION(op2));
     result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(arithm));
 
     return result;
-- 
cgit v0.11.2-87-g4458