diff options
Diffstat (limited to 'src/arch')
| -rw-r--r-- | src/arch/arm/v7/fetch.c | 81 | ||||
| -rw-r--r-- | src/arch/context-int.h | 7 | ||||
| -rw-r--r-- | src/arch/context.c | 2 | ||||
| -rw-r--r-- | src/arch/instruction.c | 10 | ||||
| -rw-r--r-- | src/arch/instruction.h | 4 | 
5 files changed, 33 insertions, 71 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); diff --git a/src/arch/context-int.h b/src/arch/context-int.h index 4e188cc..3a5c7ee 100644 --- a/src/arch/context-int.h +++ b/src/arch/context-int.h @@ -31,6 +31,9 @@  #include <stdarg.h> +#include "../format/preload-int.h" + +  /* Granularité des allocations */  #define DP_ALLOC_BLOCK 10 @@ -43,7 +46,7 @@ typedef void (* push_drop_point_fc) (GProcContext *, DisassPriorityLevel, virt_t  /* Définition d'un contexte pour processeur (instance) */  struct _GProcContext  { -    GObject parent;                         /* A laisser en premier        */ +    GPreloadInfo parent;                    /* A laisser en premier        */      virt_t *drop_points[DPL_COUNT];         /* Liste de points de départ   */      size_t dp_allocated[DPL_COUNT];         /* Taille de liste allouée     */ @@ -67,7 +70,7 @@ struct _GProcContext  /* Définition d'un contexte pour processeur (classe) */  struct _GProcContextClass  { -    GObjectClass parent;                    /* A laisser en premier        */ +    GPreloadInfoClass parent;               /* A laisser en premier        */  	push_drop_point_fc push_point;			/* Inclusion de points de chute*/ diff --git a/src/arch/context.c b/src/arch/context.c index ddb74fd..c7a59da 100644 --- a/src/arch/context.c +++ b/src/arch/context.c @@ -55,7 +55,7 @@ static void _g_proc_context_push_drop_point(GProcContext *, DisassPriorityLevel,  /* Indique le type définit par la GLib pour le contexte de processeur. */ -G_DEFINE_TYPE(GProcContext, g_proc_context, G_TYPE_OBJECT); +G_DEFINE_TYPE(GProcContext, g_proc_context, G_TYPE_PRELOAD_INFO); diff --git a/src/arch/instruction.c b/src/arch/instruction.c index a9bc4f2..807bbbb 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -463,7 +463,7 @@ void g_arch_instruction_get_rw_registers(const GArchInstruction *instr, GArchReg  *                                                                             *  *  Paramètres  : instr = instruction à mettre à jour.                         *  *                                                                             * -*  Description : Verrouille les accès la liste des opérandes.                 * +*  Description : Verrouille les accès à la liste des opérandes.               *  *                                                                             *  *  Retour      : -                                                            *  *                                                                             * @@ -482,7 +482,7 @@ void g_arch_instruction_lock_operands(GArchInstruction *instr)  *                                                                             *  *  Paramètres  : instr = instruction à mettre à jour.                         *  *                                                                             * -*  Description : Déverrouille les accès la liste des opérandes.               * +*  Description : Déverrouille les accès à la liste des opérandes.             *  *                                                                             *  *  Retour      : -                                                            *  *                                                                             * @@ -546,12 +546,12 @@ size_t _g_arch_instruction_count_operands(const GArchInstruction *instr)  /******************************************************************************  *                                                                             * -*  Paramètres  : instr = instance à mettre à jour.                            * -*                index = indice de l'opérande concernée.                      * +*  Paramètres  : instr = instance à consulter.                                * +*                index = indice de l'opérande concerné.                       *  *                                                                             *  *  Description : Fournit un opérande donné d'une instruction.                 *  *                                                                             * -*  Retour      : Opérande trouvée ou NULL si aucune.                          * +*  Retour      : Opérande trouvée.                                            *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             * diff --git a/src/arch/instruction.h b/src/arch/instruction.h index 55c845e..64b8dd5 100644 --- a/src/arch/instruction.h +++ b/src/arch/instruction.h @@ -131,10 +131,10 @@ void g_arch_instruction_get_rw_registers(const GArchInstruction *, GArchRegister  /* --------------------------- MANIPULATION DES OPERANDES --------------------------- */ -/* Verrouille les accès la liste des opérandes. */ +/* Verrouille les accès à la liste des opérandes. */  void g_arch_instruction_lock_operands(GArchInstruction *); -/* Déverrouille les accès la liste des opérandes. */ +/* Déverrouille les accès à la liste des opérandes. */  void g_arch_instruction_unlock_operands(GArchInstruction *);  /* Attache un opérande supplémentaire à une instruction. */ | 
