diff options
Diffstat (limited to 'src/format')
| -rw-r--r-- | src/format/elf/e_elf.c | 25 | ||||
| -rw-r--r-- | src/format/elf/symbol.c | 16 | ||||
| -rw-r--r-- | src/format/exe_format.h | 1 | 
3 files changed, 35 insertions, 7 deletions
diff --git a/src/format/elf/e_elf.c b/src/format/elf/e_elf.c index c52a304..dac0cd7 100644 --- a/src/format/elf/e_elf.c +++ b/src/format/elf/e_elf.c @@ -42,6 +42,12 @@ + +/* Indique le type d'architecture visée par le format. */ +FormatTargetMachine get_elf_target_machine(const elf_format *); + + +  /* Fournit l'adresse mémoire du point d'entrée du programme. */  uint64_t get_elf_entry_point(const elf_format *); @@ -111,6 +117,7 @@ elf_format *load_elf(const uint8_t *content, off_t length)      EXE_FORMAT(result)->content = content;      EXE_FORMAT(result)->length = length; +    EXE_FORMAT(result)->get_target_machine = (get_target_machine_fc)get_elf_target_machine;      EXE_FORMAT(result)->get_entry_point = (get_entry_point_fc)get_elf_entry_point;      EXE_FORMAT(result)->get_def_parts = (get_def_parts_fc)get_elf_default_code_parts;      EXE_FORMAT(result)->find_section = (find_section_fc)find_elf_section_content_by_name; @@ -221,6 +228,24 @@ elf_format *load_elf(const uint8_t *content, off_t length) +/****************************************************************************** +*                                                                             * +*  Paramètres  : format = informations chargées à consulter.                  * +*                                                                             * +*  Description : Indique le type d'architecture visée par le format.          * +*                                                                             * +*  Retour      : Identifiant de l'architecture ciblée par le format.          * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +FormatTargetMachine get_elf_target_machine(const elf_format *format) +{ +    return FTM_386; + +} +  /****************************************************************************** diff --git a/src/format/elf/symbol.c b/src/format/elf/symbol.c index f1c320f..fbb6fd8 100644 --- a/src/format/elf/symbol.c +++ b/src/format/elf/symbol.c @@ -52,10 +52,10 @@ bool load_elf_relocation_table(elf_format *, const off_t *, const off_t *, const  char *get_elf_dynamic_symbol_info(elf_format *, const off_t *, const off_t *, const off_t *, const off_t *, const off_t *);  /* Décode les instructions liées à la relocalisation. */ -asm_instr **decode_elf_relocations(elf_format *, size_t *); +//asm_instr **decode_elf_relocations(elf_format *, size_t *);  /* Déduit les adresses effectives des relocalisations. */ -void translate_elf_relocations(elf_format *, asm_instr **, size_t); +//void translate_elf_relocations(elf_format *, asm_instr **, size_t); @@ -98,7 +98,7 @@ bool load_elf_symbols(elf_format *format)      off_t dyn_size;                         /* Taille de section           */ -    asm_instr **instructions;               /* Instructions décodées       */ +    //asm_instr **instructions;               /* Instructions décodées       */      result = true; @@ -173,12 +173,13 @@ bool load_elf_symbols(elf_format *format)      if (result)      { +#if 0          instructions = decode_elf_relocations(format, &count);          translate_elf_relocations(format, instructions, count);          /* TODO : free instructions */ - +#endif      } @@ -470,7 +471,7 @@ char *get_elf_dynamic_symbol_info(elf_format *format, const off_t *dyn_start, co  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ - +#if 0  asm_instr **decode_elf_relocations(elf_format *format, size_t *count)  {      asm_instr **result;                     /* Liste à renvoyer            */ @@ -527,8 +528,8 @@ asm_instr **decode_elf_relocations(elf_format *format, size_t *count)      return result;  } - - +#endif +#if 0  /******************************************************************************  *                                                                             *  *  Paramètres  : format       = description de l'exécutable à compléter.      * @@ -580,3 +581,4 @@ void translate_elf_relocations(elf_format *format, asm_instr **instructions, siz      }  } +#endif diff --git a/src/format/exe_format.h b/src/format/exe_format.h index 1b359ff..2c10d65 100644 --- a/src/format/exe_format.h +++ b/src/format/exe_format.h @@ -92,6 +92,7 @@ exe_format *load_new_exe_format(const uint8_t *, off_t);  /* Architectures de destination des formats */  typedef enum _FormatTargetMachine  { +    FTM_386,                                /* Intel 80386                 */      FTM_JVM,                                /* Java Virtual Machine        */      FTM_COUNT  | 
