diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-04-02 11:58:42 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-04-02 12:39:30 (GMT) |
commit | 1db4ef323b7a76093356ae76268132f3760e1631 (patch) | |
tree | fec36ee0ec1b6b2010b62ca4177edca0e31e2114 /plugins/dalvik/pseudo/switch.c | |
parent | 1bc80837dde03a32b5ab185067f7bd4c499a9850 (diff) |
Rewritten the whole instruction definition format.
Diffstat (limited to 'plugins/dalvik/pseudo/switch.c')
-rw-r--r-- | plugins/dalvik/pseudo/switch.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/plugins/dalvik/pseudo/switch.c b/plugins/dalvik/pseudo/switch.c index 90cff87..d6d255c 100644 --- a/plugins/dalvik/pseudo/switch.c +++ b/plugins/dalvik/pseudo/switch.c @@ -28,6 +28,7 @@ #include <malloc.h> +#include "identifiers.h" #include "../instruction-int.h" @@ -68,6 +69,9 @@ static void g_dalvik_switch_instr_finalize(GDalvikSwitchInstr *); /* Lit toutes les valeurs associés aux branchements. */ static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *, const GBinContent *, const vmpa2t *); +/* Fournit le nom humain de l'instruction manipulée. */ +static const char *g_dalvik_switch_instruction_get_keyword(const GDalvikSwitchInstr *, AsmSyntax); + /* Indique le type défini pour une pseudo-instruction Dalvik de remplissage. */ @@ -89,12 +93,17 @@ G_DEFINE_TYPE(GDalvikSwitchInstr, g_dalvik_switch_instr, G_TYPE_DALVIK_INSTRUCTI static void g_dalvik_switch_instr_class_init(GDalvikSwitchInstrClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GArchInstructionClass *instr; /* Encore une autre vision... */ object = G_OBJECT_CLASS(klass); object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_switch_instr_dispose; object->finalize = (GObjectFinalizeFunc)g_dalvik_switch_instr_finalize; + instr = G_ARCH_INSTRUCTION_CLASS(klass); + + instr->get_keyword = (get_instruction_keyword_fc)g_dalvik_switch_instruction_get_keyword; + } @@ -112,7 +121,6 @@ static void g_dalvik_switch_instr_class_init(GDalvikSwitchInstrClass *klass) static void g_dalvik_switch_instr_init(GDalvikSwitchInstr *instr) { - G_DALVIK_INSTRUCTION(instr)->keyword = "switch-data"; } @@ -185,7 +193,7 @@ GArchInstruction *g_dalvik_switch_instr_new(uint16_t ident, GDalvikContext *ctx, result = g_object_new(G_TYPE_DALVIK_SWITCH_INSTR, NULL); - G_DALVIK_INSTRUCTION(result)->ptype = ident; + G_ARCH_INSTRUCTION(result)->uid = ident; if (!g_binary_content_read_u16(content, pos, SRE_LITTLE, &result->switch_size)) goto gdsin_bad; @@ -237,7 +245,7 @@ static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *instr, const GBinCon copy_vmpa(&iter, pos); - if (G_DALVIK_INSTRUCTION(instr)->ptype == DPO_PACKED_SWITCH) + if (G_ARCH_INSTRUCTION(instr)->uid == DPO_PACKED_SWITCH) { if (!g_binary_content_read_s32(content, &iter, SRE_LITTLE, &first_key)) goto gdsdd_bad; @@ -276,6 +284,30 @@ static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *instr, const GBinCon /****************************************************************************** * * +* Paramètres : instr = instruction d'assemblage à consulter. * +* syntax = type de représentation demandée. * +* * +* Description : Fournit le nom humain de l'instruction manipulée. * +* * +* Retour : Mot clef de bas niveau. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static const char *g_dalvik_switch_instruction_get_keyword(const GDalvikSwitchInstr *instr, AsmSyntax syntax) +{ + const char *result; /* Désignation à retourner */ + + result = "switch-data"; + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : instr = instruction d'assemblage à compléter. * * keys = tableau renseignant les conditions de saut. [OUT] * * targets = tableau renseignant les sauts relatifs. [OUT] * |