Changes in kernel/generic/src/proc/program.c [6eef3c4:db675dd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/program.c
r6eef3c4 rdb675dd 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 73 82 prg->loader_status = EE_OK; 74 83 prg->task = task_create(as, name); … … 83 92 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, 84 93 STACK_SIZE, AS_AREA_ATTR_NONE, &anon_backend, NULL, &virt, 0); 85 if (!area) { 86 task_destroy(prg->task); 94 if (!area) 87 95 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;99 96 100 97 /* … … 102 99 */ 103 100 prg->main_thread = thread_create(uinit, kernel_uarg, prg->task, 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); 101 THREAD_FLAG_USPACE, "uinit", false); 102 if (!prg->main_thread) 109 103 return ELIMIT; 110 }111 104 112 105 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.