Changeset a35b458 in mainline for kernel/generic/src/proc/program.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/program.c
r3061bc1 ra35b458 75 75 if (!prg->task) 76 76 return ELIMIT; 77 77 78 78 /* 79 79 * Create the stack address space area. … … 94 94 return ENOMEM; 95 95 } 96 96 97 97 uspace_arg_t *kernel_uarg = (uspace_arg_t *) 98 98 malloc(sizeof(uspace_arg_t), 0); 99 99 100 100 kernel_uarg->uspace_entry = (void *) entry_addr; 101 101 kernel_uarg->uspace_stack = (void *) virt; … … 104 104 kernel_uarg->uspace_thread_arg = NULL; 105 105 kernel_uarg->uspace_uarg = NULL; 106 106 107 107 /* 108 108 * Create the main thread. … … 117 117 return ELIMIT; 118 118 } 119 119 120 120 return EOK; 121 121 } … … 142 142 if (!as) 143 143 return ENOMEM; 144 144 145 145 prg->loader_status = elf_load((elf_header_t *) image_addr, as, 0); 146 146 if (prg->loader_status != EE_OK) { … … 148 148 prg->task = NULL; 149 149 prg->main_thread = NULL; 150 150 151 151 if (prg->loader_status != EE_LOADER) 152 152 return ENOTSUP; 153 153 154 154 /* Register image as the program loader */ 155 155 if (program_loader != NULL) 156 156 return ELIMIT; 157 157 158 158 program_loader = image_addr; 159 159 log(LF_OTHER, LVL_NOTE, "Program loader at %p", (void *) image_addr); 160 160 161 161 return EOK; 162 162 } 163 163 164 164 return program_create(as, ((elf_header_t *) image_addr)->e_entry, 165 165 name, prg); … … 179 179 if (!as) 180 180 return ENOMEM; 181 181 182 182 void *loader = program_loader; 183 183 if (!loader) { … … 187 187 return ENOENT; 188 188 } 189 189 190 190 prg->loader_status = elf_load((elf_header_t *) program_loader, as, 191 191 ELD_F_LOADER); … … 196 196 return ENOENT; 197 197 } 198 198 199 199 return program_create(as, ((elf_header_t *) program_loader)->e_entry, 200 200 name, prg); … … 230 230 if (name_len > TASK_NAME_BUFLEN - 1) 231 231 name_len = TASK_NAME_BUFLEN - 1; 232 232 233 233 char namebuf[TASK_NAME_BUFLEN]; 234 234 errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len); 235 235 if (rc != EOK) 236 236 return (sys_errno_t) rc; 237 237 238 238 namebuf[name_len] = 0; 239 239 240 240 /* Spawn the new task. */ 241 241 program_t prg; … … 243 243 if (rc != EOK) 244 244 return rc; 245 245 246 246 // FIXME: control the permissions 247 247 perm_set(prg.task, perm_get(TASK)); 248 248 program_ready(&prg); 249 249 250 250 return EOK; 251 251 }
Note:
See TracChangeset
for help on using the changeset viewer.