ec77a8337b10991b54df11896dbed015175a67a3
[musl] / arch / arm / pthread_arch.h
1 #if __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__ \
2  || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ \
3  || __ARM_ARCH >= 7
4
5 static inline __attribute__((const)) pthread_t __pthread_self()
6 {
7         char *p;
8         __asm__( "mrc p15,0,%0,c13,c0,3" : "=r"(p) );
9         return (void *)(p+8-sizeof(struct pthread));
10 }
11
12 #else
13
14 typedef char *(*__ptr_func_t)(void) __attribute__((const));
15 #define __pthread_self() \
16         ((pthread_t)(((__ptr_func_t)0xffff0fe0)()+8-sizeof(struct pthread)))
17
18 #endif
19
20 #define TLS_ABOVE_TP
21 #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8)
22
23 #define CANCEL_REG_IP 18