summaryrefslogtreecommitdiff
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
parentf95598b68b98f6eda701f8f02bc09cb13f65fc72 (diff)
Listed accesses to registers.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@294 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog57
-rw-r--r--src/arch/Makefile.am2
-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
-rw-r--r--src/arch/instruction-int.h4
-rw-r--r--src/arch/instruction.c31
-rw-r--r--src/arch/instruction.h4
-rw-r--r--src/arch/register-int.h68
-rw-r--r--src/arch/register.c169
-rw-r--r--src/arch/register.h69
40 files changed, 877 insertions, 63 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f0f6aa..0ceb01b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,60 @@
+12-12-04 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/arch/dalvik/instruction.c:
+ List accesses to Dalvik registers.
+
+ * src/arch/dalvik/instruction.h:
+ * src/arch/dalvik/opcodes/add.c:
+ * src/arch/dalvik/opcodes/aget.c:
+ * src/arch/dalvik/opcodes/and.c:
+ * src/arch/dalvik/opcodes/array.c:
+ * src/arch/dalvik/opcodes/cmp.c:
+ * src/arch/dalvik/opcodes/const.c:
+ * src/arch/dalvik/opcodes/div.c:
+ * src/arch/dalvik/opcodes/iget.c:
+ * src/arch/dalvik/opcodes/instanceof.c:
+ * src/arch/dalvik/opcodes/move.c:
+ * src/arch/dalvik/opcodes/mul.c:
+ * src/arch/dalvik/opcodes/neg.c:
+ * src/arch/dalvik/opcodes/new.c:
+ * src/arch/dalvik/opcodes/not.c:
+ * src/arch/dalvik/opcodes/or.c:
+ * src/arch/dalvik/opcodes/rem.c:
+ * src/arch/dalvik/opcodes/rsub.c:
+ * src/arch/dalvik/opcodes/sget.c:
+ * src/arch/dalvik/opcodes/shl.c:
+ * src/arch/dalvik/opcodes/shr.c:
+ * src/arch/dalvik/opcodes/sub.c:
+ * src/arch/dalvik/opcodes/to.c:
+ * src/arch/dalvik/opcodes/ushr.c:
+ * src/arch/dalvik/opcodes/xor.c:
+ Mark all write access to registers.
+
+ * src/arch/dalvik/operand.c:
+ * src/arch/dalvik/operand.h:
+ Introduce a function to mark write access easyly.
+
+ * src/arch/dalvik/operands/register.c:
+ * src/arch/dalvik/operands/register.h:
+ Update code. Remember if the operand is written.
+
+ * src/arch/dalvik/register.c:
+ * src/arch/dalvik/register.h:
+ Update code.
+
+ * src/arch/instruction.c:
+ * src/arch/instruction.h:
+ * src/arch/instruction-int.h:
+ List accesses to registers.
+
+ * src/arch/Makefile.am:
+ Add the 'register-int.h' and 'register.[ch] files to libarch_la_SOURCES.
+
+ * src/arch/register.c:
+ * src/arch/register.h:
+ * src/arch/register-int.h:
+ New entries: define generic registers.
+
12-11-28 Cyrille Bagard <nocbos@gmail.com>
* src/analysis/decomp/decompiler.c:
diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am
index 4f410cc..57a5b74 100644
--- a/src/arch/Makefile.am
+++ b/src/arch/Makefile.am
@@ -13,6 +13,8 @@ libarch_la_SOURCES = \
operand.h operand.c \
processor-int.h \
processor.h processor.c \
+ register-int.h \
+ register.h register.c \
translate.h
libarch_la_LIBADD = \
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);
diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h
index c89a51b..af72a87 100644
--- a/src/arch/instruction-int.h
+++ b/src/arch/instruction-int.h
@@ -32,6 +32,9 @@
+/* Liste les registres lus et écrits par l'instruction. */
+typedef void (* get_instruction_rw_regs_fc) (const GArchInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *);
+
/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
typedef void (* print_instruction_fc) (const GArchInstruction *, GCodeBuffer *, MemoryDataSize, const bin_t *, AsmSyntax);
@@ -66,6 +69,7 @@ struct _GArchInstruction
InstructionLinkType *links_type; /* Type des liens de dest. */
size_t to_count; /* Nombre de ces destinations */
+ get_instruction_rw_regs_fc get_rw_regs; /* Liste des registres liés */
print_instruction_fc print; /* Imprime l'ensemble */
get_instruction_text_fc get_text; /* Texte humain équivalent */
get_instruction_link_fc get_link; /* Référence à une instruction */
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 98d7c85..aa90e70 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -264,6 +264,37 @@ void g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *op
}
+/******************************************************************************
+* *
+* 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 : Les compteurs de références sont à décrémenter après usage ! *
+* *
+******************************************************************************/
+
+void g_arch_instruction_get_rw_registers(const GArchInstruction *instr, GArchRegister ***rregs, size_t *rcount, GArchRegister ***wregs, size_t *wcount)
+{
+ size_t i; /* Boucle de parcours */
+
+ instr->get_rw_regs(instr, rregs, rcount, wregs, wcount);
+
+ for (i = 0; i < *rcount; i++)
+ g_object_ref(G_OBJECT((*rregs)[i]));
+
+ for (i = 0; i < *wcount; i++)
+ g_object_ref(G_OBJECT((*wregs)[i]));
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* DEFINITION DES LIAISONS ENTRE INSTRUCTIONS */
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index a4e26d4..ae0bd68 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -32,6 +32,7 @@
#include "archbase.h"
#include "operand.h"
+#include "register.h"
#include "../decomp/context.h"
#include "../decomp/instruction.h"
#include "../format/executable.h"
@@ -89,6 +90,9 @@ void g_arch_instruction_replace_operand(GArchInstruction *, GArchOperand *, cons
/* Détache un opérande liée d'une instruction. */
void g_arch_instruction_detach_operand(GArchInstruction *, GArchOperand *);
+/* Liste les registres lus et écrits par l'instruction. */
+void g_arch_instruction_get_rw_registers(const GArchInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *);
+
/* ------------------- DEFINITION DES LIAISONS ENTRE INSTRUCTIONS ------------------- */
diff --git a/src/arch/register-int.h b/src/arch/register-int.h
new file mode 100644
index 0000000..00773f3
--- /dev/null
+++ b/src/arch/register-int.h
@@ -0,0 +1,68 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * register-int.h - définitions internes pour la représentation générique d'un registre
+ *
+ * Copyright (C) 2012 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 _ARCH_ARCH_REGISTER_INT_H
+#define _ARCH_ARCH_REGISTER_INT_H
+
+
+#include "register.h"
+
+
+
+/* Compare un registre avec un autre. */
+typedef int (* reg_compare_fc) (const GArchRegister *, const GArchRegister *);
+
+/* Traduit un registre en version humainement lisible. */
+typedef void (* reg_print_fc) (const GArchRegister *, GBufferLine *, AsmSyntax);
+
+/* Indique si le registre correspond à ebp ou similaire. */
+typedef bool (* reg_is_base_pointer_fc) (const GArchRegister *);
+
+/* Indique si le registre correspond à esp ou similaire. */
+typedef bool (* reg_is_stack_pointer_fc) (const GArchRegister *);
+
+
+
+/* Représentation d'un registre (instance) */
+struct _GArchRegister
+{
+ GObject parent; /* A laisser en premier */
+
+ reg_compare_fc compare; /* Comparaison de registres */
+ reg_print_fc print; /* Impression du registre */
+ reg_is_base_pointer_fc is_bp; /* Correspondance avec ebp */
+ reg_is_stack_pointer_fc is_sp; /* Correspondance avec esp */
+
+};
+
+
+/* Représentation d'un registre (classe) */
+struct _GArchRegisterClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+
+#endif /* _ARCH_ARCH_REGISTER_INT_H */
diff --git a/src/arch/register.c b/src/arch/register.c
new file mode 100644
index 0000000..6631d4b
--- /dev/null
+++ b/src/arch/register.c
@@ -0,0 +1,169 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * registers.c - aides auxiliaires relatives aux registres Dalvik
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 "register.h"
+
+
+#include "register-int.h"
+
+
+
+/* Initialise la classe des registres. */
+static void g_arch_register_class_init(GArchRegisterClass *);
+
+/* Initialise une instance de registre. */
+static void g_arch_register_init(GArchRegister *);
+
+
+
+/* Indique le type défini pour une représentation d'un registre. */
+G_DEFINE_TYPE(GArchRegister, g_arch_register, G_TYPE_OBJECT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des registres. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_arch_register_class_init(GArchRegisterClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = instance à initialiser. *
+* *
+* Description : Initialise une instance de registre. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_arch_register_init(GArchRegister *reg)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un registre avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int g_arch_register_compare(const GArchRegister *a, const GArchRegister *b)
+{
+ return a->compare(a, b);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : reg = registre à transcrire. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Traduit un registre en version humainement lisible. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_arch_register_print(const GArchRegister *reg, GBufferLine *line, AsmSyntax syntax)
+{
+ reg->print(reg, line, syntax);
+
+}
+
+
+/******************************************************************************
+* *
+* 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_arch_register_is_base_pointer(const GArchRegister *reg)
+{
+ bool result; /* Bilan à renvoyer */
+
+ if (reg->is_bp)
+ result = reg->is_bp(reg);
+ else
+ result = false;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* 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_arch_register_is_stack_pointer(const GArchRegister *reg)
+{
+ bool result; /* Bilan à renvoyer */
+
+ if (reg->is_sp)
+ result = reg->is_sp(reg);
+ else
+ result = false;
+
+ return result;
+
+}
diff --git a/src/arch/register.h b/src/arch/register.h
new file mode 100644
index 0000000..a163ad3
--- /dev/null
+++ b/src/arch/register.h
@@ -0,0 +1,69 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * register.h - prototypes pour les aides auxiliaires relatives aux registres Dalvik
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 _ARCH_ARCH_REGISTER_H
+#define _ARCH_ARCH_REGISTER_H
+
+
+#include <glib-object.h>
+#include <stdbool.h>
+
+
+#include "archbase.h"
+#include "../glibext/gbufferline.h"
+
+
+
+#define G_TYPE_ARCH_REGISTER g_arch_register_get_type()
+#define G_ARCH_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_arch_register_get_type(), GArchRegister))
+#define G_IS_ARCH_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_arch_register_get_type()))
+#define G_ARCH_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARCH_REGISTER, GArchRegisterClass))
+#define G_IS_ARCH_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARCH_REGISTER))
+#define G_ARCH_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARCH_REGISTER, GArchRegisterClass))
+
+
+/* Représentation d'un registre (instance) */
+typedef struct _GArchRegister GArchRegister;
+
+/* Représentation d'un registre (classe) */
+typedef struct _GArchRegisterClass GArchRegisterClass;
+
+
+/* Indique le type défini pour une représentation d'un registre. */
+GType g_arch_register_get_type(void);
+
+/* Compare un registre avec un autre. */
+int g_arch_register_compare(const GArchRegister *, const GArchRegister *);
+
+/* Traduit un registre en version humainement lisible. */
+void g_arch_register_print(const GArchRegister *, GBufferLine *, AsmSyntax);
+
+/* Indique si le registre correspond à ebp ou similaire. */
+bool g_arch_register_is_base_pointer(const GArchRegister *);
+
+/* Indique si le registre correspond à esp ou similaire. */
+bool g_arch_register_is_stack_pointer(const GArchRegister *);
+
+
+
+#endif /* _ARCH_ARCH_REGISTER_H */