Changeset 2902e1bb in mainline for kernel/generic/src/proc/program.c
- Timestamp:
- 2012-06-13T13:17:46Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1d4024cf, 375e501
- Parents:
- faba839
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/program.c
rfaba839 r2902e1bb 71 71 int program_create(as_t *as, uintptr_t entry_addr, char *name, program_t *prg) 72 72 { 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 82 73 prg->loader_status = EE_OK; 83 74 prg->task = task_create(as, name); … … 92 83 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, 93 84 STACK_SIZE, AS_AREA_ATTR_NONE, &anon_backend, NULL, &virt, 0); 94 if (!area) 85 if (!area) { 86 task_destroy(prg->task); 95 87 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; 96 99 97 100 /* … … 100 103 prg->main_thread = thread_create(uinit, kernel_uarg, prg->task, 101 104 THREAD_FLAG_USPACE, "uinit", false); 102 if (!prg->main_thread) 105 if (!prg->main_thread) { 106 free(kernel_uarg); 107 as_area_destroy(as, virt); 108 task_destroy(prg->task); 103 109 return ELIMIT; 110 } 104 111 105 112 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.