Changeset 04803bf in mainline for uspace/srv/loader/elf_load.c


Ignore:
Timestamp:
2011-03-21T22:00:17Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
143932e
Parents:
b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes (needs fixes).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/loader/elf_load.c

    rb50b5af2 r04803bf  
    6060#define DPRINTF(...)
    6161
    62 static char *error_codes[] = {
     62static const char *error_codes[] = {
    6363        "no error",
    6464        "invalid image",
     
    9595 * pointed to by @a info.
    9696 *
    97  * @param file_name     Path to the ELF file.
    98  * @param so_bias       Bias to use if the file is a shared object.
    99  * @param info          Pointer to a structure for storing information
    100  *                      extracted from the binary.
     97 * @param file_name Path to the ELF file.
     98 * @param so_bias   Bias to use if the file is a shared object.
     99 * @param info      Pointer to a structure for storing information
     100 *                  extracted from the binary.
    101101 *
    102102 * @return EOK on success or negative error code.
    103  */
    104 int elf_load_file(char *file_name, size_t so_bias, eld_flags_t flags,
     103 *
     104 */
     105int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags,
    105106    elf_info_t *info)
    106107{
     
    109110        int fd;
    110111        int rc;
    111 
     112       
    112113        fd = open(file_name, O_RDONLY);
    113114        if (fd < 0) {
     
    269270 * @return NULL terminated description of error.
    270271 */
    271 char *elf_error(unsigned int rc)
     272const char *elf_error(unsigned int rc)
    272273{
    273274        assert(rc < sizeof(error_codes) / sizeof(char *));
     
    287288        case PT_NULL:
    288289        case PT_PHDR:
     290        case PT_NOTE:
    289291                break;
    290292        case PT_LOAD:
     
    306308                break;
    307309        case PT_SHLIB:
    308         case PT_NOTE:
    309310//      case PT_LOPROC:
    310311//      case PT_HIPROC:
     
    340341        seg_ptr = (void *) seg_addr;
    341342
    342         DPRINTF("Load segment at addr 0x%x, size 0x%x\n", seg_addr,
    343                 entry->p_memsz);       
     343        DPRINTF("Load segment at addr %p, size 0x%x\n", (void *) seg_addr,
     344                entry->p_memsz);
    344345
    345346        if (entry->p_align > 1) {
     
    368369        mem_sz = entry->p_memsz + (entry->p_vaddr - base);
    369370
    370         DPRINTF("Map to seg_addr=0x%x-0x%x.\n", seg_addr,
    371         entry->p_vaddr + bias + ALIGN_UP(entry->p_memsz, PAGE_SIZE));
     371        DPRINTF("Map to seg_addr=%p-%p.\n", (void *) seg_addr,
     372            (void *) (entry->p_vaddr + bias +
     373            ALIGN_UP(entry->p_memsz, PAGE_SIZE)));
    372374
    373375        /*
     
    383385        }
    384386
    385         DPRINTF("as_area_create(0x%lx, 0x%x, %d) -> 0x%lx\n",
    386                 base + bias, mem_sz, flags, (uintptr_t)a);
     387        DPRINTF("as_area_create(%p, %#zx, %d) -> %p\n",
     388            (void *) (base + bias), mem_sz, flags, (void *) a);
    387389
    388390        /*
     
    464466                break;
    465467        case SHT_DYNAMIC:
     468                /* Record pointer to dynamic section into info structure */
     469                elf->info->dynamic =
     470                    (void *)((uint8_t *)entry->sh_addr + elf->bias);
     471                DPRINTF("Dynamic section found at %p.\n",
     472                    (void *) elf->info->dynamic);
    466473                break;
    467474        default:
Note: See TracChangeset for help on using the changeset viewer.