File: tls-macros.h

package info (click to toggle)
glibc 2.19-18+deb8u7
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 204,748 kB
  • sloc: ansic: 970,427; asm: 241,207; sh: 10,069; makefile: 8,476; cpp: 3,595; perl: 2,077; pascal: 1,839; awk: 1,704; yacc: 317; sed: 73
file content (39 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (26)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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; })