diff options
Diffstat (limited to 'src/arch/raw.c')
-rw-r--r-- | src/arch/raw.c | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/src/arch/raw.c b/src/arch/raw.c index 62c88c1..808d973 100644 --- a/src/arch/raw.c +++ b/src/arch/raw.c @@ -254,7 +254,7 @@ GArchInstruction *g_raw_instruction_new_from_value(const vmpa2t *addr, MemoryDat * * ******************************************************************************/ -GArchInstruction *g_raw_instruction_new_array(const bin_t *data, MemoryDataSize size, size_t count, vmpa2t *addr, off_t end, SourceEndian endian) +GArchInstruction *g_raw_instruction_new_array_old(const bin_t *data, MemoryDataSize size, size_t count, vmpa2t *addr, off_t end, SourceEndian endian) { GArchInstruction *result; /* Instruction à retourner */ vmpa2t old; /* Sauvegarde de la position */ @@ -271,7 +271,63 @@ GArchInstruction *g_raw_instruction_new_array(const bin_t *data, MemoryDataSize for (i = 0; i < count; i++) { - operand = g_imm_operand_new_from_data(size, data, addr, end, endian); + operand = g_imm_operand_new_from_data_old(size, data, addr, end, endian); + if (operand == NULL) goto grina_error; + + g_imm_operand_pad(G_IMM_OPERAND(operand), true); + + g_arch_instruction_attach_extra_operand(result, operand); + } + + init_mrange(&range, &old, compute_vmpa_diff(addr, &old)); + + g_arch_instruction_set_range(result, &range); + + return result; + + grina_error: + + g_object_unref(G_OBJECT(result)); + + return NULL; + +} + + +/****************************************************************************** +* * +* Paramètres : content = flux de données à analyser. * +* size = taille de chacun des éléments à représenter. * +* count = nombre de ces éléments. * +* addr = position courante dans ce flux. [OUT] * +* endian = ordre des bits dans la source. * +* * +* Description : Crée une instruction de type 'db/dw/etc' étendue. * +* * +* Retour : Instruction mise en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GArchInstruction *g_raw_instruction_new_array(const GBinContent *content, MemoryDataSize size, size_t count, vmpa2t *addr, SourceEndian endian) +{ + GArchInstruction *result; /* Instruction à retourner */ + vmpa2t old; /* Sauvegarde de la position */ + size_t i; /* Boucle de parcours */ + GArchOperand *operand; /* Octet non décodé à afficher */ + mrange_t range; /* Couverture de l'instruction */ + + /* Par soucis de cohérence */ + if (count == 0) return NULL; + + result = g_object_new(G_TYPE_RAW_INSTRUCTION, NULL); + + copy_vmpa(&old, addr); + + for (i = 0; i < count; i++) + { + operand = g_imm_operand_new_from_data(size, content, addr, endian); if (operand == NULL) goto grina_error; g_imm_operand_pad(G_IMM_OPERAND(operand), true); |