diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2010-12-08 23:16:43 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2010-12-08 23:16:43 (GMT) |
commit | 78b82a19a4f45cfd57f3cea7faf34968f86fb160 (patch) | |
tree | 1daeab3ea56e492a1ac5031259d567677cf1f0ba /src/arch/dalvik/dop_arithm.c | |
parent | 6ea8a46069a8b2c6d2fbf007496d0616f544d8d4 (diff) |
Decompiled a few more arithmetic Dex opcodes.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@199 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/dalvik/dop_arithm.c')
-rw-r--r-- | src/arch/dalvik/dop_arithm.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/arch/dalvik/dop_arithm.c b/src/arch/dalvik/dop_arithm.c index 7657f99..ace8724 100644 --- a/src/arch/dalvik/dop_arithm.c +++ b/src/arch/dalvik/dop_arithm.c @@ -44,6 +44,77 @@ * * ******************************************************************************/ +GDecInstruction *dalvik_decomp_instr_arithm(const GArchInstruction *instr, GDecContext *ctx) +{ + GDecInstruction *result; /* Instruction à retourner */ + ArithmOperationType type; /* Type d'opération menée */ + GArchOperand *operand; /* Opérande de l'instruction */ + GDecInstruction *dest; /* Enregistrement du résultat */ + GDecInstruction *op1; /* Premier opérande utilisé */ + GDecInstruction *op2; /* Second opérande utilisé */ + GDecInstruction *arithm; /* Opération arithmétique */ + + switch (g_dalvik_instruction_get_opcode(G_DALVIK_INSTRUCTION(instr))) + { + case DOP_ADD_INT: + type = AOT_ADD; + break; + case DOP_SUB_INT: + type = AOT_SUB; + break; + case DOP_MUL_INT: + type = AOT_MUL; + break; + case DOP_DIV_INT: + type = AOT_DIV; + break; + case DOP_REM_INT: + type = AOT_REM; + break; + case DOP_AND_INT: + type = AOT_AND; + break; + case DOP_OR_INT: + type = AOT_OR; + break; + case DOP_XOR_INT: + type = AOT_XOR; + break; + default: + type = AOT_COUNT; + break; + } + + operand = g_arch_instruction_get_operand(instr, 0); + dest = g_dec_context_convert_register(ctx, operand); + + operand = g_arch_instruction_get_operand(instr, 1); + op1 = g_dec_context_convert_register(ctx, operand); + + operand = g_arch_instruction_get_operand(instr, 2); + op2 = g_dec_context_convert_register(ctx, operand); + + 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; + +} + + +/****************************************************************************** +* * +* Paramètres : instr = instruction d'origine à convertir. * +* ctx = contexte de la phase de décompilation. * +* * +* Description : Décompile une instruction de type 'opérations arithmétiques'.* +* * +* Retour : Instruction mise en place ou NULL. * +* * +* Remarques : - * +* * +******************************************************************************/ + GDecInstruction *dalvik_decomp_instr_arithm_2addr(const GArchInstruction *instr, GDecContext *ctx) { GDecInstruction *result; /* Instruction à retourner */ |