Subversion Repositories HelenOS

Rev

Rev 3149 | Rev 3153 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3149 Rev 3150
Line 247... Line 247...
247
 * @param entry_addr Program entry-point address in program address space.
247
 * @param entry_addr Program entry-point address in program address space.
248
 * @param name Program name.
248
 * @param name Program name.
249
 *
249
 *
250
 * @return Task of the running program or NULL on error.
250
 * @return Task of the running program or NULL on error.
251
 */
251
 */
252
task_t *task_create_from_as(as_t *as, uintptr_t entry_addr, char *name
252
task_t *task_create_from_as(as_t *as, uintptr_t entry_addr, char *name,
253
    thread_t **thr)
253
    thread_t **thr)
254
{
254
{
255
    as_area_t *a;
255
    as_area_t *a;
256
    thread_t *t;
256
    thread_t *t;
257
    task_t *task;
257
    task_t *task;
Line 308... Line 308...
308
    ASSERT(as);
308
    ASSERT(as);
309
 
309
 
310
    rc = elf_load((elf_header_t *) program_addr, as, 0);
310
    rc = elf_load((elf_header_t *) program_addr, as, 0);
311
    if (rc != EE_OK) {
311
    if (rc != EE_OK) {
312
        as_destroy(as);
312
        as_destroy(as);
313
        *task = NULL;
313
        *t = NULL;
314
        if (rc != EE_LOADER)
314
        if (rc != EE_LOADER)
315
            return ENOTSUP;
315
            return ENOTSUP;
316
       
316
       
317
        /* Register image as the program loader */
317
        /* Register image as the program loader */
318
        ASSERT(program_loader == NULL);
318
        ASSERT(program_loader == NULL);
Line 336... Line 336...
336
int task_create_from_loader(char *name, task_t **t)
336
int task_create_from_loader(char *name, task_t **t)
337
{
337
{
338
    as_t *as;
338
    as_t *as;
339
    unsigned int rc;
339
    unsigned int rc;
340
    void *loader;
340
    void *loader;
-
 
341
    thread_t *thr;
341
 
342
 
342
    as = as_create(0);
343
    as = as_create(0);
343
    ASSERT(as);
344
    ASSERT(as);
344
 
345
 
345
    loader = program_loader;
346
    loader = program_loader;
Line 350... Line 351...
350
        as_destroy(as);
351
        as_destroy(as);
351
        return ENOENT;
352
        return ENOENT;
352
    }
353
    }
353
 
354
 
354
    *t = task_create_from_as(
355
    *t = task_create_from_as(
355
        as, ((elf_header_t *) program_loader)->e_entry, name); 
356
        as, ((elf_header_t *) program_loader)->e_entry, name, &thr);
356
 
357
 
357
    return EOK;
358
    return EOK;
358
}
359
}
359
 
360
 
360
/** Make task ready.
361
/** Make task ready.
Line 465... Line 466...
465
        free(kernel_uarg);
466
        free(kernel_uarg);
466
        free(kimage);
467
        free(kimage);
467
        return ENOMEM;
468
        return ENOMEM;
468
    }
469
    }
469
   
470
   
470
    unsigned int erc = elf_load((elf_header_t *) kimage, as);
471
    unsigned int erc = elf_load((elf_header_t *) kimage, as, ELD_F_NONE);
471
    if (erc != EE_OK) {
472
    if (erc != EE_OK) {
472
        as_destroy(as);
473
        as_destroy(as);
473
        free(kernel_uarg);
474
        free(kernel_uarg);
474
        free(kimage);
475
        free(kimage);
475
        return ENOENT;
476
        return ENOENT;