summaryrefslogtreecommitdiff
path: root/src/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/arm')
-rw-r--r--src/arch/arm/v7/fetch.c81
1 files changed, 20 insertions, 61 deletions
diff --git a/src/arch/arm/v7/fetch.c b/src/arch/arm/v7/fetch.c
index 11864f6..788d7ab 100644
--- a/src/arch/arm/v7/fetch.c
+++ b/src/arch/arm/v7/fetch.c
@@ -25,7 +25,7 @@
#include <assert.h>
-#include <malloc.h>
+#include <stdio.h>
#include <i18n.h>
@@ -36,6 +36,7 @@
#include "../../raw.h"
#include "../../sharing/container.h"
#include "../../../format/format.h"
+#include "../../../format/preload.h"
@@ -361,18 +362,15 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
uint32_t offset; /* Décallage encodé en dur */
bool ret; /* Bilan d'une récupération */
off_t val_offset; /* Position de valeur à lire */
- vmpa2t sym_addr; /* Adresse de nouveau symbole */
+ vmpa2t loaded_addr; /* Adresse de valeur chargée */
+ mrange_t loaded_range; /* Espace de chargement */
GBinContent *content; /* Contenu binaire à relire */
uint32_t target; /* Adresse virtuelle visée */
vmpa2t pos; /* Tête de lecture de valeur */
- mrange_t sym_range; /* Espace du nouveau symbole */
VMPA_BUFFER(loc); /* Adresse au format texte */
- size_t name_len; /* Taille de nomination finale */
- char *name; /* Désignation humaine */
- GArchInstruction *sym_instr; /* Instruction de symbole */
- GBinSymbol *symbol; /* Nouveau symbole construit */
+ GArchInstruction *loaded; /* Instruction de valeur */
+ char *desc; /* Description d'accompagnement*/
GDbComment *comment; /* Définition de commentaire */
- bool added; /* Bilan de l'insertion */
GArchOperand *new; /* Instruction de ciblage */
/* Récupération de l'adresse visée par le chargement */
@@ -410,32 +408,24 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
return;
}
- /* Transformations et conservation d'une position de symbole */
+ /* Transformations et conservation d'une position de chargement */
val_offset = phys_pc + offset;
- if (!g_exe_format_translate_offset_into_vmpa(format, val_offset, &sym_addr))
+ if (!g_exe_format_translate_offset_into_vmpa(format, val_offset, &loaded_addr))
{
assert(0);
g_arch_instruction_unlock_operands(instr);
return;
}
- //init_vmpa(&sym_addr, val_offset, VMPA_NO_VIRTUAL);
- init_mrange(&sym_range, &sym_addr, 4);
-
-
-
-
-
-
-
+ init_mrange(&loaded_range, &loaded_addr, 4);
/* Lecture de la valeur vers laquelle renvoyer */
content = g_binary_format_get_content(G_BIN_FORMAT(format));
- copy_vmpa(&pos, &sym_addr);
+ copy_vmpa(&pos, &loaded_addr);
ret = g_binary_content_read_u32(content, &pos, SRE_LITTLE /* FIXME */, &target);
g_object_unref(G_OBJECT(content));
@@ -446,55 +436,24 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
return;
}
- /* Réalise l'intégration du symbole associé */
+ /* Réalise l'intégration de la valeur chargée */
- sym_instr = g_raw_instruction_new_from_value(&sym_addr, MDS_32_BITS_UNSIGNED, target);
+ copy_vmpa(&pos, &loaded_addr);
- name_len = strlen(_("Value used @ %s")) + VMPA_MAX_LEN + 1;
+ loaded = g_raw_instruction_new_from_value(&pos, MDS_32_BITS_UNSIGNED, target);
- name = (char *)calloc(name_len, sizeof(char));
+ g_preload_info_add_instruction(G_PRELOAD_INFO(context), loaded);
vmpa2_virt_to_string(get_mrange_addr(range), MDS_32_BITS, loc, NULL);
- snprintf(name, name_len, _("Value used @ %s"), loc);
-
- added = ADD_RAW_AS_SYM(G_BIN_FORMAT(format), symbol, sym_instr, comment, name);
-
- free(name);
-
-
-
- if (added)
- g_proc_context_push_new_symbol_at(G_PROC_CONTEXT(context), &sym_addr);
-
-
-
- //g_proc_context_push_new_symbol_at(context, &sym_addr);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- //g_imm_operand_set_value(G_IMM_OPERAND(sub_op), MDS_32_BITS_UNSIGNED, target, G_SHARE_CONTAINER(instr));
-
+ asprintf(&desc, _("Value used @ %s"), loc);
- /// FIXME ?!
- //if (target < 0x8000) return;
+ comment = g_db_comment_new_inlined(&loaded_addr, BLF_HAS_CODE, false);
+ g_db_comment_add_static_text(comment, desc);
+ g_db_item_set_volatile(G_DB_ITEM(comment), true);
- //if (target > 0x6966c) return;
+ g_preload_info_add_comment(G_PRELOAD_INFO(context), comment);
+ /* Mise à jour de l'affichage et conclusion */
new = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, target);
_g_arch_instruction_replace_operand(instr, op, new);