Rich Felker | 8393357 | 2016-03-06 17:41:56 +0000 | [diff] [blame] | 1 | static inline struct pthread *__pthread_self() |
| 2 | { |
Rich Felker | 6d99ad9 | 2016-04-03 10:42:37 +0000 | [diff] [blame^] | 3 | #if __mips_isa_rev < 2 |
Rich Felker | 8393357 | 2016-03-06 17:41:56 +0000 | [diff] [blame] | 4 | register char *tp __asm__("$3"); |
| 5 | __asm__ __volatile__ (".word 0x7c03e83b" : "=r" (tp) ); |
Rich Felker | 6d99ad9 | 2016-04-03 10:42:37 +0000 | [diff] [blame^] | 6 | #else |
| 7 | char *tp; |
| 8 | __asm__ __volatile__ ("rdhwr %0, $29" : "=r" (tp) ); |
Rich Felker | 8393357 | 2016-03-06 17:41:56 +0000 | [diff] [blame] | 9 | #endif |
| 10 | return (pthread_t)(tp - 0x7000 - sizeof(struct pthread)); |
| 11 | } |
| 12 | |
| 13 | #define TLS_ABOVE_TP |
| 14 | #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000) |
| 15 | |
| 16 | #define DTP_OFFSET 0x8000 |
| 17 | |
| 18 | #define MC_PC pc |