Andrew Top | 286dd78 | 2018-10-02 16:52:45 -0700 | [diff] [blame] | 1 | /* or1k use variant I, but with the twist that tp points to the end of TCB */ |
| 2 | static inline struct pthread *__pthread_self() |
| 3 | { |
| 4 | #ifdef __clang__ |
| 5 | char *tp; |
| 6 | __asm__ __volatile__ ("l.ori %0, r10, 0" : "=r" (tp) ); |
| 7 | #else |
| 8 | register char *tp __asm__("r10"); |
| 9 | __asm__ __volatile__ ("" : "=r" (tp) ); |
| 10 | #endif |
| 11 | return (struct pthread *) (tp - sizeof(struct pthread)); |
| 12 | } |
| 13 | |
| 14 | #define TLS_ABOVE_TP |
| 15 | #define GAP_ABOVE_TP 0 |
| 16 | #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread)) |
| 17 | |
| 18 | #define MC_PC regs.pc |