1 #if defined(TRUSTY_USERSPACE)
2 #if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
3  || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
4 
__pthread_self()5 static inline pthread_t __pthread_self()
6 {
7 	char *p;
8 	__asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(p) );
9 	return (void *)(p-sizeof(struct pthread));
10 }
11 
12 #else
13 
14 #if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
15 #define BLX "mov lr,pc\n\tbx"
16 #else
17 #define BLX "blx"
18 #endif
19 
__pthread_self()20 static inline pthread_t __pthread_self()
21 {
22 	extern hidden uintptr_t __a_gettp_ptr;
23 	register uintptr_t p __asm__("r0");
24 	__asm__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" );
25 	return (void *)(p-sizeof(struct pthread));
26 }
27 
28 #endif
29 #endif
30 
31 #define TLS_ABOVE_TP
32 #define GAP_ABOVE_TP 8
33 #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
34 
35 #define MC_PC arm_pc
36