Add pthread tls api

This commit is contained in:
Justine Tunney 2022-06-22 06:37:45 -07:00
parent 0e773e23ad
commit 9545062175
15 changed files with 333 additions and 7 deletions

View file

@ -29,7 +29,7 @@
#include "libc/sysv/consts/prot.h"
#include "libc/thread/thread.h"
static textstartup void _main_thread_init(void) {
textstartup void _main_thread_init(void) {
_Static_assert(offsetof(struct cthread_descriptor_t, self) == 0x00, "");
_Static_assert(offsetof(struct cthread_descriptor_t, self2) == 0x30, "");
_Static_assert(offsetof(struct cthread_descriptor_t, tid) == 0x38, "");
@ -65,10 +65,4 @@ static textstartup void _main_thread_init(void) {
// Set FS
__install_tls((char *)td);
assert(cthread_self()->tid == gettid());
__threaded = true;
}
const void *const _main_thread_ctor[] initarray = {
_main_thread_init,
};