about summary refs log tree commit diff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-07-17 11:30:58 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-07-17 11:30:58 +0000
commitcfc82fd8ac7f910f19b02feed84b68c2e3a3d927 (patch)
tree9977bd58e47d74b8d44bedd3459c47855e4ad890 /sysdeps/x86_64
parent07cbfc23683827c1b92d0bc62b15a77a48b09a17 (diff)
downloadglibc-cfc82fd8ac7f910f19b02feed84b68c2e3a3d927.tar.gz
glibc-cfc82fd8ac7f910f19b02feed84b68c2e3a3d927.tar.xz
glibc-cfc82fd8ac7f910f19b02feed84b68c2e3a3d927.zip
Split tls-macros.h into sysdeps directories.
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/tls-macros.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/sysdeps/x86_64/tls-macros.h b/sysdeps/x86_64/tls-macros.h
new file mode 100644
index 0000000000..22d2a4b592
--- /dev/null
+++ b/sysdeps/x86_64/tls-macros.h
@@ -0,0 +1,39 @@
+#define TLS_LE(x) \
+  ({ int *__l;								      \
+     asm ("mov %%fs:0,%0\n\t"						      \
+	  "lea " #x "@tpoff(%0), %0"					      \
+	  : "=r" (__l));						      \
+     __l; })
+
+#define TLS_IE(x) \
+  ({ int *__l;								      \
+     asm ("mov %%fs:0,%0\n\t"						      \
+	  "add " #x "@gottpoff(%%rip),%0"				      \
+	  : "=r" (__l));						      \
+     __l; })
+
+#define TLS_LD(x) \
+  ({ int *__l, __c, __d;						      \
+     asm ("leaq " #x "@tlsld(%%rip),%%rdi\n\t"				      \
+	  "call __tls_get_addr@plt\n\t"					      \
+	  "leaq " #x "@dtpoff(%%rax), %%rax"				      \
+	  : "=a" (__l), "=&c" (__c), "=&d" (__d)			      \
+	  : : "rdi", "rsi", "r8", "r9", "r10", "r11"); 			      \
+     __l; })
+
+#ifdef __ILP32__
+# define TLS_GD_PREFIX
+#else
+# define TLS_GD_PREFIX	".byte 0x66\n\t"
+#endif
+
+#define TLS_GD(x) \
+  ({ int *__l, __c, __d;						      \
+     asm (TLS_GD_PREFIX							      \
+	  "leaq " #x "@tlsgd(%%rip),%%rdi\n\t"				      \
+	  ".word 0x6666\n\t"						      \
+	  "rex64\n\t"							      \
+	  "call __tls_get_addr@plt"					      \
+	  : "=a" (__l), "=&c" (__c), "=&d" (__d)			      \
+	  : : "rdi", "rsi", "r8", "r9", "r10", "r11"); 			      \
+     __l; })