NPTL/arc: notify kernel of the TP value
[uClibc.git] / test / tls / tls-macros-arm.h
blob13d0f975214be36a7524f6537f2bd66b5cb5b6ce
1 #define TLS_LE(x) \
2 ({ int *__result; \
3 void *tp = __builtin_thread_pointer (); \
4 __asm__ ("ldr %0, 1f; " \
5 "add %0, %1, %0; " \
6 "b 2f; " \
7 "1: .word " #x "(tpoff); " \
8 "2: " \
9 : "=&r" (__result) : "r" (tp)); \
10 __result; })
12 #define TLS_IE(x) \
13 ({ int *__result; \
14 void *tp = __builtin_thread_pointer (); \
15 __asm__ ("ldr %0, 1f; " \
16 "3: ldr %0, [pc, %0];" \
17 "add %0, %1, %0; " \
18 "b 2f; " \
19 "1: .word " #x "(gottpoff) + (. - 3b - 8); " \
20 "2: " \
21 : "=&r" (__result) : "r" (tp)); \
22 __result; })
24 #define TLS_LD(x) \
25 ({ char *__result; \
26 int __offset; \
27 extern void *__tls_get_addr (void *); \
28 __asm__ ("ldr %0, 2f; " \
29 "1: add %0, pc, %0; " \
30 "b 3f; " \
31 "2: .word " #x "(tlsldm) + (. - 1b - 8); " \
32 "3: " \
33 : "=r" (__result)); \
34 __result = (char *)__tls_get_addr (__result); \
35 __asm__ ("ldr %0, 1f; " \
36 "b 2f; " \
37 "1: .word " #x "(tlsldo); " \
38 "2: " \
39 : "=r" (__offset)); \
40 (int *) (__result + __offset); })
42 #define TLS_GD(x) \
43 ({ int *__result; \
44 extern void *__tls_get_addr (void *); \
45 __asm__ ("ldr %0, 2f; " \
46 "1: add %0, pc, %0; " \
47 "b 3f; " \
48 "2: .word " #x "(tlsgd) + (. - 1b - 8); " \
49 "3: " \
50 : "=r" (__result)); \
51 (int *)__tls_get_addr (__result); })