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


Ignore:
Timestamp:
2012-08-12T11:46:44Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
41b764b7
Parents:
e1e4192 (diff), 371cb6c (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

File:
1 edited

Legend:

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

    re1e4192 r90478727  
    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        
    8273        prg->loader_status = EE_OK;
    8374        prg->task = task_create(as, name);
     
    9283            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
    9384            STACK_SIZE, AS_AREA_ATTR_NONE, &anon_backend, NULL, &virt, 0);
    94         if (!area)
     85        if (!area) {
     86                task_destroy(prg->task);
    9587                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;
    9699       
    97100        /*
     
    99102         */
    100103        prg->main_thread = thread_create(uinit, kernel_uarg, prg->task,
    101             THREAD_FLAG_USPACE, "uinit", false);
    102         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);
    103109                return ELIMIT;
     110        }
    104111       
    105112        return EOK;
Note: See TracChangeset for help on using the changeset viewer.