]> git.proxmox.com Git - wasi-libc.git/blame - libc-top-half/musl/arch/mips/pthread_arch.h
WASI libc prototype implementation.
[wasi-libc.git] / libc-top-half / musl / arch / mips / pthread_arch.h
CommitLineData
320054e8
DG
1static inline struct pthread *__pthread_self()
2{
3#if __mips_isa_rev < 2
4 register char *tp __asm__("$3");
5 __asm__ (".word 0x7c03e83b" : "=r" (tp) );
6#else
7 char *tp;
8 __asm__ ("rdhwr %0, $29" : "=r" (tp) );
9#endif
10 return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
11}
12
13#define TLS_ABOVE_TP
14#define GAP_ABOVE_TP 0
15#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
16
17#define DTP_OFFSET 0x8000
18
19#define MC_PC pc