1 /* Macros to support TLS testing in times of missing compiler support. */
3 #define COMMON_INT_DEF(x) \
4 asm (".tls_common " #x ",4,4")
5 /* XXX Until we get compiler support we don't need declarations. */
6 #define COMMON_INT_DECL(x)
8 /* XXX This definition will probably be machine specific, too. */
9 #define VAR_INT_DEF(x) \
10 asm (".section .tdata\n\t" \
13 ".size " #x ",4\n\t" \
15 /* XXX Until we get compiler support we don't need declarations. */
16 #define VAR_INT_DECL(x)
19 /* XXX Each architecture must have its own asm for now. */
23 asm ("movl %%gs:0,%0\n\t" \
24 "subl $" #x "@tpoff,%0" \
31 asm ("movl %%gs:0,%0\n\t" \
32 "subl " #x "@gottpoff(%%ebx),%0" \
40 "1:\tmovl (%%esp), %%ebx\n\t" \
43 "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
44 "movl %%gs:0,%0\n\t" \
45 "subl " #x "@gottpoff(%%ebx),%0" \
46 : "=r" (__l), "=&b" (__b)); \
52 ({ int *__l, __c, __d; \
53 asm ("leal " #x "@tlsldm(%%ebx),%%eax\n\t" \
54 "call ___tls_get_addr@plt\n\t" \
55 "leal " #x "@dtpoff(%%eax), %%eax" \
56 : "=a" (__l), "=&c" (__c), "=&d" (__d)); \
60 ({ int *__l, __b, __c, __d; \
63 "1:\tmovl (%%esp), %%ebx\n\t" \
66 "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
67 "leal " #x "@tlsldm(%%ebx),%%eax\n\t" \
68 "call ___tls_get_addr@plt\n\t" \
69 "leal " #x "@dtpoff(%%eax), %%eax" \
70 : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d)); \
76 ({ int *__l, __c, __d; \
77 asm ("leal " #x "@tlsgd(%%ebx),%%eax\n\t" \
78 "call ___tls_get_addr@plt\n\t" \
80 : "=a" (__l), "=&c" (__c), "=&d" (__d)); \
84 ({ int *__l, __b, __c, __d; \
87 "1:\tmovl (%%esp), %%ebx\n\t" \
90 "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
91 "leal " #x "@tlsgd(%%ebx),%%eax\n\t" \
92 "call ___tls_get_addr@plt\n\t" \
94 : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d)); \
98 #elif defined __x86_64__
102 asm ("movq %%fs:0,%0\n\t" \
103 "leaq " #x "@tpoff(%0), %0" \
109 asm ("movq %%fs:0,%0\n\t" \
110 "addq " #x "@gottpoff(%%rip),%0" \
115 ({ int *__l, __c, __d; \
116 asm ("leaq " #x "@tlsld(%%rip),%%rdi\n\t" \
117 "call __tls_get_addr@plt\n\t" \
118 "leaq " #x "@dtpoff(%%rax), %%rax" \
119 : "=a" (__l), "=&c" (__c), "=&d" (__d) \
120 : : "rdi", "rsi", "r8", "r9", "r10", "r11"); \
124 ({ int *__l, __c, __d; \
125 asm (".long 0x66666666\n\t" \
126 "leaq " #x "@tlsgd(%%rip),%%rdi\n\t" \
127 "call __tls_get_addr@plt" \
128 : "=a" (__l), "=&c" (__c), "=&d" (__d) \
129 : : "rdi", "rsi", "r8", "r9", "r10", "r11"); \
135 ({ int *__l; void *__tp; \
136 asm ("stc gbr,%1\n\t" \
141 "1: .long " #x "@tpoff\n\t" \
143 : "=r" (__l), "=r" (__tp)); \
147 ({ int *__l; void *__tp; \
148 asm ("mova 0f,r0\n\t" \
153 "mov.l @(r0,r12),%0\n\t" \
157 "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \
158 "1: .long " #x "@gottpoff\n\t" \
160 : "=r" (__l), "=r" (__tp) : : "r0", "r12"); \
165 asm ("mova 0f,r0\n\t" \
178 "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \
179 "1: .long " #x "@tlsldm\n\t" \
180 "2: .long __tls_get_addr@plt\n\t" \
181 "3: .long " #x "@dtpoff\n\t" \
183 : "=r" (__l) : : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
189 asm ("mova 0f,r0\n\t" \
201 "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \
202 "1: .long " #x "@tlsgd\n\t" \
203 "2: .long __tls_get_addr@plt\n\t" \
205 : "=r" (__l) : : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
210 # error "No support for this architecture so far."