summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/pseudo/fill.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/dalvik/pseudo/fill.c')
-rw-r--r--src/arch/dalvik/pseudo/fill.c94
1 files changed, 7 insertions, 87 deletions
diff --git a/src/arch/dalvik/pseudo/fill.c b/src/arch/dalvik/pseudo/fill.c
index e1e1822..69452b5 100644
--- a/src/arch/dalvik/pseudo/fill.c
+++ b/src/arch/dalvik/pseudo/fill.c
@@ -37,7 +37,7 @@ struct _GDalvikFillInstr
{
GDalvikInstruction parent; /* A laisser en premier */
- uint16_t array_width; /* Taille des éléments */
+ uint16_t item_width; /* Taille des éléments */
uint32_t array_size; /* Taille du tableau */
};
@@ -63,9 +63,6 @@ static void g_dalvik_fill_instr_dispose(GDalvikFillInstr *);
/* Procède à la libération totale de la mémoire. */
static void g_dalvik_fill_instr_finalize(GDalvikFillInstr *);
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_dalvik_fill_instr_print(GDalvikFillInstr *, GCodeBuffer *, MemoryDataSize, const bin_t *, AsmSyntax);
-
/* Indique le type défini pour une pseudo-instruction Dalvik de remplissage. */
@@ -87,17 +84,12 @@ G_DEFINE_TYPE(GDalvikFillInstr, g_dalvik_fill_instr, G_TYPE_DALVIK_INSTRUCTION);
static void g_dalvik_fill_instr_class_init(GDalvikFillInstrClass *klass)
{
GObjectClass *object; /* Autre version de la classe */
- GArchInstructionClass *instr; /* Encore une autre vision... */
object = G_OBJECT_CLASS(klass);
object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_fill_instr_dispose;
object->finalize = (GObjectFinalizeFunc)g_dalvik_fill_instr_finalize;
- instr = G_ARCH_INSTRUCTION_CLASS(klass);
-
- //instr->print = (print_instruction_fc)g_dalvik_fill_instr_print;
-
}
@@ -115,7 +107,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##";
+ G_DALVIK_INSTRUCTION(instr)->keyword = "array-data";
}
@@ -161,6 +153,7 @@ static void g_dalvik_fill_instr_finalize(GDalvikFillInstr *instr)
/******************************************************************************
* *
* Paramètres : ident = identifiant de l'instruction déjà lu. *
+* ctx = contexte lié à l'exécution du processeur. *
* content = flux de données à analyser. *
* pos = position courante dans ce flux. [OUT] *
* *
@@ -172,7 +165,7 @@ static void g_dalvik_fill_instr_finalize(GDalvikFillInstr *instr)
* *
******************************************************************************/
-GArchInstruction *g_dalvik_fill_instr_new(uint16_t ident, const GBinContent *content, vmpa2t *pos)
+GArchInstruction *g_dalvik_fill_instr_new(uint16_t ident, GDalvikContext *ctx, const GBinContent *content, vmpa2t *pos)
{
GDalvikFillInstr *result; /* Structure à retourner */
phys_t consumed; /* Données consommées */
@@ -183,19 +176,17 @@ GArchInstruction *g_dalvik_fill_instr_new(uint16_t ident, const GBinContent *con
G_DALVIK_INSTRUCTION(result)->ptype = ident;
- if (!g_binary_content_read_u16(content, pos, SRE_LITTLE, &result->array_width))
+ if (!g_binary_content_read_u16(content, pos, SRE_LITTLE, &result->item_width))
goto gdfin_bad;
if (!g_binary_content_read_u32(content, pos, SRE_LITTLE, &result->array_size))
goto gdfin_bad;
- consumed = result->array_width * result->array_size;
+ consumed = result->item_width * result->array_size;
- if (!g_binary_content_seek(content, pos, consumed))
+ if (!g_dalvik_context_register_array_data(ctx, pos, result->item_width, consumed))
goto gdfin_bad;
- g_arch_instruction_set_displayed_max_length(G_ARCH_INSTRUCTION(result), 8);
-
return G_ARCH_INSTRUCTION(result);
gdfin_bad:
@@ -205,74 +196,3 @@ GArchInstruction *g_dalvik_fill_instr_new(uint16_t ident, const GBinContent *con
return NULL;
}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'assemblage à représenter. *
-* buffer = espace où placer ledit contenu. *
-* syntax = type de représentation demandée. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_fill_instr_print(GDalvikFillInstr *instr, GCodeBuffer *buffer, MemoryDataSize msize, const bin_t *content, AsmSyntax syntax)
-{
- GArchInstruction *base; /* Version basique de l'objet */
- GBufferLine *line; /* Ligne de destination */
- char address[VMPA_MAX_SIZE]; /* Adresse au format texte */
- size_t len; /* Taille de l'élément inséré */
- char *bin_code; /* Tampon du code binaire */
- off_t i; /* Boucle de parcours */
- const char *key; /* Mot clef principal */
- size_t klen; /* Taille de ce mot clef */
-
- base = G_ARCH_INSTRUCTION(instr);
-
- line = NULL;
-
-
-#if 0
-
- line = g_code_buffer_append_new_line(buffer, base->address);
-
- /* Adresse virtuelle ou physique */
-
- len = vmpa_to_string(base->address, msize, address);
-
- g_buffer_line_insert_text(line, BLC_PHYSICAL, address, len, RTT_RAW);
-
- /* TODO ... */
-
- /* Code brut */
-
- bin_code = (char *)calloc(3 * 3 + 3, sizeof(char));
-
- for (i = 0; i < 3; i++)
- {
- if ((i + 1) < 3)
- snprintf(&bin_code[i * (2 + 1)], 4, "%02hhx ", content[base->offset + i]);
- else
- snprintf(&bin_code[i * (2 + 1)], 6, "%02hhx...", content[base->offset + i]);
- }
-
- g_buffer_line_insert_text(line, BLC_BINARY,
- bin_code, 3 * 3 + 2, RTT_RAW_CODE);
-
- free(bin_code);
-
-#endif
-
- /* Instruction proprement dite */
-
- key = "<fill-array>";
- klen = strlen(key);
-
- g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, key, klen, RTT_INSTRUCTION);
-
-}