Changes in kernel/generic/src/proc/program.c [3fcea34:f8fb03b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/program.c
r3fcea34 rf8fb03b 49 49 #include <lib/elf_load.h> 50 50 #include <str.h> 51 #include <str_error.h>52 51 #include <log.h> 53 52 #include <syscall/copy.h> 54 53 #include <proc/program.h> 55 #include <userspace.h>56 54 57 55 /** … … 73 71 errno_t program_create(as_t *as, uspace_addr_t entry_addr, char *name, program_t *prg) 74 72 { 75 uinit_arg_t *kernel_uarg = malloc(sizeof(uinit_arg_t)); 73 uspace_arg_t *kernel_uarg = (uspace_arg_t *) 74 malloc(sizeof(uspace_arg_t)); 76 75 if (!kernel_uarg) 77 76 return ENOMEM; … … 99 98 if (!area) { 100 99 free(kernel_uarg); 101 task_ release(prg->task);100 task_destroy(prg->task); 102 101 prg->task = NULL; 103 102 return ENOMEM; 104 103 } 105 104 106 kernel_uarg->pc = entry_addr; 107 kernel_uarg->sp = arch_get_initial_sp(virt, STACK_SIZE_USER); 105 kernel_uarg->uspace_entry = entry_addr; 106 kernel_uarg->uspace_stack = virt; 107 kernel_uarg->uspace_stack_size = STACK_SIZE_USER; 108 kernel_uarg->uspace_thread_function = USPACE_NULL; 109 kernel_uarg->uspace_thread_arg = USPACE_NULL; 110 kernel_uarg->uspace_uarg = USPACE_NULL; 108 111 109 112 /* … … 115 118 free(kernel_uarg); 116 119 as_area_destroy(as, virt); 117 task_ release(prg->task);120 task_destroy(prg->task); 118 121 prg->task = NULL; 119 122 return ELIMIT; … … 139 142 * 140 143 */ 141 errno_t program_create_from_image(void *image_addr, size_t image_size,char *name, program_t *prg)144 errno_t program_create_from_image(void *image_addr, char *name, program_t *prg) 142 145 { 143 146 as_t *as = as_create(0); … … 153 156 } 154 157 155 errno_t rc =program_create(as, ((elf_header_t *) image_addr)->e_entry,158 return program_create(as, ((elf_header_t *) image_addr)->e_entry, 156 159 name, prg); 157 158 if (rc == EOK) {159 prg->task->debug_sections = calloc(1, sizeof(debug_sections_t));160 if (prg->task->debug_sections != NULL)161 *prg->task->debug_sections = get_debug_sections(image_addr, image_size);162 }163 164 return rc;165 160 } 166 161 … … 208 203 void program_ready(program_t *prg) 209 204 { 210 thread_start(prg->main_thread); 211 thread_detach(prg->main_thread); 212 prg->main_thread = NULL; 205 thread_ready(prg->main_thread); 213 206 } 214 207 … … 248 241 program_ready(&prg); 249 242 250 task_release(prg.task);251 252 243 return EOK; 253 244 }
Note:
See TracChangeset
for help on using the changeset viewer.