Back to index

glibc  2.9
tls-macros.h
Go to the documentation of this file.
00001 #define TLS_LE(x)                                \
00002   ({ int *__result;                              \
00003      void *tp = __builtin_thread_pointer ();            \
00004      asm ("ldr %0, 1f; "                         \
00005          "add %0, %1, %0; "                      \
00006          "b 2f; "                                \
00007          "1: .word " #x "(tpoff); "                     \
00008          "2: "                                          \
00009          : "=&r" (__result) : "r" (tp));         \
00010      __result; })
00011 
00012 #define TLS_IE(x)                                \
00013   ({ int *__result;                              \
00014      void *tp = __builtin_thread_pointer ();            \
00015      asm ("ldr %0, 1f; "                         \
00016          "3: ldr %0, [pc, %0];"                  \
00017          "add %0, %1, %0; "                      \
00018          "b 2f; "                                \
00019          "1: .word " #x "(gottpoff) + (. - 3b - 8); "   \
00020          "2: "                                          \
00021          : "=&r" (__result) : "r" (tp));         \
00022      __result; })
00023 
00024 #define TLS_LD(x)                                \
00025   ({ char *__result;                             \
00026      int __offset;                               \
00027      extern void *__tls_get_addr (void *);              \
00028      asm ("ldr %0, 2f; "                         \
00029          "1: add %0, pc, %0; "                          \
00030          "b 3f; "                                \
00031          "2: .word " #x "(tlsldm) + (. - 1b - 8); "     \
00032          "3: "                                          \
00033          : "=r" (__result));                            \
00034      __result = (char *)__tls_get_addr (__result);      \
00035      asm ("ldr %0, 1f; "                         \
00036          "b 2f; "                                \
00037          "1: .word " #x "(tlsldo); "                    \
00038          "2: "                                          \
00039          : "=r" (__offset));                            \
00040      (int *) (__result + __offset); })
00041 
00042 #define TLS_GD(x)                                \
00043   ({ int *__result;                              \
00044      extern void *__tls_get_addr (void *);              \
00045      asm ("ldr %0, 2f; "                         \
00046          "1: add %0, pc, %0; "                          \
00047          "b 3f; "                                \
00048          "2: .word " #x "(tlsgd) + (. - 1b - 8); "      \
00049          "3: "                                          \
00050          : "=r" (__result));                            \
00051      (int *)__tls_get_addr (__result); })