]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/uclibc/lib/libpthread/src/sysdeps/x86_64/tls.h
update
[l4.git] / l4 / pkg / uclibc / lib / libpthread / src / sysdeps / x86_64 / tls.h
index 2cd8f32cf3d514a93fc35fe05b08553e5b52d9e1..91f6eb801e90efe354a6a8953711727d48547b26 100644 (file)
 
 #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>
@@ -94,11 +94,13 @@ typedef struct
 
 #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
@@ -154,6 +156,18 @@ typedef struct
   __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.
@@ -179,6 +193,7 @@ typedef struct
                                                                              \
     _result ? "cannot set %fs base address for thread-local storage" : 0;     \
   })
+#endif
 
 
 /* Return the address of the dtv for the current thread.  */
@@ -434,5 +449,5 @@ extern void _dl_x86_64_restore_sse (void);
 
 
 #endif /* __ASSEMBLER__ */
-#endif /* L4 tls disable */
+
 #endif /* tls.h */