1 #if 0 2 #if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \ 3 || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 4 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 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 #else 30 extern pthread_t __pthread_self(); 31 #endif 32 33 #define TLS_ABOVE_TP 34 #define GAP_ABOVE_TP 8 35 #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread)) 36 37 #define MC_PC arm_pc 38