diff options
Diffstat (limited to 'src/arch/dalvik/pseudo/fill.c')
-rw-r--r-- | src/arch/dalvik/pseudo/fill.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/arch/dalvik/pseudo/fill.c b/src/arch/dalvik/pseudo/fill.c index acb8551..2656dab 100644 --- a/src/arch/dalvik/pseudo/fill.c +++ b/src/arch/dalvik/pseudo/fill.c @@ -24,6 +24,7 @@ #include "fill.h" +#include <assert.h> #include <string.h> @@ -95,7 +96,7 @@ static void g_dalvik_fill_instr_class_init(GDalvikFillInstrClass *klass) instr = G_ARCH_INSTRUCTION_CLASS(klass); - instr->print = (print_instruction_fc)g_dalvik_fill_instr_print; + //instr->print = (print_instruction_fc)g_dalvik_fill_instr_print; } @@ -114,6 +115,7 @@ static void g_dalvik_fill_instr_class_init(GDalvikFillInstrClass *klass) static void g_dalvik_fill_instr_init(GDalvikFillInstr *instr) { + G_DALVIK_INSTRUCTION(instr)->keyword = "##fill-array##"; } @@ -158,11 +160,9 @@ static void g_dalvik_fill_instr_finalize(GDalvikFillInstr *instr) /****************************************************************************** * * -* Paramètres : data = flux de données à analyser. * -* pos = position courante dans ce flux. [OUT] * -* end = limite des données à analyser. * -* addr = adresse virtuelle de l'instruction. * -* proc = architecture ciblée par le désassemblage. * +* Paramètres : ident = identifiant de l'instruction déjà lu. * +* content = flux de données à analyser. * +* pos = position courante dans ce flux. [OUT] * * * * Description : Crée une pesudo-instruction Dalvik de remplissage. * * * @@ -172,24 +172,26 @@ static void g_dalvik_fill_instr_finalize(GDalvikFillInstr *instr) * * ******************************************************************************/ -GArchInstruction *g_dalvik_fill_instr_new(const bin_t *data, off_t *pos, off_t end, vmpa_t addr, const GDalvikProcessor *proc) +GArchInstruction *g_dalvik_fill_instr_new(uint16_t ident, const GBinContent *content, vmpa2t *pos) { GDalvikFillInstr *result; /* Structure à retourner */ - uint16_t ident; /* Valeur lue dans le code */ + phys_t consumed; /* Données consommées */ - result = g_object_new(G_TYPE_DALVIK_FILL_INSTR, NULL); + assert(ident == DPO_FILL_ARRAY_DATA); - if (!read_u16(&ident, data, pos, end, SRE_LITTLE)) - goto gdfin_bad; + result = g_object_new(G_TYPE_DALVIK_FILL_INSTR, NULL); - G_DALVIK_INSTRUCTION(result)->ptype = DPO_FILL_ARRAY_DATA; + G_DALVIK_INSTRUCTION(result)->ptype = ident; - if (!read_u16(&result->array_width, data, pos, end, SRE_LITTLE)) + if (!g_binary_content_read_u16(content, pos, SRE_LITTLE, &result->array_width)) goto gdfin_bad; - if (!read_u32(&result->array_size, data, pos, end, SRE_LITTLE)) + + if (!g_binary_content_read_u32(content, pos, SRE_LITTLE, &result->array_size)) goto gdfin_bad; - *pos += result->array_width * result->array_size; + consumed = result->array_width * result->array_size; + + advance_vmpa(pos, consumed); return G_ARCH_INSTRUCTION(result); |