summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/decomp
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/dalvik/decomp')
-rw-r--r--src/arch/dalvik/decomp/Makefile.am27
-rw-r--r--src/arch/dalvik/decomp/aget.c71
-rw-r--r--src/arch/dalvik/decomp/aput.c71
-rw-r--r--src/arch/dalvik/decomp/arithm.c253
-rw-r--r--src/arch/dalvik/decomp/array.c67
-rw-r--r--src/arch/dalvik/decomp/const.c110
-rw-r--r--src/arch/dalvik/decomp/if.c173
-rw-r--r--src/arch/dalvik/decomp/iget.c79
-rw-r--r--src/arch/dalvik/decomp/invoke.c271
-rw-r--r--src/arch/dalvik/decomp/iput.c79
-rw-r--r--src/arch/dalvik/decomp/move.c141
-rw-r--r--src/arch/dalvik/decomp/new.c73
-rw-r--r--src/arch/dalvik/decomp/ret.c84
-rw-r--r--src/arch/dalvik/decomp/switch.c62
-rw-r--r--src/arch/dalvik/decomp/translate.h101
15 files changed, 0 insertions, 1662 deletions
diff --git a/src/arch/dalvik/decomp/Makefile.am b/src/arch/dalvik/decomp/Makefile.am
deleted file mode 100644
index 053bf4c..0000000
--- a/src/arch/dalvik/decomp/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-
-noinst_LTLIBRARIES = libarchdalvikdecomp.la
-
-libarchdalvikdecomp_la_SOURCES = \
- aget.c \
- aput.c \
- arithm.c \
- array.c \
- const.c \
- if.c \
- iget.c \
- invoke.c \
- iput.c \
- move.c \
- new.c \
- ret.c \
- switch.c \
- translate.h
-
-libarchdalvikdecomp_la_LIBADD =
-
-libarchdalvikdecomp_la_CFLAGS = $(AM_CFLAGS)
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/src/arch/dalvik/decomp/aget.c b/src/arch/dalvik/decomp/aget.c
deleted file mode 100644
index 19d62a8..0000000
--- a/src/arch/dalvik/decomp/aget.c
+++ /dev/null
@@ -1,71 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * aget.c - décompilation des instructions manipulant des tableaux (chargement)
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../../../decomp/expr/array.h"
-#include "../../../decomp/expr/assign.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'aget'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_aget(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *array; /* Tableau accédé */
- GDecInstruction *index; /* Indice de cellule considérée*/
- GDecInstruction *content; /* Contenu de cellule visé */
- GDecInstruction *access; /* Représentation de l'accès */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- array = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 2);
- index = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- content = g_dec_context_convert_register(ctx, operand, true, addr);
-
- access = g_array_access_new(G_DEC_EXPRESSION(array), G_DEC_EXPRESSION(index));
- result = g_assign_expression_new(G_DEC_EXPRESSION(content), G_DEC_EXPRESSION(access));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/aput.c b/src/arch/dalvik/decomp/aput.c
deleted file mode 100644
index b62736e..0000000
--- a/src/arch/dalvik/decomp/aput.c
+++ /dev/null
@@ -1,71 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * aput.c - décompilation des instructions manipulant des tableaux (enregistrement)
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../../../decomp/expr/array.h"
-#include "../../../decomp/expr/assign.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'aput'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_aput(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *content; /* Contenu de cellule visé */
- GDecInstruction *array; /* Tableau accédé */
- GDecInstruction *index; /* Indice de cellule considérée*/
- GDecInstruction *access; /* Représentation de l'accès */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- content = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- array = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 2);
- index = g_dec_context_convert_register(ctx, operand, false, addr);
-
- access = g_array_access_new(G_DEC_EXPRESSION(array), G_DEC_EXPRESSION(index));
- result = g_assign_expression_new(G_DEC_EXPRESSION(access), G_DEC_EXPRESSION(content));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/arithm.c b/src/arch/dalvik/decomp/arithm.c
deleted file mode 100644
index 32e105e..0000000
--- a/src/arch/dalvik/decomp/arithm.c
+++ /dev/null
@@ -1,253 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * arithm.c - décompilation des opérations arithmétiques
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../instruction.h"
-#include "../../../decomp/expr/arithm.h"
-#include "../../../decomp/expr/assign.h"
-#include "../../../decomp/expr/immediate.h"
-
-
-
-/******************************************************************************
-* *
-* 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(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- ArithmOperationType type; /* Type d'opération menée */
- 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 */
-
- 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;
- }
-
- 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);
-
- operand = g_arch_instruction_get_operand(instr, 2);
- op2 = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- dest = g_dec_context_convert_register(ctx, operand, true, addr);
-
- 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 */
- ArithmOperationType type; /* Type d'opération menée */
- 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 */
-
- switch (g_dalvik_instruction_get_opcode(G_DALVIK_INSTRUCTION(instr)))
- {
- case DOP_ADD_INT_2ADDR:
- type = AOT_ADD;
- break;
- case DOP_MUL_INT_2ADDR:
- case DOP_MUL_DOUBLE_2ADDR:
- type = AOT_MUL;
- break;
- case DOP_DIV_INT_2ADDR:
- type = AOT_DIV;
- break;
- case DOP_REM_INT_2ADDR:
- type = AOT_REM;
- break;
- case DOP_AND_INT_2ADDR:
- type = AOT_AND;
- break;
- case DOP_OR_INT_2ADDR:
- type = AOT_OR;
- break;
- case DOP_XOR_INT_2ADDR:
- type = AOT_XOR;
- break;
- default:
- type = AOT_COUNT;
- break;
- }
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- 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(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_lit(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- ArithmOperationType type; /* Type d'opération menée */
- 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 */
-
- switch (g_dalvik_instruction_get_opcode(G_DALVIK_INSTRUCTION(instr)))
- {
- case DOP_ADD_INT_LIT8:
- case DOP_ADD_INT_LIT16:
- type = AOT_ADD;
- break;
- case DOP_MUL_INT_LIT8:
- case DOP_MUL_INT_LIT16:
- type = AOT_MUL;
- break;
- case DOP_DIV_INT_LIT8:
- case DOP_DIV_INT_LIT16:
- type = AOT_DIV;
- break;
- case DOP_REM_INT_LIT8:
- case DOP_REM_INT_LIT16:
- type = AOT_REM;
- break;
- case DOP_AND_INT_LIT8:
- case DOP_AND_INT_LIT16:
- type = AOT_AND;
- break;
- case DOP_OR_INT_LIT8:
- case DOP_OR_INT_LIT16:
- type = AOT_OR;
- break;
- case DOP_XOR_INT_LIT8:
- case DOP_XOR_INT_LIT16:
- type = AOT_XOR;
- break;
- default:
- type = AOT_COUNT;
- break;
- }
-
- 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);
-
- operand = g_arch_instruction_get_operand(instr, 2);
- op2 = g_imm_expression_new(G_IMM_OPERAND(operand));
-
- operand = g_arch_instruction_get_operand(instr, 0);
- dest = g_dec_context_convert_register(ctx, operand, true, addr);
-
- 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;
-
-}
diff --git a/src/arch/dalvik/decomp/array.c b/src/arch/dalvik/decomp/array.c
deleted file mode 100644
index 2cb9808..0000000
--- a/src/arch/dalvik/decomp/array.c
+++ /dev/null
@@ -1,67 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * array.c - décompilation de l'opération récupérant la longueur d'un tableau
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../../../decomp/expr/assign.h"
-#include "../../../decomp/expr/dalvik/array.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'array-length'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_array_length(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *reg; /* Pseudo-registre redéfini */
- GDecInstruction *len; /* Enregistrement de taille */
- GDecInstruction *dest; /* Destination de la création */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- reg = g_dec_context_convert_register(ctx, operand, false, addr);
- len = g_dalvik_alength_new(G_DEC_EXPRESSION(reg));
-
- operand = g_arch_instruction_get_operand(instr, 0);
- dest = g_dec_context_convert_register(ctx, operand, true, addr);
-
- result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(len));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/const.c b/src/arch/dalvik/decomp/const.c
deleted file mode 100644
index 29cd29d..0000000
--- a/src/arch/dalvik/decomp/const.c
+++ /dev/null
@@ -1,110 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * const.c - décompilation des chargements de constantes
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../operands/pool.h"
-#include "../../../decomp/expr/assign.h"
-#include "../../../decomp/expr/immediate.h"
-#include "../../../decomp/expr/text.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'const'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_const(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *reg; /* Pseudo-registre redéfini */
- GDecInstruction *imm; /* Valeur immédiate décompilée */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- reg = g_dec_context_convert_register(ctx, operand, true, addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- imm = g_imm_expression_new(G_IMM_OPERAND(operand));
-
- result = g_assign_expression_new(G_DEC_EXPRESSION(reg), G_DEC_EXPRESSION(imm));
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'const-string'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_const_str(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *reg; /* Pseudo-registre redéfini */
- uint32_t index; /* Indice de la chaîne */
- const char *value; /* Chaîne de caractères */
- GDecInstruction *str; /* Chaîne décompilée */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- reg = g_dec_context_convert_register(ctx, operand, true, addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(operand));
-
- value = get_string_from_dex_pool(G_DEX_FORMAT(g_dec_context_get_format(ctx)), index);
- if (value == NULL) return NULL;
-
- str = g_str_expression_new(value);
-
- result = g_assign_expression_new(G_DEC_EXPRESSION(reg), G_DEC_EXPRESSION(str));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/if.c b/src/arch/dalvik/decomp/if.c
deleted file mode 100644
index 7e17b8d..0000000
--- a/src/arch/dalvik/decomp/if.c
+++ /dev/null
@@ -1,173 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * if.c - décompilation des branchements conditionnels
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../instruction.h"
-#include "../../../decomp/expr/comp.h"
-#include "../../../decomp/expr/cond.h"
-#include "../../../decomp/expr/immediate.h"
-#include "../../../decomp/instr/ite.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de branchement conditionnel. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_if(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- CompSignType sign; /* Type d'opération menée */
- 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é */
- vmpa_t jmp; /* Adresse de saut */
- GDecInstruction *comp; /* Comparaison à restituer */
- GDecInstruction *cond; /* Transformation en condition */
-
- switch (g_dalvik_instruction_get_opcode(G_DALVIK_INSTRUCTION(instr)))
- {
- case DOP_IF_EQ:
- sign = CST_EQ;
- break;
- case DOP_IF_NE:
- sign = CST_NE;
- break;
- case DOP_IF_LT:
- sign = CST_LT;
- break;
- case DOP_IF_GE:
- sign = CST_GE;
- break;
- case DOP_IF_GT:
- sign = CST_GT;
- break;
- case DOP_IF_LE:
- sign = CST_LE;
- break;
- default:
- sign = CST_COUNT;
- break;
- }
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- op1 = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- op2 = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 2);
- jmp = 0x1234ull;/*g_dec_context_convert_register(ctx, operand, addr);*/
-
- comp = g_comp_expression_new(G_DEC_EXPRESSION(op1), sign, G_DEC_EXPRESSION(op2));
- cond = g_cond_expression_new(comp);
- result = g_ite_instruction_new(cond, jmp, jmp);
-
- return result;
-
-}
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de branchement conditionnel. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_if_zero(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- CompSignType sign; /* Type d'opération menée */
- 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é */
- vmpa_t jmp; /* Adresse de saut */
- GDecInstruction *comp; /* Comparaison à restituer */
- GDecInstruction *cond; /* Transformation en condition */
-
- switch (g_dalvik_instruction_get_opcode(G_DALVIK_INSTRUCTION(instr)))
- {
- case DOP_IF_EQZ:
- sign = CST_EQ;
- break;
- case DOP_IF_NEZ:
- sign = CST_NE;
- break;
- case DOP_IF_LTZ:
- sign = CST_LT;
- break;
- case DOP_IF_GEZ:
- sign = CST_GE;
- break;
- case DOP_IF_GTZ:
- sign = CST_GT;
- break;
- case DOP_IF_LEZ:
- sign = CST_LE;
- break;
- default:
- sign = CST_COUNT;
- break;
- }
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- op1 = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, (unsigned int)0);
- op2 = g_imm_expression_new(G_IMM_OPERAND(operand));
-
- operand = g_arch_instruction_get_operand(instr, 2);
- jmp = 0x1234ull;/*g_dec_context_convert_register(ctx, operand, addr);*/
-
- comp = g_comp_expression_new(G_DEC_EXPRESSION(op1), sign, G_DEC_EXPRESSION(op2));
- cond = g_cond_expression_new(comp);
- result = g_ite_instruction_new(cond, jmp, jmp);
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/iget.c b/src/arch/dalvik/decomp/iget.c
deleted file mode 100644
index 3fbaa7c..0000000
--- a/src/arch/dalvik/decomp/iget.c
+++ /dev/null
@@ -1,79 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * iget.c - décompilation des instructions manipulant des champs d'instance (chargement)
- *
- * Copyright (C) 2012-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../../../arch/dalvik/operands/pool.h"
-#include "../../../decomp/expr/access.h"
-#include "../../../decomp/expr/assign.h"
-#include "../../../decomp/expr/pseudo.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'iget'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_iget(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *src; /* Registre de l'object */
- uint32_t index; /* Indice dans la table */
- GDecInstruction *field; /* Champ concerné par l'opérat°*/
- GBinVariable *var; /* Variable / champ accédé */
- GDecInstruction *dest; /* Registre de destination */
- GDecInstruction *access; /* Représentation de l'accès */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- src = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 2);
- index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(operand));
- var = get_field_from_dex_pool(G_DEX_FORMAT(g_dec_context_get_format(ctx)), index);
-
- field = g_pseudo_register_new(PRU_FIXED);
- g_pseudo_register_set_variable(G_PSEUDO_REGISTER(field), var);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- dest = g_dec_context_convert_register(ctx, operand, true, addr);
-
- access = g_access_expression_new(G_DEC_EXPRESSION(src), G_DEC_EXPRESSION(field));
- result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(access));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/invoke.c b/src/arch/dalvik/decomp/invoke.c
deleted file mode 100644
index e747ac2..0000000
--- a/src/arch/dalvik/decomp/invoke.c
+++ /dev/null
@@ -1,271 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * invoke.c - décompilation des appels de méthode
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include <string.h>
-
-
-#include "../instruction.h"
-#include "../operand.h"
-#include "../../../decomp/expr/access.h"
-#include "../../../decomp/expr/assign.h"
-#include "../../../decomp/expr/call.h"
-#include "../../../format/dex/pool.h"
-
-
-#define get_routine_from_dex_pool(p, i) NULL
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'invoke-direct'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_invoke_direct(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- GDecInstruction *iter; /* Boucle de parcours #1 */
- GDecInstruction *list; /* Instructions décompilées */
- size_t count; /* Quantité d'opérandes */
- GArchOperand *operand; /* Opérande de l'instruction */
- uint32_t index; /* Indice de l'élément visé */
- GBinRoutine *routine; /* Routine visée par l'appel */
- const char *name; /* Chaîne à afficher */
- GDecInstruction *src; /* Source de l'assignation */
- GDecInstruction *dest; /* Destination de l'assignat° */
- vmpa_t addr; /* Adresse de l'instruction */
- size_t i; /* Boucle de parcours #2 */
- GArchOperand *arg; /* Argument brut de l'appel */
- GDecInstruction *reg; /* Argument converti */
-
- result = NULL;
- iter = NULL;
-
- list = g_dec_context_get_decomp_instrs(ctx);
- if (list == NULL) return NULL;
-
- /* Récupération de la méthode */
-
- count = g_arch_instruction_count_operands(instr);
- operand = g_arch_instruction_get_operand(instr, count - 1);
-
- index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(operand));
-
- routine = get_routine_from_dex_pool(G_DEX_FORMAT(g_dec_context_get_format(ctx)), index);
- if (routine == NULL) return NULL;
-
- /* Détermination de la routine-cible exacte */
-
- name = g_binary_routine_get_name(routine);
-
- if (strcmp(name, "<init>") != 0)
- result = g_routine_call_new(routine);
-
- else
- {
- src = NULL; /* Pour gcc... */
-
- for (iter = g_dec_instruction_get_last(list);
- iter != NULL;
- iter = g_dec_instruction_get_prev_iter(list, iter))
- {
- if (!G_IS_ASSIGN_EXPRESSION(iter)) continue;
-
- src = g_assign_expression_get_src(G_ASSIGN_EXPRESSION(iter));
- if (!G_IS_ROUTINE_CALL(src)) continue;
-
- dest = g_assign_expression_get_dest(G_ASSIGN_EXPRESSION(iter));
- /* TODO : vérifier aussi la concordance des registres src && instr */
-
- break;
-
- }
-
- if (iter == NULL) return NULL;
-
- result = src;
-
- g_dec_instruction_delete(&list, iter);
- g_dec_context_set_decomp_instrs(ctx, list);
-
- }
-
- /* Ajout des arguments */
-
- operand = g_arch_instruction_get_operand(instr, 0);
- count = g_dalvik_args_count(G_DALVIK_ARGS_OPERAND(operand));
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- for (i = 1; i < count; i++)
- {
- arg = g_dalvik_args_operand_get(G_DALVIK_ARGS_OPERAND(operand), i);
- reg = g_dec_context_convert_register(ctx, arg, false, addr);
-
- g_routine_call_add_arg(G_ROUTINE_CALL(result), reg);
-
- }
-
- return (iter != NULL ? iter : result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'invoke-static'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_invoke_static(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- size_t count; /* Quantité d'opérandes */
- GArchOperand *operand; /* Opérande de l'instruction */
- uint32_t index; /* Indice de l'élément visé */
- GBinRoutine *routine; /* Routine visée par l'appel */
- GDecInstruction *call; /* Représentation de l'appel */
- vmpa_t addr; /* Adresse de l'instruction */
- size_t i; /* Boucle de parcours #2 */
- GArchOperand *arg; /* Argument brut de l'appel */
- GDecInstruction *reg; /* Argument converti */
-
- result = NULL;
-
- /* Récupération de la méthode */
-
- count = g_arch_instruction_count_operands(instr);
- operand = g_arch_instruction_get_operand(instr, count - 1);
-
- index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(operand));
-
- routine = get_routine_from_dex_pool(G_DEX_FORMAT(g_dec_context_get_format(ctx)), index);
- if (routine == NULL) return NULL;
-
- call = g_routine_call_new(routine);
-
- /* Ajout des arguments */
-
- operand = g_arch_instruction_get_operand(instr, 0);
- count = g_dalvik_args_count(G_DALVIK_ARGS_OPERAND(operand));
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- for (i = 0; i < count; i++)
- {
- arg = g_dalvik_args_operand_get(G_DALVIK_ARGS_OPERAND(operand), i);
- reg = g_dec_context_convert_register(ctx, arg, false, addr);
-
- g_routine_call_add_arg(G_ROUTINE_CALL(call), reg);
-
- }
-
- return call;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'invoke-virtual'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_invoke_virtual(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- size_t count; /* Quantité d'opérandes */
- GArchOperand *operand; /* Opérande de l'instruction */
- uint32_t index; /* Indice de l'élément visé */
- GBinRoutine *routine; /* Routine visée par l'appel */
- GDecInstruction *call; /* Représentation de l'appel */
- vmpa_t addr; /* Adresse de l'instruction */
- size_t i; /* Boucle de parcours #2 */
- GArchOperand *arg; /* Argument brut de l'appel */
- GDecInstruction *reg; /* Argument converti */
-
- result = NULL;
-
- /* Récupération de la méthode */
-
- count = g_arch_instruction_count_operands(instr);
- operand = g_arch_instruction_get_operand(instr, count - 1);
-
- index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(operand));
-
- routine = get_routine_from_dex_pool(G_DEX_FORMAT(g_dec_context_get_format(ctx)), index);
- if (routine == NULL) return NULL;
-
- call = g_routine_call_new(routine);
-
- /* Ajout des arguments */
-
- operand = g_arch_instruction_get_operand(instr, 0);
- count = g_dalvik_args_count(G_DALVIK_ARGS_OPERAND(operand));
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- for (i = 1; i < count; i++)
- {
- arg = g_dalvik_args_operand_get(G_DALVIK_ARGS_OPERAND(operand), i);
- reg = g_dec_context_convert_register(ctx, arg, false, addr);
-
- g_routine_call_add_arg(G_ROUTINE_CALL(call), reg);
-
- }
-
- /* Appel depuis le propriétaire */
-
- arg = g_dalvik_args_operand_get(G_DALVIK_ARGS_OPERAND(operand), 0);
- reg = g_dec_context_convert_register(ctx, arg, false, addr);
-
- result = g_access_expression_new(G_DEC_EXPRESSION(reg), G_DEC_EXPRESSION(call));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/iput.c b/src/arch/dalvik/decomp/iput.c
deleted file mode 100644
index e55c7bc..0000000
--- a/src/arch/dalvik/decomp/iput.c
+++ /dev/null
@@ -1,79 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * iput.c - décompilation des instructions manipulant des champs d'instance (déchargement)
- *
- * Copyright (C) 2012-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../../../arch/dalvik/operands/pool.h"
-#include "../../../decomp/expr/access.h"
-#include "../../../decomp/expr/assign.h"
-#include "../../../decomp/expr/pseudo.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'iput'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_iput(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *dest; /* Registre de destination */
- GDecInstruction *src; /* Registre de l'object */
- uint32_t index; /* Indice dans la table */
- GDecInstruction *field; /* Champ concerné par l'opérat°*/
- GBinVariable *var; /* Variable / champ accédé */
- GDecInstruction *access; /* Représentation de l'accès */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- src = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- dest = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 2);
- index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(operand));
- var = get_field_from_dex_pool(G_DEX_FORMAT(g_dec_context_get_format(ctx)), index);
-
- field = g_pseudo_register_new(PRU_FIXED);
- g_pseudo_register_set_variable(G_PSEUDO_REGISTER(field), var);
-
- access = g_access_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(field));
- result = g_assign_expression_new(G_DEC_EXPRESSION(access), G_DEC_EXPRESSION(src));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/move.c b/src/arch/dalvik/decomp/move.c
deleted file mode 100644
index b147daf..0000000
--- a/src/arch/dalvik/decomp/move.c
+++ /dev/null
@@ -1,141 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * move.c - décompilation des opérations de déplacement
- *
- * Copyright (C) 2012-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../../../decomp/expr/assign.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'move'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_move(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *src; /* Registre de l'object */
- GDecInstruction *dest; /* Registre de destination */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- src = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- dest = g_dec_context_convert_register(ctx, operand, true, addr);
-
- result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(src));
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'move-object'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_move_object(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *src; /* Registre de l'object */
- GDecInstruction *dest; /* Registre de destination */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- src = g_dec_context_convert_register(ctx, operand, false, addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- dest = g_dec_context_convert_register(ctx, operand, true, addr);
-
- result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(src));
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'move-result'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_move_result(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- GDecInstruction *list; /* Instructions décompilées */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *last; /* Instruction précédante */
- GDecInstruction *dest; /* Registre de destination */
-
- list = g_dec_context_get_decomp_instrs(ctx);
- if (list == NULL) return NULL;
-
- last = g_dec_instruction_get_last(list);
- g_dec_instruction_delete(&list, last);
- g_dec_context_set_decomp_instrs(ctx, list);
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- dest = g_dec_context_convert_register(ctx, operand, true, addr);
-
- result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(last));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/new.c b/src/arch/dalvik/decomp/new.c
deleted file mode 100644
index ef143ff..0000000
--- a/src/arch/dalvik/decomp/new.c
+++ /dev/null
@@ -1,73 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * new.c - décompilation des créations de nouvelles instances
- *
- * Copyright (C) 2012-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../../../arch/dalvik/operands/pool.h"
-#include "../../../decomp/expr/assign.h"
-#include "../../../decomp/expr/call.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'new-instance'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_new_instance(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- uint32_t index; /* Indice dans la table */
- GDataType *type; /* Type concerné par l'opérat° */
- GBinRoutine *constructor; /* Constructeur reconstruit */
- GDecInstruction *call; /* Appel au constructeur */
- GDecInstruction *dest; /* Registre de destination */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 1);
- index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(operand));
- type = get_type_from_dex_pool(G_DEX_FORMAT(g_dec_context_get_format(ctx)), index);
-
- constructor = g_binary_routine_new_constructor(type);
- call = g_routine_call_new(constructor);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- dest = g_dec_context_convert_register(ctx, operand, true, addr);
-
- result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(call));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/ret.c b/src/arch/dalvik/decomp/ret.c
deleted file mode 100644
index ab2f299..0000000
--- a/src/arch/dalvik/decomp/ret.c
+++ /dev/null
@@ -1,84 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * ret.c - décompilation des ordres de retour
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-#include "../../../decomp/expr/return.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'return'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_return(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *reg; /* Pseudo-registre redéfini */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- reg = g_dec_context_convert_register(ctx, operand, false, addr);
-
- result = g_return_expression_new(G_DEC_EXPRESSION(reg));
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction de type 'return-void'. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_return_void(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
-
- result = g_return_expression_new(NULL);
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/switch.c b/src/arch/dalvik/decomp/switch.c
deleted file mode 100644
index 25501da..0000000
--- a/src/arch/dalvik/decomp/switch.c
+++ /dev/null
@@ -1,62 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * switch.c - décompilation des aiguillages multiples du flot d'exécution
- *
- * Copyright (C) 2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "translate.h"
-
-
-
-#include "../instruction.h"
-#include "../../../decomp/instr/switch.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'origine à convertir. *
-* ctx = contexte de la phase de décompilation. *
-* *
-* Description : Décompile une instruction d'aiguillages multiples du flux. *
-* *
-* Retour : Instruction mise en place ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *dalvik_decomp_instr_switch(const GArchInstruction *instr, GDecContext *ctx)
-{
- GDecInstruction *result; /* Instruction à retourner */
- vmpa_t addr; /* Adresse de l'instruction */
- GArchOperand *operand; /* Opérande de l'instruction */
- GDecInstruction *val; /* Valeur décidant du flot */
-
- g_arch_instruction_get_location(instr, NULL, NULL, &addr);
-
- operand = g_arch_instruction_get_operand(instr, 0);
- val = g_dec_context_convert_register(ctx, operand, false, addr);
-
- result = g_switch_instruction_new(G_DEC_EXPRESSION(val));
-
- return result;
-
-}
diff --git a/src/arch/dalvik/decomp/translate.h b/src/arch/dalvik/decomp/translate.h
deleted file mode 100644
index ff55a39..0000000
--- a/src/arch/dalvik/decomp/translate.h
+++ /dev/null
@@ -1,101 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * translate.h - prototypes pour les environnements de traduction d'instructions Dalvik
- *
- * Copyright (C) 2010-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ANALYSIS_DECOMP_RTL_DALVIK_TRANSLATE_H
-#define _ANALYSIS_DECOMP_RTL_DALVIK_TRANSLATE_H
-
-
-#include "../../translate.h"
-
-
-
-/* Décompile une instruction de type 'aget'. */
-GDecInstruction *dalvik_decomp_instr_aget(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'aput'. */
-GDecInstruction *dalvik_decomp_instr_aput(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'array-length'. */
-GDecInstruction *dalvik_decomp_instr_array_length(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'const'. */
-GDecInstruction *dalvik_decomp_instr_const(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'const-string'. */
-GDecInstruction *dalvik_decomp_instr_const_str(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'iget'. */
-GDecInstruction *dalvik_decomp_instr_iget(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'invoke-direct'. */
-GDecInstruction *dalvik_decomp_instr_invoke_direct(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'invoke-static'. */
-GDecInstruction *dalvik_decomp_instr_invoke_static(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'invoke-virtual'. */
-GDecInstruction *dalvik_decomp_instr_invoke_virtual(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'iput'. */
-GDecInstruction *dalvik_decomp_instr_iput(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'move'. */
-GDecInstruction *dalvik_decomp_instr_move(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'move-object'. */
-GDecInstruction *dalvik_decomp_instr_move_object(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'move-result'. */
-GDecInstruction *dalvik_decomp_instr_move_result(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'new-instance'. */
-GDecInstruction *dalvik_decomp_instr_new_instance(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'return'. */
-GDecInstruction *dalvik_decomp_instr_return(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'return-void'. */
-GDecInstruction *dalvik_decomp_instr_return_void(const GArchInstruction *, GDecContext *);
-
-
-/* Décompile une instruction de type 'opérations arithmétiques'. */
-GDecInstruction *dalvik_decomp_instr_arithm(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'opérations arithmétiques'. */
-GDecInstruction *dalvik_decomp_instr_arithm_2addr(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de type 'opérations arithmétiques'. */
-GDecInstruction *dalvik_decomp_instr_arithm_lit(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de branchement conditionnel. */
-GDecInstruction *dalvik_decomp_instr_if(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction de branchement conditionnel. */
-GDecInstruction *dalvik_decomp_instr_if_zero(const GArchInstruction *, GDecContext *);
-
-/* Décompile une instruction d'aiguillages multiples du flux. */
-GDecInstruction *dalvik_decomp_instr_switch(const GArchInstruction *, GDecContext *);
-
-
-
-#endif /* _ANALYSIS_DECOMP_RTL_DALVIK_TRANSLATE_H */