summaryrefslogtreecommitdiff
path: root/src/arch/dalvik
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-12-04 20:28:35 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-12-04 20:28:35 (GMT)
commit6c67ffbb6c8a8dfb7120a0dab82dadbbf8112e88 (patch)
tree98b5195a053d7de292f2caced14e3ecda5ec32a5 /src/arch/dalvik
parentf95598b68b98f6eda701f8f02bc09cb13f65fc72 (diff)
Listed accesses to registers.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@294 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/dalvik')
-rw-r--r--src/arch/dalvik/instruction.c56
-rw-r--r--src/arch/dalvik/instruction.h4
-rw-r--r--src/arch/dalvik/opcodes/add.c20
-rw-r--r--src/arch/dalvik/opcodes/aget.c14
-rw-r--r--src/arch/dalvik/opcodes/and.c12
-rw-r--r--src/arch/dalvik/opcodes/array.c2
-rw-r--r--src/arch/dalvik/opcodes/cmp.c10
-rw-r--r--src/arch/dalvik/opcodes/const.c22
-rw-r--r--src/arch/dalvik/opcodes/div.c20
-rw-r--r--src/arch/dalvik/opcodes/iget.c14
-rw-r--r--src/arch/dalvik/opcodes/instanceof.c2
-rw-r--r--src/arch/dalvik/opcodes/move.c26
-rw-r--r--src/arch/dalvik/opcodes/mul.c20
-rw-r--r--src/arch/dalvik/opcodes/neg.c8
-rw-r--r--src/arch/dalvik/opcodes/new.c4
-rw-r--r--src/arch/dalvik/opcodes/not.c4
-rw-r--r--src/arch/dalvik/opcodes/or.c12
-rw-r--r--src/arch/dalvik/opcodes/rem.c20
-rw-r--r--src/arch/dalvik/opcodes/rsub.c4
-rw-r--r--src/arch/dalvik/opcodes/sget.c14
-rw-r--r--src/arch/dalvik/opcodes/shl.c10
-rw-r--r--src/arch/dalvik/opcodes/shr.c10
-rw-r--r--src/arch/dalvik/opcodes/sub.c16
-rw-r--r--src/arch/dalvik/opcodes/to.c30
-rw-r--r--src/arch/dalvik/opcodes/ushr.c10
-rw-r--r--src/arch/dalvik/opcodes/xor.c12
-rw-r--r--src/arch/dalvik/operand.c23
-rw-r--r--src/arch/dalvik/operand.h3
-rw-r--r--src/arch/dalvik/operands/register.c45
-rw-r--r--src/arch/dalvik/operands/register.h6
-rw-r--r--src/arch/dalvik/register.c73
-rw-r--r--src/arch/dalvik/register.h10
32 files changed, 473 insertions, 63 deletions
diff --git a/src/arch/dalvik/instruction.c b/src/arch/dalvik/instruction.c
index 5f3a1f4..1c109ba 100644
--- a/src/arch/dalvik/instruction.c
+++ b/src/arch/dalvik/instruction.c
@@ -26,8 +26,10 @@
#include "instruction-int.h"
#include "decomp/translate.h"
+#include "operands/register.h"
#include "operands/target.h"
#include "../instruction-int.h"
+#include "../register-int.h"
@@ -37,6 +39,9 @@ static void g_dalvik_instruction_class_init(GDalvikInstructionClass *);
/* Initialise une instance d'opérande d'architecture Dalvik. */
static void g_dalvik_instruction_init(GDalvikInstruction *);
+/* Liste les registres lus et écrits par l'instruction. */
+static void g_dalvik_instruction_get_rw_registers(const GDalvikInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *);
+
/* --------------------- AIDE A LA MISE EN PLACE D'INSTRUCTIONS --------------------- */
@@ -371,6 +376,7 @@ static void g_dalvik_instruction_init(GDalvikInstruction *instr)
parent = G_ARCH_INSTRUCTION(instr);
+ parent->get_rw_regs = (get_instruction_rw_regs_fc)g_dalvik_instruction_get_rw_registers;
parent->get_text = (get_instruction_text_fc)dalvik_get_instruction_text;
parent->get_link = (get_instruction_link_fc)dalvik_get_instruction_link;
parent->is_return = (is_instruction_return_fc)dalvik_instruction_is_return;
@@ -423,6 +429,56 @@ DalvikOpcodes g_dalvik_instruction_get_opcode(const GDalvikInstruction *instr)
}
+/******************************************************************************
+* *
+* Paramètres : instr = instruction à consulter. *
+* rregs = liste des rgistres lus. [OUT] *
+* rcount = nombre de registres lus. [OUT] *
+* wregs = liste des rgistres écrits. [OUT] *
+* wcount = nombre de registres écrits. [OUT] *
+* *
+* Description : Liste les registres lus et écrits par l'instruction. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dalvik_instruction_get_rw_registers(const GDalvikInstruction *instr, GArchRegister ***rregs, size_t *rcount, GArchRegister ***wregs, size_t *wcount)
+{
+ GArchInstruction *base; /* Version basique à manipuler */
+ size_t i; /* Boucle de parcours */
+ GArchOperand *operand; /* Operande à analyser */
+ GDalvikRegister *reg; /* Registre concerné */
+
+ base = G_ARCH_INSTRUCTION(instr);
+
+ for (i = 0; i < base->operands_count; i++)
+ {
+ operand = base->operands[i];
+
+ if (!G_IS_DALVIK_REGISTER_OPERAND(operand))
+ continue;
+
+ reg = g_dalvik_register_operand_get(G_DALVIK_REGISTER_OPERAND(operand));
+
+ if (g_dalvik_register_operand_is_written(G_DALVIK_REGISTER_OPERAND(operand)))
+ {
+ (*wregs) = (GArchRegister **)realloc(*wregs, ++(*wcount) * sizeof(GArchRegister *));
+ (*wregs)[(*wcount) - 1] = G_ARCH_REGISTER(reg);
+ }
+ else
+ {
+ (*rregs) = (GArchRegister **)realloc(*rregs, ++(*rcount) * sizeof(GArchRegister *));
+ (*rregs)[(*rcount) - 1] = G_ARCH_REGISTER(reg);
+ }
+
+ }
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* AIDE A LA MISE EN PLACE D'INSTRUCTIONS */
diff --git a/src/arch/dalvik/instruction.h b/src/arch/dalvik/instruction.h
index 4d510e8..c5ee713 100644
--- a/src/arch/dalvik/instruction.h
+++ b/src/arch/dalvik/instruction.h
@@ -62,4 +62,8 @@ DalvikOpcodes dalvik_guess_next_instruction(const bin_t *, off_t, off_t);
+/* ------------------------ AIDE A LA PHASE DE DECOMPILATION ------------------------ */
+
+
+
#endif /* _ARCH_DALVIK_INSTRUCTION_H */
diff --git a/src/arch/dalvik/opcodes/add.c b/src/arch/dalvik/opcodes/add.c
index 792eacd..a4c0403 100644
--- a/src/arch/dalvik/opcodes/add.c
+++ b/src/arch/dalvik/opcodes/add.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_add_double(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_add_double_2addr(const bin_t *data, off_t *p
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_add_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_add_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_add_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_add_int_lit16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_add_float(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -320,6 +334,8 @@ GArchInstruction *dalvik_read_instr_add_float_2addr(const bin_t *data, off_t *po
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -357,6 +373,8 @@ GArchInstruction *dalvik_read_instr_add_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -394,6 +412,8 @@ GArchInstruction *dalvik_read_instr_add_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/aget.c b/src/arch/dalvik/opcodes/aget.c
index bcf4984..c445aa4 100644
--- a/src/arch/dalvik/opcodes/aget.c
+++ b/src/arch/dalvik/opcodes/aget.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_aget(const bin_t *data, off_t *pos, off_t le
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_aget_boolean(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_aget_byte(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_aget_char(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_aget_object(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_aget_short(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_aget_wide(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/and.c b/src/arch/dalvik/opcodes/and.c
index 859fbe3..a136b0f 100644
--- a/src/arch/dalvik/opcodes/and.c
+++ b/src/arch/dalvik/opcodes/and.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_and_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_and_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_and_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_and_int_lit16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_and_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_and_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/array.c b/src/arch/dalvik/opcodes/array.c
index 9223e47..5e85420 100644
--- a/src/arch/dalvik/opcodes/array.c
+++ b/src/arch/dalvik/opcodes/array.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_array_length(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/cmp.c b/src/arch/dalvik/opcodes/cmp.c
index eb3a601..77d0b6e 100644
--- a/src/arch/dalvik/opcodes/cmp.c
+++ b/src/arch/dalvik/opcodes/cmp.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_cmp_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_cmpg_double(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_cmpg_float(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_cmpl_double(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_cmpl_float(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/const.c b/src/arch/dalvik/opcodes/const.c
index 7918e93..11d678f 100644
--- a/src/arch/dalvik/opcodes/const.c
+++ b/src/arch/dalvik/opcodes/const.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_const(const bin_t *data, off_t *pos, off_t l
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_const_16(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_const_4(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_const_class(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_const_high16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_const_string(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_const_string_jumbo(const bin_t *data, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -320,6 +334,8 @@ GArchInstruction *dalvik_read_instr_const_wide(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -357,6 +373,8 @@ GArchInstruction *dalvik_read_instr_const_wide_16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -394,6 +412,8 @@ GArchInstruction *dalvik_read_instr_const_wide_32(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -431,6 +451,8 @@ GArchInstruction *dalvik_read_instr_const_wide_high16(const bin_t *data, off_t *
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/div.c b/src/arch/dalvik/opcodes/div.c
index 8732fd0..d22189b 100644
--- a/src/arch/dalvik/opcodes/div.c
+++ b/src/arch/dalvik/opcodes/div.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_div_double(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_div_double_2addr(const bin_t *data, off_t *p
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_div_float(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_div_float_2addr(const bin_t *data, off_t *po
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_div_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_div_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_div_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -320,6 +334,8 @@ GArchInstruction *dalvik_read_instr_div_int_lit16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -357,6 +373,8 @@ GArchInstruction *dalvik_read_instr_div_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -394,6 +412,8 @@ GArchInstruction *dalvik_read_instr_div_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/iget.c b/src/arch/dalvik/opcodes/iget.c
index 3490b94..669a452 100644
--- a/src/arch/dalvik/opcodes/iget.c
+++ b/src/arch/dalvik/opcodes/iget.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_iget(const bin_t *data, off_t *pos, off_t le
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_iget_boolean(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_iget_byte(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_iget_char(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_iget_object(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_iget_short(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_iget_wide(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/instanceof.c b/src/arch/dalvik/opcodes/instanceof.c
index 9797b57..faed78e 100644
--- a/src/arch/dalvik/opcodes/instanceof.c
+++ b/src/arch/dalvik/opcodes/instanceof.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_instance_of(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/move.c b/src/arch/dalvik/opcodes/move.c
index 3daeab0..02ca204 100644
--- a/src/arch/dalvik/opcodes/move.c
+++ b/src/arch/dalvik/opcodes/move.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_move(const bin_t *data, off_t *pos, off_t le
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_move_exception(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_move_16(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_move_from_16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_move_object(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_move_object_16(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_move_object_from_16(const bin_t *data, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -320,6 +334,8 @@ GArchInstruction *dalvik_read_instr_move_result(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -357,6 +373,8 @@ GArchInstruction *dalvik_read_instr_move_result_object(const bin_t *data, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -394,6 +412,8 @@ GArchInstruction *dalvik_read_instr_move_result_wide(const bin_t *data, off_t *p
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -431,6 +451,8 @@ GArchInstruction *dalvik_read_instr_move_wide(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -468,6 +490,8 @@ GArchInstruction *dalvik_read_instr_move_wide_16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -505,6 +529,8 @@ GArchInstruction *dalvik_read_instr_move_wide_from_16(const bin_t *data, off_t *
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/mul.c b/src/arch/dalvik/opcodes/mul.c
index 959b859..cba9306 100644
--- a/src/arch/dalvik/opcodes/mul.c
+++ b/src/arch/dalvik/opcodes/mul.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_mul_double(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_mul_double_2addr(const bin_t *data, off_t *p
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_mul_float(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_mul_float_2addr(const bin_t *data, off_t *po
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_mul_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_mul_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_mul_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -320,6 +334,8 @@ GArchInstruction *dalvik_read_instr_mul_int_lit16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -357,6 +373,8 @@ GArchInstruction *dalvik_read_instr_mul_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -394,6 +412,8 @@ GArchInstruction *dalvik_read_instr_mul_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/neg.c b/src/arch/dalvik/opcodes/neg.c
index ce96a68..0facb59 100644
--- a/src/arch/dalvik/opcodes/neg.c
+++ b/src/arch/dalvik/opcodes/neg.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_neg_double(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_neg_float(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_neg_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_neg_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/new.c b/src/arch/dalvik/opcodes/new.c
index 4a16787..1a5b56c 100644
--- a/src/arch/dalvik/opcodes/new.c
+++ b/src/arch/dalvik/opcodes/new.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_new_array(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_new_instance(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/not.c b/src/arch/dalvik/opcodes/not.c
index 2bbb61a..00d5edb 100644
--- a/src/arch/dalvik/opcodes/not.c
+++ b/src/arch/dalvik/opcodes/not.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_not_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_not_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/or.c b/src/arch/dalvik/opcodes/or.c
index 6e57ef1..91ce63d 100644
--- a/src/arch/dalvik/opcodes/or.c
+++ b/src/arch/dalvik/opcodes/or.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_or_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_or_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_or_int_lit8(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_or_int_lit16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_or_long(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_or_long_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/rem.c b/src/arch/dalvik/opcodes/rem.c
index 687b651..0f7840d 100644
--- a/src/arch/dalvik/opcodes/rem.c
+++ b/src/arch/dalvik/opcodes/rem.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_rem_double(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_rem_double_2addr(const bin_t *data, off_t *p
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_rem_float(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_rem_float_2addr(const bin_t *data, off_t *po
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_rem_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_rem_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_rem_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -320,6 +334,8 @@ GArchInstruction *dalvik_read_instr_rem_int_lit16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -357,6 +373,8 @@ GArchInstruction *dalvik_read_instr_rem_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -394,6 +412,8 @@ GArchInstruction *dalvik_read_instr_rem_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/rsub.c b/src/arch/dalvik/opcodes/rsub.c
index 37434eb..04987ae 100644
--- a/src/arch/dalvik/opcodes/rsub.c
+++ b/src/arch/dalvik/opcodes/rsub.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_rsub_int(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_rsub_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/sget.c b/src/arch/dalvik/opcodes/sget.c
index 1f5eff7..f8b3d31 100644
--- a/src/arch/dalvik/opcodes/sget.c
+++ b/src/arch/dalvik/opcodes/sget.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_sget(const bin_t *data, off_t *pos, off_t le
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_sget_boolean(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_sget_byte(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_sget_char(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_sget_object(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_sget_short(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_sget_wide(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/shl.c b/src/arch/dalvik/opcodes/shl.c
index a7a08f7..48ef45b 100644
--- a/src/arch/dalvik/opcodes/shl.c
+++ b/src/arch/dalvik/opcodes/shl.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_shl_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_shl_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_shl_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_shl_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_shl_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/shr.c b/src/arch/dalvik/opcodes/shr.c
index f665f64..9e46971 100644
--- a/src/arch/dalvik/opcodes/shr.c
+++ b/src/arch/dalvik/opcodes/shr.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_shr_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_shr_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_shr_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_shr_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_shr_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/sub.c b/src/arch/dalvik/opcodes/sub.c
index 42eef73..183d838 100644
--- a/src/arch/dalvik/opcodes/sub.c
+++ b/src/arch/dalvik/opcodes/sub.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_sub_double(const bin_t *data, off_t *pos, of
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_sub_double_2addr(const bin_t *data, off_t *p
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_sub_float(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_sub_float_2addr(const bin_t *data, off_t *po
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_sub_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_sub_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_sub_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -320,6 +334,8 @@ GArchInstruction *dalvik_read_instr_sub_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/to.c b/src/arch/dalvik/opcodes/to.c
index 809dc1f..509dc2d 100644
--- a/src/arch/dalvik/opcodes/to.c
+++ b/src/arch/dalvik/opcodes/to.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_to_int_byte(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_to_int_char(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_to_int_double(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_to_int_float(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_to_int_long(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_to_int_short(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -283,6 +295,8 @@ GArchInstruction *dalvik_read_instr_to_double_float(const bin_t *data, off_t *po
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -320,6 +334,8 @@ GArchInstruction *dalvik_read_instr_to_double_int(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -357,6 +373,8 @@ GArchInstruction *dalvik_read_instr_to_double_long(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -394,6 +412,8 @@ GArchInstruction *dalvik_read_instr_to_float_double(const bin_t *data, off_t *po
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -431,6 +451,8 @@ GArchInstruction *dalvik_read_instr_to_float_int(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -468,6 +490,8 @@ GArchInstruction *dalvik_read_instr_to_float_long(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -505,6 +529,8 @@ GArchInstruction *dalvik_read_instr_to_long_double(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -542,6 +568,8 @@ GArchInstruction *dalvik_read_instr_to_long_float(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -579,6 +607,8 @@ GArchInstruction *dalvik_read_instr_to_long_int(const bin_t *data, off_t *pos, o
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/ushr.c b/src/arch/dalvik/opcodes/ushr.c
index b5a9b00..01dcef9 100644
--- a/src/arch/dalvik/opcodes/ushr.c
+++ b/src/arch/dalvik/opcodes/ushr.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_ushr_int(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_ushr_int_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_ushr_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_ushr_long(const bin_t *data, off_t *pos, off
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_ushr_long_2addr(const bin_t *data, off_t *po
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/opcodes/xor.c b/src/arch/dalvik/opcodes/xor.c
index 40c5ef9..343d129 100644
--- a/src/arch/dalvik/opcodes/xor.c
+++ b/src/arch/dalvik/opcodes/xor.c
@@ -61,6 +61,8 @@ GArchInstruction *dalvik_read_instr_xor_int(const bin_t *data, off_t *pos, off_t
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -98,6 +100,8 @@ GArchInstruction *dalvik_read_instr_xor_int_2addr(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -135,6 +139,8 @@ GArchInstruction *dalvik_read_instr_xor_int_lit8(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -172,6 +178,8 @@ GArchInstruction *dalvik_read_instr_xor_int_lit16(const bin_t *data, off_t *pos,
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -209,6 +217,8 @@ GArchInstruction *dalvik_read_instr_xor_long(const bin_t *data, off_t *pos, off_
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
@@ -246,6 +256,8 @@ GArchInstruction *dalvik_read_instr_xor_long_2addr(const bin_t *data, off_t *pos
return NULL;
}
+ dalvik_mark_first_operand_as_written(result);
+
return result;
}
diff --git a/src/arch/dalvik/operand.c b/src/arch/dalvik/operand.c
index 1bc9d4a..9d70f10 100644
--- a/src/arch/dalvik/operand.c
+++ b/src/arch/dalvik/operand.c
@@ -644,3 +644,26 @@ bool dalvik_read_operands(GArchInstruction *instr, const GDexFormat *format, con
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction dont la définition est incomplète. *
+* *
+* Description : Procède à la lecture d'opérandes pour une instruction. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void dalvik_mark_first_operand_as_written(GArchInstruction *instr)
+{
+ GArchOperand *operand; /* Première opérande visé */
+
+ operand = g_arch_instruction_get_operand(instr, 0);
+
+ g_dalvik_register_operand_mark_as_written(G_DALVIK_REGISTER_OPERAND(operand));
+
+}
diff --git a/src/arch/dalvik/operand.h b/src/arch/dalvik/operand.h
index 9b4a289..1e02eef 100644
--- a/src/arch/dalvik/operand.h
+++ b/src/arch/dalvik/operand.h
@@ -114,6 +114,9 @@ typedef enum _DalvikOperandType
/* Procède à la lecture d'opérandes pour une instruction. */
bool dalvik_read_operands(GArchInstruction *, const GDexFormat *, const bin_t *, off_t *, off_t, SourceEndian, DalvikOperandType, ...);
+/* Procède à la lecture d'opérandes pour une instruction. */
+void dalvik_mark_first_operand_as_written(GArchInstruction *);
+
#endif /* _ARCH_DALVIK_OPERAND_H */
diff --git a/src/arch/dalvik/operands/register.c b/src/arch/dalvik/operands/register.c
index fb95004..9f172dd 100644
--- a/src/arch/dalvik/operands/register.c
+++ b/src/arch/dalvik/operands/register.c
@@ -34,6 +34,7 @@ struct _GDalvikRegisterOperand
GArchOperand parent; /* Instance parente */
GDalvikRegister *reg; /* Registre représenté */
+ bool is_written; /* Changement de contenu */
};
@@ -103,6 +104,8 @@ static void g_dalvik_register_operand_init(GDalvikRegisterOperand *operand)
parent->compare = (operand_compare_fc)g_dalvik_register_operand_compare;
parent->print = (operand_print_fc)g_dalvik_register_operand_print;
+ operand->is_written = false;
+
}
@@ -228,7 +231,7 @@ GDalvikRegister *g_dalvik_register_operand_get(const GDalvikRegisterOperand *ope
static bool g_dalvik_register_operand_compare(const GDalvikRegisterOperand *a, const GDalvikRegisterOperand *b)
{
- return g_dalvik_register_compare(a->reg, b->reg);
+ return (g_dalvik_register_compare(a->reg, b->reg) == 0);
}
@@ -249,6 +252,44 @@ static bool g_dalvik_register_operand_compare(const GDalvikRegisterOperand *a, c
static void g_dalvik_register_operand_print(const GDalvikRegisterOperand *operand, GBufferLine *line, AsmSyntax syntax)
{
- g_dalvik_pool_operand_print(operand->reg, line, syntax);
+ g_dalvik_register_print(operand->reg, line, syntax);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande représentant un registre à mettre à jour. *
+* *
+* Description : Marque l'opérande comme étant écrit plutôt que consulté. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_dalvik_register_operand_mark_as_written(GDalvikRegisterOperand *operand)
+{
+ operand->is_written = true;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande représentant un registre à consulter. *
+* *
+* Description : Indique le type d'accès réalisé sur l'opérande. *
+* *
+* Retour : Type d'accès : true en cas d'écriture, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_dalvik_register_operand_is_written(const GDalvikRegisterOperand *operand)
+{
+ return operand->is_written;
}
diff --git a/src/arch/dalvik/operands/register.h b/src/arch/dalvik/operands/register.h
index ee83b79..8bd4ff1 100644
--- a/src/arch/dalvik/operands/register.h
+++ b/src/arch/dalvik/operands/register.h
@@ -61,6 +61,12 @@ GArchOperand *g_dalvik_register_operand_new_from_existing(GDalvikRegister *);
/* Fournit le registre Dalvik associé à l'opérande. */
GDalvikRegister *g_dalvik_register_operand_get(const GDalvikRegisterOperand *);
+/* Marque l'opérande comme étant écrit plutôt que consulté. */
+void g_dalvik_register_operand_mark_as_written(GDalvikRegisterOperand *);
+
+/* Indique le type d'accès réalisé sur l'opérande. */
+bool g_dalvik_register_operand_is_written(const GDalvikRegisterOperand *);
+
#endif /* _ARCH_DALVIK_OPERANDS_REGISTER_H */
diff --git a/src/arch/dalvik/register.c b/src/arch/dalvik/register.c
index b2023b5..db4186a 100644
--- a/src/arch/dalvik/register.c
+++ b/src/arch/dalvik/register.c
@@ -27,14 +27,14 @@
#include <stdio.h>
-#include "../operand-int.h"
+#include "../register-int.h"
/* Représentation d'un registre Dalvik (instance) */
struct _GDalvikRegister
{
- GArchOperand parent; /* Instance parente */
+ GArchRegister parent; /* Instance parente */
uint16_t index; /* Indice du registre */
@@ -44,7 +44,7 @@ struct _GDalvikRegister
/* Représentation d'un registre Dalvik (classe) */
struct _GDalvikRegisterClass
{
- GArchOperandClass parent; /* Classe parente */
+ GArchRegisterClass parent; /* Classe parente */
};
@@ -61,7 +61,7 @@ static void g_dalvik_register_init(GDalvikRegister *);
/* Indique le type défini pour une représentation d'un registre Dalvik. */
-G_DEFINE_TYPE(GDalvikRegister, g_dalvik_register, G_TYPE_ARCH_OPERAND);
+G_DEFINE_TYPE(GDalvikRegister, g_dalvik_register, G_TYPE_ARCH_REGISTER);
/******************************************************************************
@@ -96,6 +96,12 @@ static void g_dalvik_register_class_init(GDalvikRegisterClass *klass)
static void g_dalvik_register_init(GDalvikRegister *reg)
{
+ GArchRegister *base; /* Version basique */
+
+ base = G_ARCH_REGISTER(reg);
+
+ base->compare = (reg_compare_fc)g_dalvik_register_compare;
+ base->print = (reg_print_fc)g_dalvik_register_print;
}
@@ -157,19 +163,18 @@ uint16_t g_dalvik_register_get_index(const GDalvikRegister *reg)
* *
******************************************************************************/
-bool g_dalvik_register_compare(const GDalvikRegister *a, const GDalvikRegister *b)
+int g_dalvik_register_compare(const GDalvikRegister *a, const GDalvikRegister *b)
{
- /* FIXME : GCC (Debian 4.4.5-4) trouble ? */
-
- if (a == NULL)
- printf("Alerte :: %hd & %hd\n", a->index, b->index);
+ int result; /* Bilan à retourner */
- /*
- printf("Compare :: %p & %p\n", a, b);
- printf("Compare :: %hd & %hd\n", a->index, b->index);
- */
+ if (a->index < b->index)
+ result = -1;
+ else if (a->index < b->index)
+ result = 1;
+ else
+ result = 0;
- return (a->index == b->index);
+ return result;
}
@@ -188,7 +193,7 @@ bool g_dalvik_register_compare(const GDalvikRegister *a, const GDalvikRegister *
* *
******************************************************************************/
-void g_dalvik_pool_operand_print(const GDalvikRegister *reg, GBufferLine *line, AsmSyntax syntax)
+void g_dalvik_register_print(const GDalvikRegister *reg, GBufferLine *line, AsmSyntax syntax)
{
char key[MAX_REGNAME_LEN]; /* Mot clef principal */
size_t klen; /* Taille de ce mot clef */
@@ -212,41 +217,3 @@ void g_dalvik_pool_operand_print(const GDalvikRegister *reg, GBufferLine *line,
g_buffer_line_insert_text(line, BLC_ASSEMBLY, key, klen, RTT_REGISTER);
}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = registre à consulter. *
-* *
-* Description : Indique si le registre correspond à ebp ou similaire. *
-* *
-* Retour : true si la correspondance est avérée, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_dalvik_register_is_base_pointer(const GDalvikRegister *reg)
-{
- return false;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = registre à consulter. *
-* *
-* Description : Indique si le registre correspond à esp ou similaire. *
-* *
-* Retour : true si la correspondance est avérée, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_dalvik_register_is_stack_pointer(const GDalvikRegister *reg)
-{
- return false;
-
-}
diff --git a/src/arch/dalvik/register.h b/src/arch/dalvik/register.h
index 3fc551a..d0be60d 100644
--- a/src/arch/dalvik/register.h
+++ b/src/arch/dalvik/register.h
@@ -59,16 +59,10 @@ GDalvikRegister *g_dalvik_register_new(uint16_t);
uint16_t g_dalvik_register_get_index(const GDalvikRegister *);
/* Compare un registre avec un autre. */
-bool g_dalvik_register_compare(const GDalvikRegister *, const GDalvikRegister *);
+int g_dalvik_register_compare(const GDalvikRegister *, const GDalvikRegister *);
/* Traduit un registre en version humainement lisible. */
-void g_dalvik_pool_operand_print(const GDalvikRegister *, GBufferLine *, AsmSyntax);
-
-/* Indique si le registre correspond à ebp ou similaire. */
-bool g_dalvik_register_is_base_pointer(const GDalvikRegister *);
-
-/* Indique si le registre correspond à esp ou similaire. */
-bool g_dalvik_register_is_stack_pointer(const GDalvikRegister *);
+void g_dalvik_register_print(const GDalvikRegister *, GBufferLine *, AsmSyntax);