2012-07-11 08:22:13 +00:00
|
|
|
static inline struct pthread *__pthread_self()
|
|
|
|
{
|
2012-09-07 16:18:14 +00:00
|
|
|
#ifdef __clang__
|
2012-10-15 22:51:53 +00:00
|
|
|
char *tp;
|
|
|
|
__asm__ __volatile__ (".word 0x7c03e83b ; move %0, $3" : "=r" (tp) : : "$3" );
|
2012-09-07 16:18:14 +00:00
|
|
|
#else
|
2012-10-15 22:51:53 +00:00
|
|
|
register char *tp __asm__("$3");
|
|
|
|
__asm__ __volatile__ (".word 0x7c03e83b" : "=r" (tp) );
|
2012-09-07 16:18:14 +00:00
|
|
|
#endif
|
2012-10-15 22:51:53 +00:00
|
|
|
return (pthread_t)(tp - 0x7000 - sizeof(struct pthread));
|
2012-07-11 08:22:13 +00:00
|
|
|
}
|
|
|
|
|
2012-10-15 22:51:53 +00:00
|
|
|
#define TLS_ABOVE_TP
|
|
|
|
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) + 0x7000)
|
|
|
|
|
2012-07-13 01:49:30 +00:00
|
|
|
#define CANCEL_REG_IP (3-(union {int __i; char __b;}){1}.__b)
|