summaryrefslogtreecommitdiff
path: root/plugins/dalvik
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-05-14 15:52:32 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-05-14 15:52:32 (GMT)
commit6178efcee9fc18d11a773827dca8b95304e75731 (patch)
tree77c664dfac355b7af803d33b1afded7925647b6d /plugins/dalvik
parentaba51093c8ebe4b0550557281f8d0d025027b1cb (diff)
Used unique identifiers for instructions everywhere.
Diffstat (limited to 'plugins/dalvik')
-rw-r--r--plugins/dalvik/v35/instruction.c49
-rw-r--r--plugins/dalvik/v35/opdefs/Makefile.am11
2 files changed, 53 insertions, 7 deletions
diff --git a/plugins/dalvik/v35/instruction.c b/plugins/dalvik/v35/instruction.c
index 437cae8..1966690 100644
--- a/plugins/dalvik/v35/instruction.c
+++ b/plugins/dalvik/v35/instruction.c
@@ -28,6 +28,7 @@
#include "opcodes/descriptions.h"
+#include "opcodes/hooks.h"
#include "opcodes/keywords.h"
#include "../instruction-int.h"
@@ -66,6 +67,9 @@ static const char *g_dalvik35_instruction_get_encoding(const GDalvik35Instructio
/* Fournit le nom humain de l'instruction manipulée. */
static const char *g_dalvik35_instruction_get_keyword(const GDalvik35Instruction *, AsmSyntax);
+/* Complète un désassemblage accompli pour une instruction. */
+static void g_dalvik35_instruction_call_hook(GDalvik35Instruction *, InstrProcessHook, GArchProcessor *, GProcContext *, GExeFormat *);
+
/* Fournit une description pour l'instruction manipulée. */
static const char *g_dalvik35_instruction_get_description(const GDalvik35Instruction *);
@@ -101,6 +105,7 @@ static void g_dalvik35_instruction_class_init(GDalvik35InstructionClass *klass)
instr->get_encoding = (get_instruction_encoding_fc)g_dalvik35_instruction_get_encoding;
instr->get_keyword = (get_instruction_keyword_fc)g_dalvik35_instruction_get_keyword;
+ instr->call_hook = (call_instruction_hook_fc)g_dalvik35_instruction_call_hook;
instr->get_desc = (get_instruction_desc_fc)g_dalvik35_instruction_get_description;
}
@@ -164,7 +169,7 @@ static void g_dalvik35_instruction_finalize(GDalvik35Instruction *instr)
/******************************************************************************
* *
-* Paramètres : keyword = définition du nom humaine de l'instruction. *
+* Paramètres : uid = identifiant unique attribué à l'instruction. *
* *
* Description : Crée une instruction pour l'architecture Dalvik v35. *
* *
@@ -176,13 +181,13 @@ static void g_dalvik35_instruction_finalize(GDalvik35Instruction *instr)
GArchInstruction *g_dalvik35_instruction_new(itid_t uid)
{
- GArchInstruction *result; /* Structure à retourner */
+ GDalvik35Instruction *result; /* Structure à retourner */
result = g_object_new(G_TYPE_DALVIK35_INSTRUCTION, NULL);
G_ARCH_INSTRUCTION(result)->uid = uid;
- return result;
+ return G_ARCH_INSTRUCTION(result);
}
@@ -241,6 +246,44 @@ static const char *g_dalvik35_instruction_get_keyword(const GDalvik35Instruction
/******************************************************************************
* *
+* Paramètres : instr = instruction quelconque à traiter. *
+* type = type de procédure à utiliser. *
+* proc = représentation de l'architecture utilisée. *
+* context = contexte associé à la phase de désassemblage. *
+* format = accès aux données du binaire d'origine. *
+* *
+* Description : Complète un désassemblage accompli pour une instruction. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dalvik35_instruction_call_hook(GDalvik35Instruction *instr, InstrProcessHook type, GArchProcessor *proc, GProcContext *context, GExeFormat *format)
+{
+ GArchInstruction *base; /* Version de base d'instance */
+ itid_t uid; /* Accès simplifié */
+ instr_hook_fc hook; /* Décrochage à appeler */
+
+ assert(type < IPH_COUNT);
+
+ base = G_ARCH_INSTRUCTION(instr);
+
+ uid = base->uid;
+
+ assert(uid < DOP35_COUNT);
+
+ hook = _dalvik35_hooks[uid][type];
+
+ if (hook != NULL)
+ hook(base, proc, context, format);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : instr = instruction d'assemblage à consulter. *
* *
* Description : Fournit une description pour l'instruction manipulée. *
diff --git a/plugins/dalvik/v35/opdefs/Makefile.am b/plugins/dalvik/v35/opdefs/Makefile.am
index f660e3d..0684c53 100644
--- a/plugins/dalvik/v35/opdefs/Makefile.am
+++ b/plugins/dalvik/v35/opdefs/Makefile.am
@@ -26,12 +26,10 @@ D2C_SPECIFIC = --op-prefix=DALVIK_OPT_
FIXED_C_INCLUDES = \
\#include <stdint.h> \
\n \
+ \n\#include "identifiers.h" \
\n\#include "../instruction.h" \
\n\#include "../operand.h" \
- \n\#include "../../fetch.h" \
- \n\#include "../../helpers.h" \
- \n\#include "../../link.h" \
- \n\#include "../../post.h"
+ \n\#include "../../helpers.h"
FIXED_H_INCLUDES = \
\#include <stdint.h> \
@@ -42,6 +40,11 @@ FIXED_H_INCLUDES = \
\n \
\n\#include "../processor.h"
+FIXED_H_HOOKS_INCLUDES = \
+ \#include "../../fetch.h" \
+ \n\#include "../../link.h" \
+ \n\#include "../../post.h"
+
# for (( i = 0; i < 256; i++)); do def=$(ls `printf "*_%02x.d" $i` 2> /dev/null); test -z "$def" || echo -e "\t$def\t\t\t\t\t\t\t\\" ; done
DALVIK_DEFS = \