summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/instruction.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-11-11 18:08:20 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-11-11 18:08:20 (GMT)
commit2e5d98e2367a90e5b258c30dc68e5981d1f63339 (patch)
treeb4ed9410b619af8f80585c27aba29d89b4543783 /src/arch/dalvik/instruction.c
parent85be5ab140bb90ca69e20323eb49999d8520af13 (diff)
Registered the remaining instructions for a full Dalvik opcodes support.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@281 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/dalvik/instruction.c')
-rw-r--r--src/arch/dalvik/instruction.c111
1 files changed, 80 insertions, 31 deletions
diff --git a/src/arch/dalvik/instruction.c b/src/arch/dalvik/instruction.c
index 416a699..a1f29bc 100644
--- a/src/arch/dalvik/instruction.c
+++ b/src/arch/dalvik/instruction.c
@@ -59,14 +59,13 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_NOP] = { 0x00, "nop", NULL },
[DOP_MOVE] = { 0x01, "move" },
[DOP_MOVE_FROM_16] = { 0x02, "move/from16" },
-
-
+ [DOP_MOVE_16] = { 0x03, "move/16" },
+ [DOP_MOVE_WIDE] = { 0x04, "move-wide" },
[DOP_MOVE_WIDE_FROM_16] = { 0x05, "move-wide/from16" },
-
-
+ [DOP_MOVE_WIDE_16] = { 0x06, "move-wide/16" },
[DOP_MOVE_OBJECT] = { 0x07, "move-object", dalvik_decomp_instr_move_object },
[DOP_MOVE_OBJECT_FROM_16] = { 0x08, "move-object/from16" },
-
+ [DOP_MOVE_OBJECT_16] = { 0x09, "move-object/16" },
[DOP_MOVE_RESULT] = { 0x0a, "move-result", dalvik_decomp_instr_move_result },
[DOP_MOVE_RESULT_WIDE] = { 0x0b, "move-result-wide", dalvik_decomp_instr_move_result },
[DOP_MOVE_RESULT_OBJECT] = { 0x0c, "move-result-object", dalvik_decomp_instr_move_result },
@@ -86,17 +85,17 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_CONST_STRING] = { 0x1a, "const-string", dalvik_decomp_instr_const_str },
[DOP_CONST_STRING_JUMBO] = { 0x1b, "const-string/jumbo" },
[DOP_CONST_CLASS] = { 0x1c, "const-class" },
-
+ [DOP_MONITOR_ENTER] = { 0x1d, "monitor-enter" },
+ [DOP_MONITOR_EXIT] = { 0x1e, "monitor-exit" },
[DOP_CHECK_CAST] = { 0x1f, "check-cast" },
-
-
+ [DOP_INSTANCE_OF] = { 0x20, "instance-of" },
[DOP_ARRAY_LENGTH] = { 0x21, "array-length", dalvik_decomp_instr_array_length },
[DOP_NEW_INSTANCE] = { 0x22, "new-instance", dalvik_decomp_instr_new_instance },
[DOP_NEW_ARRAY] = { 0x23, "new-array" },
-
-
+ [DOP_FILLED_NEW_ARRAY] = { 0x24, "fill-new-array" },
+ [DOP_FILLED_NEW_ARRAY_RANGE]= { 0x25, "fill-new-array/range" },
[DOP_FILL_ARRAY_DATA] = { 0x26, "fill-array-data" },
-
+ [DOP_THROW] = { 0x27, "throw" },
[DOP_GOTO] = { 0x28, "goto" },
[DOP_GOTO_16] = { 0x29, "goto/16" },
[DOP_GOTO_32] = { 0x2a, "goto/32" },
@@ -119,9 +118,12 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_IF_GEZ] = { 0x3b, "if-gez" },
[DOP_IF_GTZ] = { 0x3c, "if-gtz" },
[DOP_IF_LEZ] = { 0x3d, "if-lez" },
-
-
-
+ [DOP_UNUSED_3E] = { 0x3e, NULL /* unused */ },
+ [DOP_UNUSED_3F] = { 0x3f, NULL /* unused */ },
+ [DOP_UNUSED_40] = { 0x40, NULL /* unused */ },
+ [DOP_UNUSED_41] = { 0x41, NULL /* unused */ },
+ [DOP_UNUSED_42] = { 0x42, NULL /* unused */ },
+ [DOP_UNUSED_43] = { 0x43, NULL /* unused */ },
[DOP_AGET] = { 0x44, "aget" },
[DOP_AGET_WIDE] = { 0x45, "aget-wide" },
[DOP_AGET_OBJECT] = { 0x46, "aget-object" },
@@ -169,15 +171,20 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_INVOKE_DIRECT] = { 0x70, "invoke-direct", dalvik_decomp_instr_invoke_direct },
[DOP_INVOKE_STATIC] = { 0x71, "invoke-static" },
[DOP_INVOKE_INTERFACE] = { 0x72, "invoke-interface" },
-
+ [DOP_UNUSED_73] = { 0x73, NULL /* unused */ },
[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_UNUSED_79] = { 0x79, NULL /* unused */ },
+ [DOP_UNUSED_7A] = { 0x7a, NULL /* unused */ },
+ [DOP_NEG_INT] = { 0x7b, "neg-int" },
+ [DOP_NOT_INT] = { 0x7c, "not-int" },
+ [DOP_NEG_LONG] = { 0x7d, "neg-long" },
+ [DOP_NOT_LONG] = { 0x7e, "not-long" },
+ [DOP_NEG_FLOAT] = { 0x7f, "neg-float" },
+ [DOP_NEG_DOUBLE] = { 0x80, "neg-double" },
[DOP_TO_INT_LONG] = { 0x81, "int-to-long" },
[DOP_TO_INT_FLOAT] = { 0x82, "int-to-float" },
[DOP_TO_INT_DOUBLE] = { 0x83, "int-to-double" },
@@ -204,23 +211,27 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_SHL_INT] = { 0x98, "shl-int" },
[DOP_SHR_INT] = { 0x99, "shr-int" },
[DOP_USHR_INT] = { 0x9a, "ushr-int" },
-
-
[DOP_ADD_LONG] = { 0x9b, "add-long" },
[DOP_SUB_LONG] = { 0x9c, "sub-long" },
[DOP_MUL_LONG] = { 0x9d, "mul-long" },
[DOP_DIV_LONG] = { 0x9e, "div-long" },
-
-
+ [DOP_REM_LONG] = { 0x9f, "rem-long" },
+ [DOP_AND_LONG] = { 0xa0, "and-long" },
+ [DOP_OR_LONG] = { 0xa1, "or-long" },
+ [DOP_XOR_LONG] = { 0xa2, "xor-long" },
[DOP_SHL_LONG] = { 0xa3, "shl-long" },
[DOP_SHR_LONG] = { 0xa4, "shr-long" },
[DOP_USHR_LONG] = { 0xa5, "ushr-long" },
[DOP_ADD_FLOAT] = { 0xa6, "add-float" },
-
-
+ [DOP_SUB_FLOAT] = { 0xa7, "sub-float" },
+ [DOP_MUL_FLOAT] = { 0xa8, "mul-float" },
+ [DOP_DIV_FLOAT] = { 0xa9, "div-float" },
+ [DOP_REM_FLOAT] = { 0xaa, "rem-float" },
[DOP_ADD_DOUBLE] = { 0xab, "add-double" },
-
-
+ [DOP_SUB_DOUBLE] = { 0xac, "sub-double" },
+ [DOP_MUL_DOUBLE] = { 0xad, "mul-double" },
+ [DOP_DIV_DOUBLE] = { 0xae, "div-double" },
+ [DOP_REM_DOUBLE] = { 0xaf, "rem-double" },
[DOP_ADD_INT_2ADDR] = { 0xb0, "add-int/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_SUB_INT_2ADDR] = { 0xb1, "sub-int/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_MUL_INT_2ADDR] = { 0xb2, "mul-int/2addr", dalvik_decomp_instr_arithm_2addr },
@@ -235,18 +246,24 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_ADD_LONG_2ADDR] = { 0xbb, "add-long/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_SUB_LONG_2ADDR] = { 0xbc, "sub-long/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_MUL_LONG_2ADDR] = { 0xbd, "mul-long/2addr", dalvik_decomp_instr_arithm_2addr },
-
+ [DOP_DIV_LONG_2ADDR] = { 0xbe, "div-long/2addr", dalvik_decomp_instr_arithm_2addr },
+ [DOP_REM_LONG_2ADDR] = { 0xbf, "rem-long/2addr", dalvik_decomp_instr_arithm_2addr },
+ [DOP_AND_LONG_2ADDR] = { 0xc0, "and-long/2addr", dalvik_decomp_instr_arithm_2addr },
+ [DOP_OR_LONG_2ADDR] = { 0xc1, "or-long/2addr", dalvik_decomp_instr_arithm_2addr },
+ [DOP_XOR_LONG_2ADDR] = { 0xc2, "xor-long/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_SHL_LONG_2ADDR] = { 0xc3, "shl-long/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_SHR_LONG_2ADDR] = { 0xc4, "shr-long/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_USHR_LONG_2ADDR] = { 0xc5, "ushr-long/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_ADD_FLOAT_2ADDR] = { 0xc6, "add-float/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_SUB_FLOAT_2ADDR] = { 0xc7, "sub-float/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_MUL_FLOAT_2ADDR] = { 0xc8, "mul-float/2addr", dalvik_decomp_instr_arithm_2addr },
-
+ [DOP_DIV_FLOAT_2ADDR] = { 0xc9, "div-float/2addr", dalvik_decomp_instr_arithm_2addr },
+ [DOP_REM_FLOAT_2ADDR] = { 0xca, "rem-float/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_ADD_DOUBLE_2ADDR] = { 0xcb, "add-double/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_SUB_DOUBLE_2ADDR] = { 0xcc, "sub-double/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_MUL_DOUBLE_2ADDR] = { 0xcd, "mul-double/2addr", dalvik_decomp_instr_arithm_2addr },
-
+ [DOP_DIV_DOUBLE_2ADDR] = { 0xce, "div-double/2addr", dalvik_decomp_instr_arithm_2addr },
+ [DOP_REM_DOUBLE_2ADDR] = { 0xcf, "rem-double/2addr", dalvik_decomp_instr_arithm_2addr },
[DOP_ADD_INT_LIT16] = { 0xd0, "add-int/lit16", dalvik_decomp_instr_arithm_lit },
[DOP_RSUB_INT] = { 0xd1, "rsub-int" },
[DOP_MUL_INT_LIT16] = { 0xd2, "mul-int/lit16", dalvik_decomp_instr_arithm_lit },
@@ -265,8 +282,36 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_XOR_INT_LIT8] = { 0xdf, "xor-int/lit8", dalvik_decomp_instr_arithm_lit },
[DOP_SHL_INT_LIT8] = { 0xe0, "shl-int/lit8" },
[DOP_SHR_INT_LIT8] = { 0xe1, "shr-int/lit8" },
- [DOP_USHR_INT_LIT8] = { 0xe2, "ushr-int/lit8" }
-
+ [DOP_USHR_INT_LIT8] = { 0xe2, "ushr-int/lit8" },
+ [DOP_UNUSED_E3] = { 0xe3, NULL /* unused */ },
+ [DOP_UNUSED_E4] = { 0xe4, NULL /* unused */ },
+ [DOP_UNUSED_E5] = { 0xe5, NULL /* unused */ },
+ [DOP_UNUSED_E6] = { 0xe6, NULL /* unused */ },
+ [DOP_UNUSED_E7] = { 0xe7, NULL /* unused */ },
+ [DOP_UNUSED_E8] = { 0xe8, NULL /* unused */ },
+ [DOP_UNUSED_E9] = { 0xe9, NULL /* unused */ },
+ [DOP_UNUSED_EA] = { 0xea, NULL /* unused */ },
+ [DOP_UNUSED_EB] = { 0xeb, NULL /* unused */ },
+ [DOP_UNUSED_EC] = { 0xec, NULL /* unused */ },
+ [DOP_UNUSED_ED] = { 0xed, NULL /* unused */ },
+ [DOP_UNUSED_EE] = { 0xee, NULL /* unused */ },
+ [DOP_UNUSED_EF] = { 0xef, NULL /* unused */ },
+ [DOP_UNUSED_F0] = { 0xf0, NULL /* unused */ },
+ [DOP_UNUSED_F1] = { 0xf1, NULL /* unused */ },
+ [DOP_UNUSED_F2] = { 0xf2, NULL /* unused */ },
+ [DOP_UNUSED_F3] = { 0xf3, NULL /* unused */ },
+ [DOP_UNUSED_F4] = { 0xf4, NULL /* unused */ },
+ [DOP_UNUSED_F5] = { 0xf5, NULL /* unused */ },
+ [DOP_UNUSED_F6] = { 0xf6, NULL /* unused */ },
+ [DOP_UNUSED_F7] = { 0xf7, NULL /* unused */ },
+ [DOP_UNUSED_F8] = { 0xf8, NULL /* unused */ },
+ [DOP_UNUSED_F9] = { 0xf9, NULL /* unused */ },
+ [DOP_UNUSED_FA] = { 0xfa, NULL /* unused */ },
+ [DOP_UNUSED_FB] = { 0xfb, NULL /* unused */ },
+ [DOP_UNUSED_FC] = { 0xfc, NULL /* unused */ },
+ [DOP_UNUSED_FD] = { 0xfd, NULL /* unused */ },
+ [DOP_UNUSED_FE] = { 0xfe, NULL /* unused */ },
+ [DOP_UNUSED_FF] = { 0xff, NULL /* unused */ }
};
@@ -412,6 +457,10 @@ DalvikOpcodes dalvik_guess_next_instruction(const bin_t *data, off_t pos, off_t
}
+ /* Si l'instruction est marquée comme non utilisée... */
+ if (_instructions[result].keyword == NULL)
+ result = DOP_COUNT;
+
return result;
}