MCPcopy Create free account
hub / github.com/HelenOS/helenos / program_create_from_image

Function program_create_from_image

kernel/generic/src/proc/program.c:144–160  ·  view source on GitHub ↗

Parse an executable image in the kernel memory. * * If the image belongs to a program loader, it is registered as such, * (and *task is set to NULL). Otherwise a task is created from the * executable image. The task is returned in *task. * * @param[in] image_addr Address of an executable program image. * @param[in] name Name to set for the program's task. * @param[out] prg B

Source from the content-addressed store, hash-verified

142 *
143 */
144errno_t program_create_from_image(void *image_addr, char *name, program_t *prg)
145{
146 as_t *as = as_create(0);
147 if (!as)
148 return ENOMEM;
149
150 prg->loader_status = elf_load((elf_header_t *) image_addr, as);
151 if (prg->loader_status != EOK) {
152 as_release(as);
153 prg->task = NULL;
154 prg->main_thread = NULL;
155 return ENOTSUP;
156 }
157
158 return program_create(as, ((elf_header_t *) image_addr)->e_entry,
159 name, prg);
160}
161
162/** Create a task from the program loader image.
163 *

Callers 1

kinitFunction · 0.85

Calls 4

as_createFunction · 0.85
as_releaseFunction · 0.85
program_createFunction · 0.85
elf_loadFunction · 0.50

Tested by

no test coverage detected