OLD | NEW |
1 #if ((__ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) \ | 1 #if ((__ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) || \ |
2 || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 | 2 __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7 |
3 | 3 |
4 static inline pthread_t __pthread_self() | 4 static inline pthread_t __pthread_self() { |
5 { | 5 char* p; |
6 » char *p; | 6 __asm__ __volatile__("mrc p15,0,%0,c13,c0,3" : "=r"(p)); |
7 » __asm__ __volatile__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(p) ); | 7 return (void*)(p + 8 - sizeof(struct pthread)); |
8 » return (void *)(p+8-sizeof(struct pthread)); | |
9 } | 8 } |
10 | 9 |
11 #else | 10 #else |
12 | 11 |
13 static inline pthread_t __pthread_self() | 12 static inline pthread_t __pthread_self() { |
14 { | |
15 #ifdef __clang__ | 13 #ifdef __clang__ |
16 » char *p; | 14 char* p; |
17 » __asm__ __volatile__ ( "bl __a_gettp\n\tmov %0,r0" : "=r"(p) : : "cc", "
r0", "lr" ); | 15 __asm__ __volatile__("bl __a_gettp\n\tmov %0,r0" |
| 16 : "=r"(p) |
| 17 : |
| 18 : "cc", "r0", "lr"); |
18 #else | 19 #else |
19 » register char *p __asm__("r0"); | 20 register char* p __asm__("r0"); |
20 » __asm__ __volatile__ ( "bl __a_gettp" : "=r"(p) : : "cc", "lr" ); | 21 __asm__ __volatile__("bl __a_gettp" : "=r"(p) : : "cc", "lr"); |
21 #endif | 22 #endif |
22 » return (void *)(p+8-sizeof(struct pthread)); | 23 return (void*)(p + 8 - sizeof(struct pthread)); |
23 } | 24 } |
24 | 25 |
25 #endif | 26 #endif |
26 | 27 |
27 #define TLS_ABOVE_TP | 28 #define TLS_ABOVE_TP |
28 #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8) | 29 #define TP_ADJ(p) ((char*)(p) + sizeof(struct pthread) - 8) |
29 | 30 |
30 #define MC_PC arm_pc | 31 #define MC_PC arm_pc |
OLD | NEW |