#ifndef _TLS_H
#define _TLS_H 1
-#if defined USE_TLS && USE_TLS // l4
+
#ifndef __ASSEMBLER__
-# include <asm/prctl.h> /* For ARCH_SET_FS. */
+//l4/# include <asm/prctl.h> /* For ARCH_SET_FS. */
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
# include <stdlib.h>
-# include <sysdep.h>
+//l4/# include <sysdep.h>
# include <bits/kernel-features.h>
# include <bits/wordsize.h>
# include <xmmintrin.h>
#ifndef __ASSEMBLER__
/* Get system call information. */
-# include <sysdep.h>
+//l4/# include <sysdep.h>
/* Get the thread descriptor definition. */
# include <descr.h>
+# include <l4/sys/utcb.h>
+# include <l4/sys/segment.h>
#ifndef LOCK_PREFIX
# ifdef UP
__asm__ ("movl %0, %%fs" :: "q" (val))
+static inline char const *TLS_INIT_TP(void *thrdescr, int secondcall)
+{
+ (void)secondcall;
+ tcbhead_t *_head = (tcbhead_t *)thrdescr;
+ _head->tcb = thrdescr;
+ _head->self = thrdescr;
+ if (fiasco_amd64_set_fs(L4_INVALID_CAP, (l4_umword_t)thrdescr, l4_utcb()) < 0)
+ return "ERROR";
+
+ return NULL;
+}
+#if 0
/* Code to initially initialize the thread pointer. This might need
special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched.
\
_result ? "cannot set %fs base address for thread-local storage" : 0; \
})
+#endif
/* Return the address of the dtv for the current thread. */
#endif /* __ASSEMBLER__ */
-#endif /* L4 tls disable */
+
#endif /* tls.h */