summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog38
-rw-r--r--src/arch/dalvik/instruction-def.h43
-rw-r--r--src/arch/dalvik/instruction.c44
-rw-r--r--src/arch/dalvik/opcodes/Makefile.am3
-rw-r--r--src/arch/dalvik/opcodes/add.c36
-rw-r--r--src/arch/dalvik/opcodes/const.c145
-rw-r--r--src/arch/dalvik/opcodes/div.c36
-rw-r--r--src/arch/dalvik/opcodes/invoke.c180
-rw-r--r--src/arch/dalvik/opcodes/move.c72
-rw-r--r--src/arch/dalvik/opcodes/mul.c36
-rw-r--r--src/arch/dalvik/opcodes/opcodes.h98
-rw-r--r--src/arch/dalvik/opcodes/shl.c74
-rw-r--r--src/arch/dalvik/opcodes/shr.c209
-rw-r--r--src/arch/dalvik/opcodes/switch.c101
-rw-r--r--src/arch/dalvik/opcodes/ushr.c209
-rw-r--r--src/arch/dalvik/operand.c93
-rw-r--r--src/arch/dalvik/operand.h6
-rw-r--r--src/arch/dalvik/operands/register.c26
-rw-r--r--src/arch/dalvik/operands/register.h4
-rw-r--r--src/arch/dalvik/processor.c42
-rw-r--r--src/arch/processor.c2
21 files changed, 1474 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index f63203a..765885d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+11-12-27 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/arch/dalvik/instruction.c:
+ * src/arch/dalvik/instruction-def.h:
+ * src/arch/dalvik/opcodes/add.c:
+ * src/arch/dalvik/opcodes/const.c:
+ * src/arch/dalvik/opcodes/div.c:
+ * src/arch/dalvik/opcodes/invoke.c:
+ Add support for more Dalvik opcodes.
+
+ * src/arch/dalvik/opcodes/Makefile.am:
+ Add the [u]shr.c and switch.c files to libarchdalvikopcodes_la_SOURCES.
+
+ * src/arch/dalvik/opcodes/move.c:
+ * src/arch/dalvik/opcodes/mul.c:
+ * src/arch/dalvik/opcodes/opcodes.h:
+ * src/arch/dalvik/opcodes/shl.c:
+ Add support for more Dalvik opcodes.
+
+ * src/arch/dalvik/opcodes/shr.c:
+ * src/arch/dalvik/opcodes/switch.c:
+ * src/arch/dalvik/opcodes/ushr.c:
+ New entries: support [u]shr and *-switch opcodes.
+
+ * src/arch/dalvik/operand.c:
+ * src/arch/dalvik/operand.h:
+ Build 31C and 3R* operands types.
+
+ * src/arch/dalvik/operands/register.c:
+ * src/arch/dalvik/operands/register.h:
+ Allow to build an operand from an existing register instance.
+
+ * src/arch/dalvik/processor.c:
+ Add support for more Dalvik opcodes.
+
+ * src/arch/processor.c:
+ Add debug code to print unsupported opcodes.
+
11-12-26 Cyrille Bagard <nocbos@gmail.com>
* configure.ac:
diff --git a/src/arch/dalvik/instruction-def.h b/src/arch/dalvik/instruction-def.h
index f389600..38df061 100644
--- a/src/arch/dalvik/instruction-def.h
+++ b/src/arch/dalvik/instruction-def.h
@@ -33,7 +33,10 @@ typedef enum _DalvikOpcodes
DOP_MOVE, /* move (0x01) */
DOP_MOVE_FROM_16, /* move/from16 (0x02) */
+ DOP_MOVE_WIDE_FROM_16, /* move-wide/from16 (0x05) */
+
DOP_MOVE_OBJECT, /* move-object (0x07) */
+ DOP_MOVE_OBJECT_FROM_16, /* move-object/from16 (0x08) */
DOP_MOVE_RESULT, /* move-result (0x0a) */
DOP_MOVE_RESULT_WIDE, /* move-result-wide (0x0b) */
@@ -48,10 +51,12 @@ typedef enum _DalvikOpcodes
DOP_CONST, /* const (0x14) */
DOP_CONST_HIGH16, /* const/high16 (0x15) */
DOP_CONST_WIDE_16, /* const-wide/16 (0x16) */
-
+ DOP_CONST_WIDE_32, /* const-wide/32 (0x17) */
DOP_CONST_WIDE, /* const-wide (0x18) */
-
+ DOP_CONST_WIDE_HIGH16, /* const-wide/high16 (0x19) */
DOP_CONST_STRING, /* const-string (0x1a) */
+ DOP_CONST_STRING_JUMBO, /* const-string/jumbo (0x1b) */
+ DOP_CONST_CLASS, /* const-class (0x1c) */
DOP_CHECK_CAST, /* check-cast (0x1f) */
@@ -65,8 +70,8 @@ typedef enum _DalvikOpcodes
DOP_GOTO, /* goto (0x28) */
DOP_GOTO_16, /* goto/16 (0x29) */
DOP_GOTO_32, /* goto/32 (0x2a) */
-
-
+ DOP_PACKED_SWITCH, /* packed-switch (0x2b) */
+ DOP_SPARSE_SWITCH, /* sparse-switch (0x2c) */
DOP_CMPL_FLOAT, /* cmp-long (0x2d) */
DOP_CMPG_FLOAT, /* cmpg-float (0x2e) */
DOP_CMPL_DOUBLE, /* cmpl-double (0x2f) */
@@ -135,7 +140,11 @@ typedef enum _DalvikOpcodes
DOP_INVOKE_STATIC, /* invoke-static (0x71) */
DOP_INVOKE_INTERFACE, /* invoke-interface (0x72) */
-
+ DOP_INVOKE_VIRTUAL_RANGE, /* invoke-virtual/range (0x74) */
+ DOP_INVOKE_SUPER_RANGE, /* invoke-super/range (0x75) */
+ DOP_INVOKE_DIRECT_RANGE, /* invoke-direct/range (0x76) */
+ DOP_INVOKE_STATIC_RANGE, /* invoke-static/range (0x77) */
+ DOP_INVOKE_INTERFACE_RANGE, /* invoke-interface/rg. (0x78) */
DOP_TO_INT_LONG, /* int-to-long (0x81) */
DOP_TO_INT_FLOAT, /* int-to-float (0x82) */
@@ -161,6 +170,18 @@ typedef enum _DalvikOpcodes
DOP_OR_INT, /* or-int (0x96) */
DOP_XOR_INT, /* xor-int (0x97) */
DOP_SHL_INT, /* shl-int (0x98) */
+ DOP_SHR_INT, /* shr-int (0x99) */
+ DOP_USHR_INT, /* ushr-int (0x9a) */
+
+
+ DOP_MUL_LONG, /* mul-long (0x9d) */
+ DOP_DIV_LONG, /* div-long (0x9e) */
+
+
+ DOP_SHL_LONG, /* shl-long (0xa3) */
+ DOP_SHR_LONG, /* shr-long (0xa4) */
+ DOP_USHR_LONG, /* ushr-long (0xa5) */
+
DOP_ADD_INT_2ADDR, /* add-int/2addr (0xb0) */
@@ -171,6 +192,16 @@ typedef enum _DalvikOpcodes
DOP_OR_INT_2ADDR, /* or-int/2addr (0xb6) */
DOP_XOR_INT_2ADDR, /* xor-int/2addr (0xb7) */
DOP_SHL_INT_2ADDR, /* shl-int/2addr (0xb8) */
+ DOP_SHR_INT_2ADDR, /* shr-int/2addr (0xb9) */
+ DOP_USHR_INT_2ADDR, /* ushr-int/2addr (0xba) */
+ DOP_ADD_LONG_2ADDR, /* add-long/2addr (0xbb) */
+
+
+
+ DOP_SHL_LONG_2ADDR, /* shl-long/2addr (0xc3) */
+ DOP_SHR_LONG_2ADDR, /* shr-long/2addr (0xc4) */
+ DOP_USHR_LONG_2ADDR, /* ushr-long/2addr (0xc5) */
+
DOP_MUL_DOUBLE_2ADDR, /* mul-double/2addr (0xcd) */
@@ -191,6 +222,8 @@ typedef enum _DalvikOpcodes
DOP_OR_INT_LIT8, /* or-int/lit8 (0xde) */
DOP_XOR_INT_LIT8, /* xor-int/lit8 (0xdf) */
DOP_SHL_INT_LIT8, /* shl-int/lit8 (0xe0) */
+ DOP_SHR_INT_LIT8, /* shr-int/lit8 (0xe1) */
+ DOP_USHR_INT_LIT8, /* ushr-int/lit8 (0xe2) */
DOP_COUNT
diff --git a/src/arch/dalvik/instruction.c b/src/arch/dalvik/instruction.c
index 54b8afd..8779428 100644
--- a/src/arch/dalvik/instruction.c
+++ b/src/arch/dalvik/instruction.c
@@ -59,7 +59,12 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_MOVE] = { 0x01, "move" },
[DOP_MOVE_FROM_16] = { 0x02, "move/from16" },
+
+ [DOP_MOVE_WIDE_FROM_16] = { 0x05, "move-wide/from16" },
+
+
[DOP_MOVE_OBJECT] = { 0x07, "move-object" },
+ [DOP_MOVE_OBJECT_FROM_16] = { 0x08, "move-object/from16" },
[DOP_MOVE_RESULT] = { 0x0a, "move-result" },
[DOP_MOVE_RESULT_WIDE] = { 0x0b, "move-result-wide" },
@@ -74,10 +79,12 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_CONST] = { 0x14, "const" },
[DOP_CONST_HIGH16] = { 0x15, "const/high16" },
[DOP_CONST_WIDE_16] = { 0x16, "const-wide/16" },
-
+ [DOP_CONST_WIDE_32] = { 0x17, "const-wide/32" },
[DOP_CONST_WIDE] = { 0x18, "const-wide" },
-
+ [DOP_CONST_WIDE_HIGH16] = { 0x19, "const-wide/high16" },
[DOP_CONST_STRING] = { 0x1a, "const-string" },
+ [DOP_CONST_STRING_JUMBO] = { 0x1b, "const-string/jumbo" },
+ [DOP_CONST_CLASS] = { 0x1c, "const-class" },
[DOP_CHECK_CAST] = { 0x1f, "check-cast" },
@@ -92,7 +99,8 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_GOTO] = { 0x28, "goto" },
[DOP_GOTO_16] = { 0x29, "goto/16" },
[DOP_GOTO_32] = { 0x2a, "goto/32" },
-
+ [DOP_PACKED_SWITCH] = { 0x2b, "packed-switch" },
+ [DOP_SPARSE_SWITCH] = { 0x2c, "sparse-switch" },
[DOP_CMPL_FLOAT] = { 0x2d, "cmp-long" },
[DOP_CMPG_FLOAT] = { 0x2e, "cmpg-float" },
[DOP_CMPL_DOUBLE] = { 0x2f, "cmpl-double" },
@@ -161,6 +169,14 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_INVOKE_STATIC] = { 0x71, "invoke-static" },
[DOP_INVOKE_INTERFACE] = { 0x72, "invoke-interface" },
+ [DOP_INVOKE_VIRTUAL_RANGE] = { 0x74, "invoke-virtual/range" },
+ [DOP_INVOKE_SUPER_RANGE] = { 0x75, "invoke-static/range" },
+ [DOP_INVOKE_DIRECT_RANGE] = { 0x76, "invoke-direct/range" },
+ [DOP_INVOKE_STATIC_RANGE] = { 0x77, "invoke-static/range" },
+ [DOP_INVOKE_INTERFACE_RANGE]= { 0x78, "invoke-interface/range" },
+
+
+
[DOP_TO_INT_LONG] = { 0x81, "int-to-long" },
[DOP_TO_INT_FLOAT] = { 0x82, "int-to-float" },
[DOP_TO_INT_DOUBLE] = { 0x83, "int-to-double" },
@@ -185,6 +201,17 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_OR_INT] = { 0x96, "or-int", dalvik_decomp_instr_arithm },
[DOP_XOR_INT] = { 0x97, "xor-int", dalvik_decomp_instr_arithm },
[DOP_SHL_INT] = { 0x98, "shl-int" },
+ [DOP_SHR_INT] = { 0x99, "shr-int" },
+ [DOP_USHR_INT] = { 0x9a, "ushr-int" },
+
+
+ [DOP_MUL_LONG] = { 0x9d, "mul-long" },
+ [DOP_DIV_LONG] = { 0x9e, "div-long" },
+
+
+ [DOP_SHL_LONG] = { 0xa3, "shl-long" },
+ [DOP_SHR_LONG] = { 0xa4, "shr-long" },
+ [DOP_USHR_LONG] = { 0xa5, "ushr-long" },
[DOP_ADD_INT_2ADDR] = { 0xb0, "add-int/2addr", dalvik_decomp_instr_arithm_2addr },
@@ -197,6 +224,13 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_OR_INT_2ADDR] = { 0xb6, "or-int/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_XOR_INT_2ADDR] = { 0xb7, "xor-int/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_SHL_INT_2ADDR] = { 0xb8, "shl-int/2addr" },
+ [DOP_SHR_INT_2ADDR] = { 0xb9, "shr-int/2addr" },
+ [DOP_USHR_INT_2ADDR] = { 0xba, "ushr-int/2addr" },
+ [DOP_ADD_LONG_2ADDR] = { 0xbb, "add-long/2addr" },
+
+ [DOP_SHL_LONG_2ADDR] = { 0xc3, "shl-long/2addr" },
+ [DOP_SHR_LONG_2ADDR] = { 0xc4, "shr-long/2addr" },
+ [DOP_USHR_LONG_2ADDR] = { 0xc5, "ushr-long/2addr" },
[DOP_MUL_DOUBLE_2ADDR] = { 0xcd, "mul-double/2addr", dalvik_decomp_instr_arithm_2addr },
@@ -216,7 +250,9 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_AND_INT_LIT8] = { 0xdd, "and-int/lit8", dalvik_decomp_instr_arithm_lit },
[DOP_OR_INT_LIT8] = { 0xde, "or-int/lit8", dalvik_decomp_instr_arithm_lit },
[DOP_XOR_INT_LIT8] = { 0xdf, "xor-int/lit8", dalvik_decomp_instr_arithm_lit },
- [DOP_SHL_INT_LIT8] = { 0xe0, "shl-int/lit8" }
+ [DOP_SHL_INT_LIT8] = { 0xe0, "shl-int/lit8" },
+ [DOP_SHR_INT_LIT8] = { 0xe1, "shr-int/lit8" },
+ [DOP_USHR_INT_LIT8] = { 0xe2, "ushr-int/lit8" }
};
diff --git a/src/arch/dalvik/opcodes/Makefile.am b/src/arch/dalvik/opcodes/Makefile.am
index 908bbe8..5e2432a 100644
--- a/src/arch/dalvik/opcodes/Makefile.am
+++ b/src/arch/dalvik/opcodes/Makefile.am
@@ -27,9 +27,12 @@ libarchdalvikopcodes_la_SOURCES = \
rsub.c \
sget.c \
shl.c \
+ shr.c \
sput.c \
sub.c \
+ switch.c \
to.c \
+ ushr.c \
xor.c
libarchdalvikopcodes_la_LIBADD =
diff --git a/src/arch/dalvik/opcodes/add.c b/src/arch/dalvik/opcodes/add.c
index 8f99f56..93320de 100644
--- a/src/arch/dalvik/opcodes/add.c
+++ b/src/arch/dalvik/opcodes/add.c
@@ -171,3 +171,39 @@ GArchInstruction *dalvik_read_instr_add_int_lit16(const bin_t *data, off_t *pos,
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'add-long/2addr'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_add_long_2addr(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_ADD_LONG_2ADDR);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_12X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/const.c b/src/arch/dalvik/opcodes/const.c
index 9d9fa28..2f2d911 100644
--- a/src/arch/dalvik/opcodes/const.c
+++ b/src/arch/dalvik/opcodes/const.c
@@ -145,6 +145,42 @@ GArchInstruction *dalvik_read_instr_const_4(const bin_t *data, off_t *pos, off_t
* addr = adresse virtuelle de l'instruction. *
* proc = architecture ciblée par le désassemblage. *
* *
+* Description : Décode une instruction de type 'const-class'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_const_class(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_CONST_CLASS);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_21C | DALVIK_OP_POOL(DPT_TYPE)))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
* Description : Décode une instruction de type 'const/high16'. *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -217,6 +253,42 @@ GArchInstruction *dalvik_read_instr_const_string(const bin_t *data, off_t *pos,
* addr = adresse virtuelle de l'instruction. *
* proc = architecture ciblée par le désassemblage. *
* *
+* Description : Décode une instruction de type 'const-string/jumbo'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_const_string_jumbo(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_CONST_STRING_JUMBO);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_31C | DALVIK_OP_POOL(DPT_STRING)))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
* Description : Décode une instruction de type 'const-wide'. *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -236,7 +308,6 @@ GArchInstruction *dalvik_read_instr_const_wide(const bin_t *data, off_t *pos, of
if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_51L))
{
- printf("Errrrrrrro ------- with const-wide\n");
g_object_unref(G_OBJECT(result));
return NULL;
}
@@ -280,3 +351,75 @@ GArchInstruction *dalvik_read_instr_const_wide_16(const bin_t *data, off_t *pos,
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'const-wide/32'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_const_wide_32(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_CONST_WIDE_32);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_31I))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'const-wide/high16'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_const_wide_high16(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_CONST_WIDE_HIGH16);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_21H))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/div.c b/src/arch/dalvik/opcodes/div.c
index 49dc844..a25e465 100644
--- a/src/arch/dalvik/opcodes/div.c
+++ b/src/arch/dalvik/opcodes/div.c
@@ -171,3 +171,39 @@ GArchInstruction *dalvik_read_instr_div_int_lit16(const bin_t *data, off_t *pos,
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'div-long'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_div_long(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_DIV_LONG);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_23X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/invoke.c b/src/arch/dalvik/opcodes/invoke.c
index ee8985a..4789ab6 100644
--- a/src/arch/dalvik/opcodes/invoke.c
+++ b/src/arch/dalvik/opcodes/invoke.c
@@ -73,6 +73,42 @@ GArchInstruction *dalvik_read_instr_invoke_direct(const bin_t *data, off_t *pos,
* addr = adresse virtuelle de l'instruction. *
* proc = architecture ciblée par le désassemblage. *
* *
+* Description : Décode une instruction de type 'invoke-direct/range'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_invoke_direct_range(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_INVOKE_DIRECT_RANGE);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_3RC | DALVIK_OP_POOL(DPT_METHOD)))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
* Description : Décode une instruction de type 'invoke-interface'. *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -109,6 +145,42 @@ GArchInstruction *dalvik_read_instr_invoke_interface(const bin_t *data, off_t *p
* addr = adresse virtuelle de l'instruction. *
* proc = architecture ciblée par le désassemblage. *
* *
+* Description : Décode une instruction de type 'invoke-interface/range'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_invoke_interface_range(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_INVOKE_INTERFACE_RANGE);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_3RC | DALVIK_OP_POOL(DPT_METHOD)))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
* Description : Décode une instruction de type 'invoke-static'. *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -145,6 +217,42 @@ GArchInstruction *dalvik_read_instr_invoke_static(const bin_t *data, off_t *pos,
* addr = adresse virtuelle de l'instruction. *
* proc = architecture ciblée par le désassemblage. *
* *
+* Description : Décode une instruction de type 'invoke-static/range'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_invoke_static_range(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_INVOKE_STATIC_RANGE);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_3RC | DALVIK_OP_POOL(DPT_METHOD)))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
* Description : Décode une instruction de type 'invoke-super'. *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -181,6 +289,42 @@ GArchInstruction *dalvik_read_instr_invoke_super(const bin_t *data, off_t *pos,
* addr = adresse virtuelle de l'instruction. *
* proc = architecture ciblée par le désassemblage. *
* *
+* Description : Décode une instruction de type 'invoke-super/range'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_invoke_super_range(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_INVOKE_SUPER_RANGE);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_3RC | DALVIK_OP_POOL(DPT_METHOD)))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
* Description : Décode une instruction de type 'invoke-virtual'. *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -207,3 +351,39 @@ GArchInstruction *dalvik_read_instr_invoke_virtual(const bin_t *data, off_t *pos
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'invoke-virtual/range'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_invoke_virtual_range(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_INVOKE_VIRTUAL_RANGE);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_3RC | DALVIK_OP_POOL(DPT_METHOD)))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/move.c b/src/arch/dalvik/opcodes/move.c
index 839d551..6a86e1f 100644
--- a/src/arch/dalvik/opcodes/move.c
+++ b/src/arch/dalvik/opcodes/move.c
@@ -181,6 +181,42 @@ GArchInstruction *dalvik_read_instr_move_object(const bin_t *data, off_t *pos, o
* addr = adresse virtuelle de l'instruction. *
* proc = architecture ciblée par le désassemblage. *
* *
+* Description : Décode une instruction de type 'move-object/from16'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_move_object_from_16(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_MOVE_OBJECT_FROM_16);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_22X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
* Description : Décode une instruction de type 'move-result'. *
* *
* Retour : Instruction mise en place ou NULL. *
@@ -279,3 +315,39 @@ GArchInstruction *dalvik_read_instr_move_result_wide(const bin_t *data, off_t *p
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'move-wide/from16'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_move_wide_from_16(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_MOVE_WIDE_FROM_16);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_22X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/mul.c b/src/arch/dalvik/opcodes/mul.c
index fb26234..80f32b0 100644
--- a/src/arch/dalvik/opcodes/mul.c
+++ b/src/arch/dalvik/opcodes/mul.c
@@ -207,3 +207,39 @@ GArchInstruction *dalvik_read_instr_mul_int_lit16(const bin_t *data, off_t *pos,
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'mul-long'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_mul_long(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_MUL_LONG);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_23X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/opcodes.h b/src/arch/dalvik/opcodes/opcodes.h
index 947fea5..7e7e29e 100644
--- a/src/arch/dalvik/opcodes/opcodes.h
+++ b/src/arch/dalvik/opcodes/opcodes.h
@@ -47,6 +47,8 @@ GArchInstruction *dalvik_read_instr_add_int_lit8(const bin_t *, off_t *, off_t,
/* Décode une instruction de type 'add-int/lit16'. */
GArchInstruction *dalvik_read_instr_add_int_lit16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'add-long/2addr'. */
+GArchInstruction *dalvik_read_instr_add_long_2addr(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
/* Décode une instruction de type 'aget'. */
@@ -150,24 +152,30 @@ GArchInstruction *dalvik_read_instr_const_16(const bin_t *, off_t *, off_t, vmpa
/* Décode une instruction de type 'const/4'. */
GArchInstruction *dalvik_read_instr_const_4(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
-
-
+/* Décode une instruction de type 'const-class'. */
+GArchInstruction *dalvik_read_instr_const_class(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
/* Décode une instruction de type 'const/high16'. */
GArchInstruction *dalvik_read_instr_const_high16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
-
-
-
/* Décode une instruction de type 'const-string'. */
GArchInstruction *dalvik_read_instr_const_string(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'const-string/jumbo'. */
+GArchInstruction *dalvik_read_instr_const_string_jumbo(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'const-wide'. */
GArchInstruction *dalvik_read_instr_const_wide(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
/* Décode une instruction de type 'const-wide/16'. */
GArchInstruction *dalvik_read_instr_const_wide_16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'const-wide/32'. */
+GArchInstruction *dalvik_read_instr_const_wide_32(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'const-wide/high16'. */
+GArchInstruction *dalvik_read_instr_const_wide_high16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'div-int'. */
@@ -182,6 +190,9 @@ GArchInstruction *dalvik_read_instr_div_int_lit8(const bin_t *, off_t *, off_t,
/* Décode une instruction de type 'div-int/lit16'. */
GArchInstruction *dalvik_read_instr_div_int_lit16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'div-long'. */
+GArchInstruction *dalvik_read_instr_div_long(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'fill-array-data'. */
GArchInstruction *dalvik_read_instr_fill_array_data(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
@@ -265,18 +276,33 @@ GArchInstruction *dalvik_read_instr_iget_wide(const bin_t *, off_t *, off_t, vmp
/* Décode une instruction de type 'invoke-direct'. */
GArchInstruction *dalvik_read_instr_invoke_direct(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'invoke-direct/range'. */
+GArchInstruction *dalvik_read_instr_invoke_direct_range(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'invoke-interface'. */
GArchInstruction *dalvik_read_instr_invoke_interface(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'invoke-interface/range'. */
+GArchInstruction *dalvik_read_instr_invoke_interface_range(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'invoke-static'. */
GArchInstruction *dalvik_read_instr_invoke_static(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'invoke-static/range'. */
+GArchInstruction *dalvik_read_instr_invoke_static_range(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'invoke-super'. */
GArchInstruction *dalvik_read_instr_invoke_super(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'invoke-super/range'. */
+GArchInstruction *dalvik_read_instr_invoke_super_range(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'invoke-virtual'. */
GArchInstruction *dalvik_read_instr_invoke_virtual(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'invoke-virtual/range'. */
+GArchInstruction *dalvik_read_instr_invoke_virtual_range(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
@@ -317,6 +343,9 @@ GArchInstruction *dalvik_read_instr_move_from_16(const bin_t *, off_t *, off_t,
/* Décode une instruction de type 'move-object'. */
GArchInstruction *dalvik_read_instr_move_object(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'move-object/from16'. */
+GArchInstruction *dalvik_read_instr_move_object_from_16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'move-result'. */
GArchInstruction *dalvik_read_instr_move_result(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
@@ -326,6 +355,9 @@ GArchInstruction *dalvik_read_instr_move_result_object(const bin_t *, off_t *, o
/* Décode une instruction de type 'move-result-wide'. */
GArchInstruction *dalvik_read_instr_move_result_wide(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'move-wide/from16'. */
+GArchInstruction *dalvik_read_instr_move_wide_from_16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'mul-double/2addr'. */
GArchInstruction *dalvik_read_instr_mul_double_2addr(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
@@ -342,6 +374,9 @@ GArchInstruction *dalvik_read_instr_mul_int_lit8(const bin_t *, off_t *, off_t,
/* Décode une instruction de type 'mul-int/lit16'. */
GArchInstruction *dalvik_read_instr_mul_int_lit16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'mul-long'. */
+GArchInstruction *dalvik_read_instr_mul_long(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'new-array'. */
@@ -369,6 +404,9 @@ GArchInstruction *dalvik_read_instr_or_int_lit8(const bin_t *, off_t *, off_t, v
GArchInstruction *dalvik_read_instr_or_int_lit16(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'packed-switch'. */
+GArchInstruction *dalvik_read_instr_packed_switch(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'rem-int'. */
GArchInstruction *dalvik_read_instr_rem_int(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
@@ -429,6 +467,7 @@ GArchInstruction *dalvik_read_instr_sget_short(const bin_t *, off_t *, off_t, vm
/* Décode une instruction de type 'sget-wide'. */
GArchInstruction *dalvik_read_instr_sget_wide(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
/* Décode une instruction de type 'shl-int'. */
GArchInstruction *dalvik_read_instr_shl_int(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
@@ -438,6 +477,34 @@ GArchInstruction *dalvik_read_instr_shl_int_2addr(const bin_t *, off_t *, off_t,
/* Décode une instruction de type 'shl-int/lit8'. */
GArchInstruction *dalvik_read_instr_shl_int_lit8(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+/* Décode une instruction de type 'shl-long'. */
+GArchInstruction *dalvik_read_instr_shl_long(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'shl-long/2addr'. */
+GArchInstruction *dalvik_read_instr_shl_long_2addr(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'shr-int'. */
+GArchInstruction *dalvik_read_instr_shr_int(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'shr-int/2addr'. */
+GArchInstruction *dalvik_read_instr_shr_int_2addr(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'shr-int/lit8'. */
+GArchInstruction *dalvik_read_instr_shr_int_lit8(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'shr-long'. */
+GArchInstruction *dalvik_read_instr_shr_long(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'shr-long/2addr'. */
+GArchInstruction *dalvik_read_instr_shr_long_2addr(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+
+
+/* Décode une instruction de type 'sparse-switch'. */
+GArchInstruction *dalvik_read_instr_sparse_switch(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+
+
/* Décode une instruction de type 'sput'. */
GArchInstruction *dalvik_read_instr_sput(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
@@ -514,6 +581,27 @@ GArchInstruction *dalvik_read_instr_to_long_int(const bin_t *, off_t *, off_t, v
+/* Décode une instruction de type 'ushr-int'. */
+GArchInstruction *dalvik_read_instr_ushr_int(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'ushr-int/2addr'. */
+GArchInstruction *dalvik_read_instr_ushr_int_2addr(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'ushr-int/lit8'. */
+GArchInstruction *dalvik_read_instr_ushr_int_lit8(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'ushr-long'. */
+GArchInstruction *dalvik_read_instr_ushr_long(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+/* Décode une instruction de type 'ushr-long/2addr'. */
+GArchInstruction *dalvik_read_instr_ushr_long_2addr(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
+
+
+
+
+
+
+
/* Décode une instruction de type 'xor-int'. */
GArchInstruction *dalvik_read_instr_xor_int(const bin_t *, off_t *, off_t, vmpa_t, const GDalvikProcessor *);
diff --git a/src/arch/dalvik/opcodes/shl.c b/src/arch/dalvik/opcodes/shl.c
index f5ae00d..6a73840 100644
--- a/src/arch/dalvik/opcodes/shl.c
+++ b/src/arch/dalvik/opcodes/shl.c
@@ -1,6 +1,6 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
- * shl.c - décodage des opérations de OU exclusifs et logiques
+ * shl.c - décodage des opérations de décalage à gauche
*
* Copyright (C) 2010 Cyrille Bagard
*
@@ -135,3 +135,75 @@ GArchInstruction *dalvik_read_instr_shl_int_lit8(const bin_t *data, off_t *pos,
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'shl-long'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_shl_long(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_SHL_LONG);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_23X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'shl-long/2addr'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_shl_long_2addr(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_SHL_LONG_2ADDR);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_12X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/shr.c b/src/arch/dalvik/opcodes/shr.c
new file mode 100644
index 0000000..966bf21
--- /dev/null
+++ b/src/arch/dalvik/opcodes/shr.c
@@ -0,0 +1,209 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * shr.c - décodage des opérations de décalage à droite signé
+ *
+ * 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 "opcodes.h"
+
+
+#include "../instruction.h"
+#include "../operand.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'shr-int'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_shr_int(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_SHR_INT);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_23X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'shr-int/2addr'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_shr_int_2addr(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_SHR_INT_2ADDR);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_12X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'shr-int/lit8'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_shr_int_lit8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_SHR_INT_LIT8);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_22B))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'shr-long'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_shr_long(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_SHR_LONG);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_23X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'shr-long/2addr'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_shr_long_2addr(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_SHR_LONG_2ADDR);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_12X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/switch.c b/src/arch/dalvik/opcodes/switch.c
new file mode 100644
index 0000000..489107e
--- /dev/null
+++ b/src/arch/dalvik/opcodes/switch.c
@@ -0,0 +1,101 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * array.c - décodage de l'opération récupérant la longueur d'un tableau
+ *
+ * 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 "opcodes.h"
+
+
+#include "../instruction.h"
+#include "../operand.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'packed-switch'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_packed_switch(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_PACKED_SWITCH);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_31T))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'sparse-switch'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_sparse_switch(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_SPARSE_SWITCH);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_31T))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/opcodes/ushr.c b/src/arch/dalvik/opcodes/ushr.c
new file mode 100644
index 0000000..1461b2e
--- /dev/null
+++ b/src/arch/dalvik/opcodes/ushr.c
@@ -0,0 +1,209 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * ushr.c - décodage des opérations de décalage à droite non signé
+ *
+ * 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 "opcodes.h"
+
+
+#include "../instruction.h"
+#include "../operand.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'ushr-int'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_ushr_int(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_USHR_INT);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_23X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'ushr-int/2addr'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_ushr_int_2addr(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_USHR_INT_2ADDR);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_12X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'ushr-int/lit8'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_ushr_int_lit8(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_USHR_INT_LIT8);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_22B))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'ushr-long'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_ushr_long(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_USHR_LONG);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_23X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* addr = adresse virtuelle de l'instruction. *
+* proc = architecture ciblée par le désassemblage. *
+* *
+* Description : Décode une instruction de type 'ushr-long/2addr'. *
+* *
+* Retour : Instruction mise en place ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *dalvik_read_instr_ushr_long_2addr(const bin_t *data, off_t *pos, off_t len, vmpa_t addr, const GDalvikProcessor *proc)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ SourceEndian endian; /* Boutisme lié au binaire */
+
+ result = g_dalvik_instruction_new(DOP_USHR_LONG_2ADDR);
+
+ endian = g_arch_processor_get_endianness(G_ARCH_PROCESSOR(proc));
+
+ if (!dalvik_read_operands(result, data, pos, len, endian, DALVIK_OPT_12X))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+ return result;
+
+}
diff --git a/src/arch/dalvik/operand.c b/src/arch/dalvik/operand.c
index 7c245d8..33fcf44 100644
--- a/src/arch/dalvik/operand.c
+++ b/src/arch/dalvik/operand.c
@@ -46,6 +46,7 @@ typedef enum _DalvikOperandID
DOI_IMMEDIATE_H16,
DOI_POOL_CONST,
+ DOI_POOL_CONST_WIDE,
DOI_TARGET_8,
DOI_TARGET_16,
@@ -60,6 +61,9 @@ static bool dalvik_read_basic_operands(GArchInstruction *, const bin_t *, off_t
/* Procède à la lecture d'opérandes pour une instruction. */
static bool dalvik_read_fixed_operands(GArchInstruction *, const bin_t *, off_t *, off_t, bool *, SourceEndian, DalvikOperandType);
+/* Procède à la lecture d'opérandes pour une instruction. */
+static bool dalvik_read_variatic_operands(GArchInstruction *, const bin_t *, off_t *, off_t, bool *, SourceEndian, DalvikOperandType);
+
/******************************************************************************
@@ -224,6 +228,14 @@ static bool dalvik_read_basic_operands(GArchInstruction *instr, const bin_t *dat
};
break;
+ case DALVIK_OPT_31C:
+ types = (DalvikOperandID []) {
+ DOI_REGISTER_8,
+ DOI_POOL_CONST_WIDE,
+ DOI_INVALID
+ };
+ break;
+
case DALVIK_OPT_31I:
types = (DalvikOperandID []) {
DOI_REGISTER_8,
@@ -304,6 +316,10 @@ static bool dalvik_read_basic_operands(GArchInstruction *instr, const bin_t *dat
op = g_dalvik_pool_operand_new(DALVIK_OP_GET_POOL(model), data, pos, len, MDS_16_BITS, endian);
break;
+ case DOI_POOL_CONST_WIDE:
+ op = g_dalvik_pool_operand_new(DALVIK_OP_GET_POOL(model), data, pos, len, MDS_32_BITS, endian);
+ break;
+
case DOI_TARGET_8:
op = g_dalvik_target_operand_new(data, pos, len, MDS_8_BITS_SIGNED, endian, va_arg(ap, vmpa_t));
break;
@@ -429,6 +445,76 @@ static bool dalvik_read_fixed_operands(GArchInstruction *instr, const bin_t *dat
}
+/******************************************************************************
+* *
+* Paramètres : instr = instruction dont la définition est incomplète. [OUT]*
+* data = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
+* len = taille totale des données à analyser. *
+* low = position éventuelle des 4 bits visés. [OUT] *
+* endian = boutisme lié au binaire accompagnant. *
+* model = type d'opérandes attendues. *
+* *
+* Description : Procède à la lecture d'opérandes pour une instruction. *
+* *
+* Retour : Bilan de l'opération : true en cas de succès, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool dalvik_read_variatic_operands(GArchInstruction *instr, const bin_t *data, off_t *pos, off_t len, bool *low, SourceEndian endian, DalvikOperandType model)
+{
+ uint8_t a; /* Nbre. de registres utilisés */
+ uint16_t b; /* Indice dans la table const. */
+ GArchOperand *target; /* Opérande visant la table */
+ GArchOperand *args; /* Liste des opérandes */
+ uint8_t i; /* Boucle de parcours */
+ uint16_t c; /* Indice de registre */
+ GArchOperand *op; /* Opérande unique décodé */
+
+ if (!read_u8(&a, data, pos, len, endian))
+ return false;
+
+ if (!read_u16(&b, data, pos, len, endian))
+ return false;
+
+ target = g_dalvik_pool_operand_new(DALVIK_OP_GET_POOL(model), data, pos, len, MDS_16_BITS, endian);
+ if (target == NULL) return false;
+
+ /* Mise en place des arguments */
+
+ args = g_dalvik_args_operand_new();
+ g_arch_instruction_attach_extra_operand(instr, args);
+
+ for (i = 0; i < a; i++)
+ {
+ if (i == 0 && !read_u16(&c, data, pos, len, endian))
+ goto drvo_registers;
+
+ op = g_dalvik_register_operand_new_from_existing(g_dalvik_register_new(c + i));
+ if (op == NULL) goto drvo_registers;
+
+ g_dalvik_args_operand_add(G_DALVIK_ARGS_OPERAND(args), op);
+
+ }
+
+ /* Rajout de la cible */
+
+ g_arch_instruction_attach_extra_operand(instr, target);
+
+ return true;
+
+ drvo_registers:
+
+ g_object_unref(G_OBJECT(args));
+
+ g_object_unref(G_OBJECT(target));
+
+ return false;
+
+}
+
@@ -498,6 +584,7 @@ bool dalvik_read_operands(GArchInstruction *instr, const bin_t *data, off_t *pos
case DALVIK_OPT_22X:
case DALVIK_OPT_23X:
case DALVIK_OPT_30T:
+ case DALVIK_OPT_31C:
case DALVIK_OPT_31I:
case DALVIK_OPT_31T:
case DALVIK_OPT_51L:
@@ -510,6 +597,12 @@ bool dalvik_read_operands(GArchInstruction *instr, const bin_t *data, off_t *pos
result = dalvik_read_fixed_operands(instr, data, pos, len, &low, endian, model);
break;
+ case DALVIK_OPT_3RC:
+ case DALVIK_OPT_3RMS:
+ case DALVIK_OPT_3RFS:
+ result = dalvik_read_variatic_operands(instr, data, pos, len, &low, endian, model);
+ break;
+
default:
break;
diff --git a/src/arch/dalvik/operand.h b/src/arch/dalvik/operand.h
index 636d7ec..41ce084 100644
--- a/src/arch/dalvik/operand.h
+++ b/src/arch/dalvik/operand.h
@@ -48,6 +48,7 @@
#define DALVIK_OP_REG_OFF 24
#define DALVIK_OP_REG_MASK 0x0f000000
+#define DALVIK_OP_REG_RANGE 0xf
#define DALVIK_OP_POOL_OFF 20
#define DALVIK_OP_POOL_MASK 0x00f00000
@@ -92,11 +93,16 @@ typedef enum _DalvikOperandType
DALVIK_OPT_30T = DALVIK_OP_LEN(3) | DALVIK_OP_REG(0) | 'T',
+ DALVIK_OPT_31C = DALVIK_OP_LEN(3) | DALVIK_OP_REG(1) | 'C',
DALVIK_OPT_31I = DALVIK_OP_LEN(3) | DALVIK_OP_REG(1) | 'I',
DALVIK_OPT_31T = DALVIK_OP_LEN(3) | DALVIK_OP_REG(1) | 'T',
DALVIK_OPT_35C = DALVIK_OP_LEN(3) | DALVIK_OP_REG(5) | 'C',
+ DALVIK_OPT_3RC = DALVIK_OP_LEN(3) | DALVIK_OP_REG(DALVIK_OP_REG_RANGE) | 'C',
+ DALVIK_OPT_3RMS = DALVIK_OP_LEN(3) | DALVIK_OP_REG(DALVIK_OP_REG_RANGE) | 'M',
+ DALVIK_OPT_3RFS = DALVIK_OP_LEN(3) | DALVIK_OP_REG(DALVIK_OP_REG_RANGE) | 'F',
+
DALVIK_OPT_51L = DALVIK_OP_LEN(5) | DALVIK_OP_REG(1) | 'L'
} DalvikOperandType;
diff --git a/src/arch/dalvik/operands/register.c b/src/arch/dalvik/operands/register.c
index 22c210e..b2b8db9 100644
--- a/src/arch/dalvik/operands/register.c
+++ b/src/arch/dalvik/operands/register.c
@@ -24,7 +24,6 @@
#include "register.h"
-#include "../register.h"
#include "../../operand-int.h"
@@ -173,6 +172,31 @@ GArchOperand *g_dalvik_register_operand_new(const bin_t *data, off_t *pos, off_t
/******************************************************************************
* *
+* Paramètres : reg = registre déjà en place. *
+* *
+* Description : Crée un opérande visant un registre Dalvik. *
+* *
+* Retour : Opérande mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_dalvik_register_operand_new_from_existing(GDalvikRegister *reg)
+{
+ GDalvikRegisterOperand *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_DALVIK_REGISTER_OPERAND, NULL);
+
+ result->reg = reg;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : a = premier opérande à consulter. *
* b = second opérande à consulter. *
* *
diff --git a/src/arch/dalvik/operands/register.h b/src/arch/dalvik/operands/register.h
index 00b05fb..c3510b1 100644
--- a/src/arch/dalvik/operands/register.h
+++ b/src/arch/dalvik/operands/register.h
@@ -28,6 +28,7 @@
#include <glib-object.h>
+#include "../register.h"
#include "../../operand.h"
#include "../../../common/endianness.h"
@@ -54,6 +55,9 @@ GType g_dalvik_register_operand_get_type(void);
/* Crée un opérande visant un registre Dalvik. */
GArchOperand *g_dalvik_register_operand_new(const bin_t *, off_t *, off_t, bool *, MemoryDataSize, SourceEndian);
+/* Crée un opérande visant un registre Dalvik. */
+GArchOperand *g_dalvik_register_operand_new_from_existing(GDalvikRegister *);
+
#endif /* _ARCH_DALVIK_OPERANDS_REGISTER_H */
diff --git a/src/arch/dalvik/processor.c b/src/arch/dalvik/processor.c
index fb3d875..8ee586c 100644
--- a/src/arch/dalvik/processor.c
+++ b/src/arch/dalvik/processor.c
@@ -238,7 +238,11 @@ static GArchInstruction *g_dalvik_processor_decode_instruction(const GDalvikProc
[DOP_MOVE] = dalvik_read_instr_move,
[DOP_MOVE_FROM_16] = dalvik_read_instr_move_from_16,
+
+ [DOP_MOVE_WIDE_FROM_16] = dalvik_read_instr_move_wide_from_16,
+
[DOP_MOVE_OBJECT] = dalvik_read_instr_move_object,
+ [DOP_MOVE_OBJECT_FROM_16] = dalvik_read_instr_move_object_from_16,
[DOP_MOVE_RESULT] = dalvik_read_instr_move_result,
[DOP_MOVE_RESULT_WIDE] = dalvik_read_instr_move_result_wide,
@@ -253,11 +257,12 @@ static GArchInstruction *g_dalvik_processor_decode_instruction(const GDalvikProc
[DOP_CONST] = dalvik_read_instr_const,
[DOP_CONST_HIGH16] = dalvik_read_instr_const_high16,
[DOP_CONST_WIDE_16] = dalvik_read_instr_const_wide_16,
-
+ [DOP_CONST_WIDE_32] = dalvik_read_instr_const_wide_32,
[DOP_CONST_WIDE] = dalvik_read_instr_const_wide,
-
-
+ [DOP_CONST_WIDE_HIGH16] = dalvik_read_instr_const_wide_high16,
[DOP_CONST_STRING] = dalvik_read_instr_const_string,
+ [DOP_CONST_STRING_JUMBO] = dalvik_read_instr_const_string_jumbo,
+ [DOP_CONST_CLASS] = dalvik_read_instr_const_class,
[DOP_CHECK_CAST] = dalvik_read_instr_check_cast,
@@ -270,7 +275,8 @@ static GArchInstruction *g_dalvik_processor_decode_instruction(const GDalvikProc
[DOP_GOTO] = dalvik_read_instr_goto,
[DOP_GOTO_16] = dalvik_read_instr_goto_16,
[DOP_GOTO_32] = dalvik_read_instr_goto_32,
-
+ [DOP_PACKED_SWITCH] = dalvik_read_instr_packed_switch,
+ [DOP_SPARSE_SWITCH] = dalvik_read_instr_sparse_switch,
[DOP_CMPL_FLOAT] = dalvik_read_instr_cmpl_float,
[DOP_CMPG_FLOAT] = dalvik_read_instr_cmpg_float,
[DOP_CMPL_DOUBLE] = dalvik_read_instr_cmpl_double,
@@ -339,6 +345,11 @@ static GArchInstruction *g_dalvik_processor_decode_instruction(const GDalvikProc
[DOP_INVOKE_DIRECT] = dalvik_read_instr_invoke_direct,
[DOP_INVOKE_STATIC] = dalvik_read_instr_invoke_static,
[DOP_INVOKE_INTERFACE] = dalvik_read_instr_invoke_interface,
+ [DOP_INVOKE_VIRTUAL_RANGE] = dalvik_read_instr_invoke_virtual_range,
+ [DOP_INVOKE_SUPER_RANGE] = dalvik_read_instr_invoke_super_range,
+ [DOP_INVOKE_DIRECT_RANGE] = dalvik_read_instr_invoke_direct_range,
+ [DOP_INVOKE_STATIC_RANGE] = dalvik_read_instr_invoke_static_range,
+ [DOP_INVOKE_INTERFACE_RANGE]= dalvik_read_instr_invoke_interface_range,
[DOP_TO_INT_LONG] = dalvik_read_instr_to_int_long,
@@ -365,6 +376,17 @@ static GArchInstruction *g_dalvik_processor_decode_instruction(const GDalvikProc
[DOP_OR_INT] = dalvik_read_instr_or_int,
[DOP_XOR_INT] = dalvik_read_instr_xor_int,
[DOP_SHL_INT] = dalvik_read_instr_shl_int,
+ [DOP_SHR_INT] = dalvik_read_instr_shr_int,
+ [DOP_USHR_INT] = dalvik_read_instr_ushr_int,
+
+
+ [DOP_MUL_LONG] = dalvik_read_instr_mul_long,
+ [DOP_DIV_LONG] = dalvik_read_instr_div_long,
+
+
+ [DOP_SHL_LONG] = dalvik_read_instr_shl_long,
+ [DOP_SHR_LONG] = dalvik_read_instr_shr_long,
+ [DOP_USHR_LONG] = dalvik_read_instr_ushr_long,
[DOP_ADD_INT_2ADDR] = dalvik_read_instr_add_int_2addr,
@@ -376,6 +398,13 @@ static GArchInstruction *g_dalvik_processor_decode_instruction(const GDalvikProc
[DOP_OR_INT_2ADDR] = dalvik_read_instr_or_int_2addr,
[DOP_XOR_INT_2ADDR] = dalvik_read_instr_xor_int_2addr,
[DOP_SHL_INT_2ADDR] = dalvik_read_instr_shl_int_2addr,
+ [DOP_SHR_INT_2ADDR] = dalvik_read_instr_shr_int_2addr,
+ [DOP_USHR_INT_2ADDR] = dalvik_read_instr_ushr_int_2addr,
+ [DOP_ADD_LONG_2ADDR] = dalvik_read_instr_add_long_2addr,
+
+ [DOP_SHL_LONG_2ADDR] = dalvik_read_instr_shl_long_2addr,
+ [DOP_SHR_LONG_2ADDR] = dalvik_read_instr_shr_long_2addr,
+ [DOP_USHR_LONG_2ADDR] = dalvik_read_instr_ushr_long_2addr,
[DOP_MUL_DOUBLE_2ADDR] = dalvik_read_instr_mul_double_2addr,
@@ -395,8 +424,9 @@ static GArchInstruction *g_dalvik_processor_decode_instruction(const GDalvikProc
[DOP_AND_INT_LIT8] = dalvik_read_instr_and_int_lit8,
[DOP_OR_INT_LIT8] = dalvik_read_instr_or_int_lit8,
[DOP_XOR_INT_LIT8] = dalvik_read_instr_xor_int_lit8,
- [DOP_SHL_INT_LIT8] = dalvik_read_instr_shl_int_lit8
-
+ [DOP_SHL_INT_LIT8] = dalvik_read_instr_shl_int_lit8,
+ [DOP_SHR_INT_LIT8] = dalvik_read_instr_shr_int_lit8,
+ [DOP_USHR_INT_LIT8] = dalvik_read_instr_ushr_int_lit8
};
diff --git a/src/arch/processor.c b/src/arch/processor.c
index 0e4fc3f..f82f2d7 100644
--- a/src/arch/processor.c
+++ b/src/arch/processor.c
@@ -227,6 +227,8 @@ GArchInstruction *g_arch_processor_decode_instruction(const GArchProcessor *proc
if (result == NULL || result == SKIPPED_INSTR)
{
+ printf("BAD CODE :: 0x%02hhx @0x%08lx\n", data[*pos], addr);
+
skipped = (result == SKIPPED_INSTR);
*pos = old_pos;