diff options
Diffstat (limited to 'src/arch/dalvik/decomp')
-rw-r--r-- | src/arch/dalvik/decomp/aget.c | 9 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/aput.c | 9 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/arithm.c | 23 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/array.c | 7 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/const.c | 10 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/if.c | 16 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/iget.c | 7 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/invoke.c | 17 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/iput.c | 7 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/move.c | 19 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/new.c | 5 | ||||
-rw-r--r-- | src/arch/dalvik/decomp/ret.c | 5 |
12 files changed, 97 insertions, 37 deletions
diff --git a/src/arch/dalvik/decomp/aget.c b/src/arch/dalvik/decomp/aget.c index 0fa66eb..4ca012b 100644 --- a/src/arch/dalvik/decomp/aget.c +++ b/src/arch/dalvik/decomp/aget.c @@ -45,20 +45,23 @@ 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); + 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); + 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); + 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)); diff --git a/src/arch/dalvik/decomp/aput.c b/src/arch/dalvik/decomp/aput.c index 41bd89f..8d648e4 100644 --- a/src/arch/dalvik/decomp/aput.c +++ b/src/arch/dalvik/decomp/aput.c @@ -45,20 +45,23 @@ 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); + 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); + 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); + 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)); diff --git a/src/arch/dalvik/decomp/arithm.c b/src/arch/dalvik/decomp/arithm.c index a217adf..464694f 100644 --- a/src/arch/dalvik/decomp/arithm.c +++ b/src/arch/dalvik/decomp/arithm.c @@ -48,6 +48,7 @@ GDecInstruction *dalvik_decomp_instr_arithm(const GArchInstruction *instr, GDecC { 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é */ @@ -85,14 +86,16 @@ GDecInstruction *dalvik_decomp_instr_arithm(const GArchInstruction *instr, GDecC 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); + 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); + 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); + 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)); @@ -119,6 +122,7 @@ GDecInstruction *dalvik_decomp_instr_arithm_2addr(const GArchInstruction *instr, { 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 *dest; /* Enregistrement du résultat */ @@ -153,11 +157,13 @@ GDecInstruction *dalvik_decomp_instr_arithm_2addr(const GArchInstruction *instr, 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); + op1 = 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); + dest = g_dec_context_convert_register(ctx, operand, true, addr); arithm = g_arithm_expression_new(G_DEC_EXPRESSION(dest), type, G_DEC_EXPRESSION(op1)); result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(arithm)); @@ -184,6 +190,7 @@ GDecInstruction *dalvik_decomp_instr_arithm_lit(const GArchInstruction *instr, G { 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é */ @@ -225,14 +232,16 @@ GDecInstruction *dalvik_decomp_instr_arithm_lit(const GArchInstruction *instr, G 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); + 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); + 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)); diff --git a/src/arch/dalvik/decomp/array.c b/src/arch/dalvik/decomp/array.c index 3422461..217cab3 100644 --- a/src/arch/dalvik/decomp/array.c +++ b/src/arch/dalvik/decomp/array.c @@ -45,17 +45,20 @@ 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); + 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); + dest = g_dec_context_convert_register(ctx, operand, true, addr); result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(len)); diff --git a/src/arch/dalvik/decomp/const.c b/src/arch/dalvik/decomp/const.c index 98133ac..a451b55 100644 --- a/src/arch/dalvik/decomp/const.c +++ b/src/arch/dalvik/decomp/const.c @@ -47,12 +47,15 @@ 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); + 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)); @@ -80,14 +83,17 @@ GDecInstruction *dalvik_decomp_instr_const(const GArchInstruction *instr, GDecCo 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); + 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)); diff --git a/src/arch/dalvik/decomp/if.c b/src/arch/dalvik/decomp/if.c index b274ead..6a156ec 100644 --- a/src/arch/dalvik/decomp/if.c +++ b/src/arch/dalvik/decomp/if.c @@ -47,6 +47,7 @@ GDecInstruction *dalvik_decomp_instr_if(const GArchInstruction *instr, GDecConte { 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é */ @@ -78,14 +79,16 @@ GDecInstruction *dalvik_decomp_instr_if(const GArchInstruction *instr, GDecConte 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); + 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); + 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);*/ + jmp = 0x1234ull;/*g_dec_context_convert_register(ctx, operand, addr);*/ cond = g_cond_expression_new(G_DEC_EXPRESSION(op1), sign, G_DEC_EXPRESSION(op2)); result = g_ite_instruction_new(G_DEC_EXPRESSION(cond), jmp, jmp); @@ -113,6 +116,7 @@ GDecInstruction *dalvik_decomp_instr_if_zero(const GArchInstruction *instr, GDec { 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é */ @@ -144,14 +148,16 @@ GDecInstruction *dalvik_decomp_instr_if_zero(const GArchInstruction *instr, GDec 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); + op1 = g_dec_context_convert_register(ctx, operand, false, addr); operand = g_imm_operand_new_from_value(MDS_8_BITS_UNSIGNED, (unsigned int)0); op2 = g_imm_expression_new(operand); operand = g_arch_instruction_get_operand(instr, 2); - jmp = 0x1234ull;/*g_dec_context_convert_register(ctx, operand);*/ + jmp = 0x1234ull;/*g_dec_context_convert_register(ctx, operand, addr);*/ cond = g_cond_expression_new(G_DEC_EXPRESSION(op1), sign, G_DEC_EXPRESSION(op2)); result = g_ite_instruction_new(G_DEC_EXPRESSION(cond), jmp, jmp); diff --git a/src/arch/dalvik/decomp/iget.c b/src/arch/dalvik/decomp/iget.c index 5d1cf65..9cf603d 100644 --- a/src/arch/dalvik/decomp/iget.c +++ b/src/arch/dalvik/decomp/iget.c @@ -47,6 +47,7 @@ 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 */ @@ -55,8 +56,10 @@ GDecInstruction *dalvik_decomp_instr_iget(const GArchInstruction *instr, GDecCon 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); + 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)); @@ -66,7 +69,7 @@ GDecInstruction *dalvik_decomp_instr_iget(const GArchInstruction *instr, GDecCon 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); + 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)); diff --git a/src/arch/dalvik/decomp/invoke.c b/src/arch/dalvik/decomp/invoke.c index 7337ccc..4b2f20f 100644 --- a/src/arch/dalvik/decomp/invoke.c +++ b/src/arch/dalvik/decomp/invoke.c @@ -62,6 +62,7 @@ GDecInstruction *dalvik_decomp_instr_invoke_direct(const GArchInstruction *instr 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 */ @@ -123,10 +124,12 @@ GDecInstruction *dalvik_decomp_instr_invoke_direct(const GArchInstruction *instr 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); + reg = g_dec_context_convert_register(ctx, arg, false, addr); g_routine_call_add_arg(G_ROUTINE_CALL(result), reg); @@ -158,6 +161,7 @@ GDecInstruction *dalvik_decomp_instr_invoke_static(const GArchInstruction *instr 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 */ @@ -181,10 +185,12 @@ GDecInstruction *dalvik_decomp_instr_invoke_static(const GArchInstruction *instr 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); + reg = g_dec_context_convert_register(ctx, arg, false, addr); g_routine_call_add_arg(G_ROUTINE_CALL(call), reg); @@ -216,6 +222,7 @@ GDecInstruction *dalvik_decomp_instr_invoke_virtual(const GArchInstruction *inst 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 */ @@ -239,10 +246,12 @@ GDecInstruction *dalvik_decomp_instr_invoke_virtual(const GArchInstruction *inst 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); + reg = g_dec_context_convert_register(ctx, arg, false, addr); g_routine_call_add_arg(G_ROUTINE_CALL(call), reg); @@ -251,7 +260,7 @@ GDecInstruction *dalvik_decomp_instr_invoke_virtual(const GArchInstruction *inst /* 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); + reg = g_dec_context_convert_register(ctx, arg, false, addr); result = g_access_expression_new(G_DEC_EXPRESSION(reg), G_DEC_EXPRESSION(call)); diff --git a/src/arch/dalvik/decomp/iput.c b/src/arch/dalvik/decomp/iput.c index fedb00e..ed0830c 100644 --- a/src/arch/dalvik/decomp/iput.c +++ b/src/arch/dalvik/decomp/iput.c @@ -47,6 +47,7 @@ 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 */ @@ -55,11 +56,13 @@ GDecInstruction *dalvik_decomp_instr_iput(const GArchInstruction *instr, GDecCon 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); + 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); + 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)); diff --git a/src/arch/dalvik/decomp/move.c b/src/arch/dalvik/decomp/move.c index 9165447..a502952 100644 --- a/src/arch/dalvik/decomp/move.c +++ b/src/arch/dalvik/decomp/move.c @@ -44,15 +44,18 @@ 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); + 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); + dest = g_dec_context_convert_register(ctx, operand, true, addr); result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(src)); @@ -77,15 +80,18 @@ GDecInstruction *dalvik_decomp_instr_move(const GArchInstruction *instr, GDecCon 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); + 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); + dest = g_dec_context_convert_register(ctx, operand, true, addr); result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(src)); @@ -111,6 +117,7 @@ GDecInstruction *dalvik_decomp_instr_move_result(const GArchInstruction *instr, { 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 */ @@ -122,8 +129,10 @@ GDecInstruction *dalvik_decomp_instr_move_result(const GArchInstruction *instr, 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); + dest = g_dec_context_convert_register(ctx, operand, true, addr); result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(last)); diff --git a/src/arch/dalvik/decomp/new.c b/src/arch/dalvik/decomp/new.c index 75dc259..e30feb2 100644 --- a/src/arch/dalvik/decomp/new.c +++ b/src/arch/dalvik/decomp/new.c @@ -46,6 +46,7 @@ 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° */ @@ -53,6 +54,8 @@ GDecInstruction *dalvik_decomp_instr_new_instance(const GArchInstruction *instr, 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); @@ -61,7 +64,7 @@ GDecInstruction *dalvik_decomp_instr_new_instance(const GArchInstruction *instr, call = g_routine_call_new(constructor); operand = g_arch_instruction_get_operand(instr, 0); - dest = g_dec_context_convert_register(ctx, operand, true); + dest = g_dec_context_convert_register(ctx, operand, true, addr); result = g_assign_expression_new(G_DEC_EXPRESSION(dest), G_DEC_EXPRESSION(call)); diff --git a/src/arch/dalvik/decomp/ret.c b/src/arch/dalvik/decomp/ret.c index b7c5414..47179f3 100644 --- a/src/arch/dalvik/decomp/ret.c +++ b/src/arch/dalvik/decomp/ret.c @@ -44,11 +44,14 @@ 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); + reg = g_dec_context_convert_register(ctx, operand, false, addr); result = g_return_expression_new(G_DEC_EXPRESSION(reg)); |