2018-04-19 01:51:43 +00:00
|
|
|
#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|
2014-04-30 19:32:11 +00:00
|
|
|
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
|
2014-04-07 08:03:18 +00:00
|
|
|
|
2015-10-15 04:20:50 +00:00
|
|
|
static inline pthread_t __pthread_self()
|
2014-04-07 08:03:18 +00:00
|
|
|
{
|
|
|
|
char *p;
|
2018-10-16 18:08:01 +00:00
|
|
|
__asm__ ( "mrc p15,0,%0,c13,c0,3" : "=r"(p) );
|
2018-06-01 23:52:01 +00:00
|
|
|
return (void *)(p-sizeof(struct pthread));
|
2014-04-07 08:03:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2012-02-25 07:52:18 +00:00
|
|
|
|
2016-12-19 00:38:53 +00:00
|
|
|
#if __ARM_ARCH_4__ || __ARM_ARCH_4T__ || __ARM_ARCH == 4
|
|
|
|
#define BLX "mov lr,pc\n\tbx"
|
2014-11-19 05:40:32 +00:00
|
|
|
#else
|
2016-12-19 00:38:53 +00:00
|
|
|
#define BLX "blx"
|
2014-11-19 05:40:32 +00:00
|
|
|
#endif
|
2016-12-19 00:38:53 +00:00
|
|
|
|
|
|
|
static inline pthread_t __pthread_self()
|
|
|
|
{
|
2018-09-05 16:43:34 +00:00
|
|
|
extern hidden uintptr_t __a_gettp_ptr;
|
2016-12-19 00:38:53 +00:00
|
|
|
register uintptr_t p __asm__("r0");
|
2018-10-16 18:08:01 +00:00
|
|
|
__asm__ ( BLX " %1" : "=r"(p) : "r"(__a_gettp_ptr) : "cc", "lr" );
|
2018-06-01 23:52:01 +00:00
|
|
|
return (void *)(p-sizeof(struct pthread));
|
2014-11-19 05:40:32 +00:00
|
|
|
}
|
2012-10-15 22:51:53 +00:00
|
|
|
|
2014-04-07 08:03:18 +00:00
|
|
|
#endif
|
|
|
|
|
2012-10-15 22:51:53 +00:00
|
|
|
#define TLS_ABOVE_TP
|
2018-06-01 23:52:01 +00:00
|
|
|
#define GAP_ABOVE_TP 8
|
|
|
|
#define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread))
|
2011-09-18 20:44:54 +00:00
|
|
|
|
2015-11-02 17:39:28 +00:00
|
|
|
#define MC_PC arm_pc
|