Changeset 3375bd4 in mainline for uspace/srv/loader/elf_load.c


Ignore:
Timestamp:
2011-05-17T07:44:17Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04c418d, 2586860, 5e6e50b
Parents:
72cd53d (diff), 0d8a304 (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

Conflicts:
kernel/generic/src/console/console.c

size of klog, taken upstream

uspace/app/klog/klog.c

taken upstream (upstream fixed the broken output on huge load)

uspace/app/tester/Makefile
uspace/app/tester/tester.c
uspace/app/tester/tester.h

merged without problems

uspace/lib/c/include/as.h

merged without problems (upstream use bare declarations)

Also needed to fix some missing includes.

File:
1 edited

Legend:

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

    r72cd53d r3375bd4  
    22 * Copyright (c) 2006 Sergey Bondari
    33 * Copyright (c) 2006 Jakub Jermar
    4  * Copyright (c) 2008 Jiri Svoboda
     4 * Copyright (c) 2011 Jiri Svoboda
    55 * All rights reserved.
    66 *
     
    5353#include <smc.h>
    5454#include <loader/pcb.h>
     55#include <entry_point.h>
    5556
    5657#include "elf.h"
    5758#include "elf_load.h"
    58 #include "arch.h"
    5959
    6060#define DPRINTF(...)
     
    103103 *
    104104 */
    105 int elf_load_file(const char *file_name, size_t so_bias, elf_info_t *info)
     105int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags,
     106    elf_info_t *info)
    106107{
    107108        elf_ld_t elf;
     
    118119        elf.fd = fd;
    119120        elf.info = info;
     121        elf.flags = flags;
    120122
    121123        rc = elf_load(&elf, so_bias);
     
    124126
    125127        return rc;
    126 }
    127 
    128 /** Run an ELF executable.
    129  *
    130  * Transfers control to the entry point of an ELF executable loaded
    131  * earlier with elf_load_file(). This function does not return.
    132  *
    133  * @param info Info structure filled earlier by elf_load_file()
    134  *
    135  */
    136 void elf_run(elf_info_t *info, pcb_t *pcb)
    137 {
    138         program_run(info->entry, pcb);
    139 
    140         /* not reached */
    141128}
    142129
     
    153140        pcb->entry = info->entry;
    154141        pcb->dynamic = info->dynamic;
     142        pcb->rtld_runtime = NULL;
    155143}
    156144
     
    306294                break;
    307295        case PT_INTERP:
    308                 /* Assume silently interp == "/rtld.so" */
    309                 elf->info->interp = "/rtld.so";
     296                /* Assume silently interp == "/app/dload" */
     297                elf->info->interp = "/app/dload";
    310298                break;
    311299        case PT_DYNAMIC:
     300                /* Record pointer to dynamic section into info structure */
     301                elf->info->dynamic =
     302                    (void *)((uint8_t *)entry->p_vaddr + elf->bias);
     303                DPRINTF("dynamic section found at 0x%x\n",
     304                        (uintptr_t)elf->info->dynamic);
     305                break;
     306        case 0x70000000:
     307                /* FIXME: MIPS reginfo */
     308                break;
    312309        case PT_SHLIB:
    313         case PT_LOPROC:
    314         case PT_HIPROC:
     310//      case PT_LOPROC:
     311//      case PT_HIPROC:
    315312        default:
    316313                DPRINTF("Segment p_type %d unknown.\n", entry->p_type);
     
    383380            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
    384381        if (a == (void *)(-1)) {
    385                 DPRINTF("Memory mapping failed.\n");
     382                DPRINTF("memory mapping failed (0x%x, %d)\n",
     383                        base+bias, mem_sz);
    386384                return EE_MEMORY;
    387385        }
     
    425423        }
    426424
     425        /*
     426         * The caller wants to modify the segments first. He will then
     427         * need to set the right access mode and ensure SMC coherence.
     428         */
     429        if ((elf->flags & ELDF_RW) != 0) return EE_OK;
     430
     431//      printf("set area flags to %d\n", flags);
    427432        rc = as_area_change_flags(seg_ptr, flags);
    428433        if (rc != 0) {
Note: See TracChangeset for help on using the changeset viewer.