Changeset 40abf56 in mainline for uspace/srv/loader/main.c


Ignore:
Timestamp:
2018-07-18T19:42:28Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9bde0d5
Parents:
0b05082
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-18 19:05:08)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-18 19:42:28)
Message:

Make sure that a thread with uninitialized TLS does not need to call malloc()
to initialize it.

For threads and tasks created by loader, we create TLS beforehand and pass
it to the child. For tasks spawned directly by the kernel, we require it is
a static executable and allocate the initial TLS using as_area_create() instead
of the libc allocator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/loader/main.c

    r0b05082 r40abf56  
    6262#include <vfs/inbox.h>
    6363
     64#ifdef CONFIG_RTLD
     65#include <rtld/rtld.h>
     66#endif
     67
    6468#define DPRINTF(...) ((void) 0)
    6569
     
    296300        DPRINTF("Loaded.\n");
    297301
     302#ifdef CONFIG_RTLD
     303        if (prog_info.env) {
     304                pcb.tcb = rtld_tls_make(prog_info.env);
     305        } else {
     306                pcb.tcb = tls_make(prog_info.finfo.base);
     307        }
     308#else
     309        pcb.tcb = tls_make(prog_info.finfo.base);
     310#endif
     311
    298312        elf_set_pcb(&prog_info, &pcb);
    299313
     
    328342        DPRINTF("Reply OK\n");
    329343        async_answer_0(req, EOK);
     344
    330345        DPRINTF("Jump to entry point at %p\n", pcb.entry);
     346
     347        __tcb_reset();
    331348        entry_point_jmp(prog_info.finfo.entry, &pcb);
    332349
Note: See TracChangeset for help on using the changeset viewer.