Changeset 97c7682 in mainline for kernel/generic/src/proc/program.c


Ignore:
Timestamp:
2012-07-14T11:18:40Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
804d9b6
Parents:
0747468 (diff), f0348c8 (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.

Text conflict in boot/arch/arm32/Makefile.inc:

Trivial conflict around ifeq condition.

Text conflict in kernel/arch/arm32/include/mm/page.h:

Added defines and set_pt_levelx_present function.
COnflict looked horrible because of the armv4/v7 split.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/program.c

    r0747468 r97c7682  
    7171int program_create(as_t *as, uintptr_t entry_addr, char *name, program_t *prg)
    7272{
    73         uspace_arg_t *kernel_uarg;
    74        
    75         kernel_uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t), 0);
    76         kernel_uarg->uspace_entry = (void *) entry_addr;
    77         kernel_uarg->uspace_stack = (void *) USTACK_ADDRESS;
    78         kernel_uarg->uspace_thread_function = NULL;
    79         kernel_uarg->uspace_thread_arg = NULL;
    80         kernel_uarg->uspace_uarg = NULL;
    81        
     73        prg->loader_status = EE_OK;
    8274        prg->task = task_create(as, name);
    8375        if (!prg->task)
     
    9183            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
    9284            STACK_SIZE, AS_AREA_ATTR_NONE, &anon_backend, NULL, &virt, 0);
    93         if (!area)
     85        if (!area) {
     86                task_destroy(prg->task);
    9487                return ENOMEM;
     88        }
     89       
     90        uspace_arg_t *kernel_uarg = (uspace_arg_t *)
     91            malloc(sizeof(uspace_arg_t), 0);
     92       
     93        kernel_uarg->uspace_entry = (void *) entry_addr;
     94        kernel_uarg->uspace_stack = (void *) virt;
     95        kernel_uarg->uspace_stack_size = STACK_SIZE;
     96        kernel_uarg->uspace_thread_function = NULL;
     97        kernel_uarg->uspace_thread_arg = NULL;
     98        kernel_uarg->uspace_uarg = NULL;
    9599       
    96100        /*
     
    98102         */
    99103        prg->main_thread = thread_create(uinit, kernel_uarg, prg->task,
    100             THREAD_FLAG_USPACE, "uinit", false);
    101         if (!prg->main_thread)
     104            THREAD_FLAG_USPACE, "uinit");
     105        if (!prg->main_thread) {
     106                free(kernel_uarg);
     107                as_area_destroy(as, virt);
     108                task_destroy(prg->task);
    102109                return ELIMIT;
     110        }
    103111       
    104112        return EOK;
     
    111119 * executable image. The task is returned in *task.
    112120 *
    113  * @param image_addr Address of an executable program image.
    114  * @param name       Name to set for the program's task.
    115  * @param prg        Buffer for storing program info. If image_addr
    116  *                   points to a loader image, p->task will be set to
    117  *                   NULL and EOK will be returned.
     121 * @param[in]  image_addr Address of an executable program image.
     122 * @param[in]  name       Name to set for the program's task.
     123 * @param[out] prg        Buffer for storing program info.
     124 *                        If image_addr points to a loader image,
     125 *                        prg->task will be set to NULL and EOK
     126 *                        will be returned.
    118127 *
    119128 * @return EOK on success or negative error code.
     
    126135                return ENOMEM;
    127136       
    128         unsigned int rc = elf_load((elf_header_t *) image_addr, as, 0);
    129         if (rc != EE_OK) {
     137        prg->loader_status = elf_load((elf_header_t *) image_addr, as, 0);
     138        if (prg->loader_status != EE_OK) {
    130139                as_destroy(as);
    131140                prg->task = NULL;
    132141                prg->main_thread = NULL;
    133142               
    134                 if (rc != EE_LOADER)
     143                if (prg->loader_status != EE_LOADER)
    135144                        return ENOTSUP;
    136145               
     
    140149               
    141150                program_loader = image_addr;
    142                 LOG("Registered program loader at %p",
    143                     (void *) image_addr);
     151                printf("Program loader at %p\n", (void *) image_addr);
    144152               
    145153                return EOK;
     
    171179        }
    172180       
    173         unsigned int rc = elf_load((elf_header_t *) program_loader, as,
     181        prg->loader_status = elf_load((elf_header_t *) program_loader, as,
    174182            ELD_F_LOADER);
    175         if (rc != EE_OK) {
     183        if (prg->loader_status != EE_OK) {
    176184                as_destroy(as);
    177                 printf("Cannot spawn loader (%s)\n", elf_error(rc));
     185                printf("Cannot spawn loader (%s)\n",
     186                    elf_error(prg->loader_status));
    178187                return ENOENT;
    179188        }
Note: See TracChangeset for help on using the changeset viewer.