1 #include "pthread_impl.h"
5 /* Also perform sh-specific init */
7 #define CPU_HAS_LLSC 0x0040
8 #define CPU_HAS_CAS_L 0x0400
10 __attribute__((__visibility__("hidden")))
11 extern const char __sh_cas_gusa[], __sh_cas_llsc[], __sh_cas_imask[], __sh_cas_cas_l[];
13 __attribute__((__visibility__("hidden")))
14 const void *__sh_cas_ptr;
16 __attribute__((__visibility__("hidden")))
19 int __set_thread_area(void *p)
22 __asm__ __volatile__ ( "ldc %0, gbr" : : "r"(p) : "memory" );
24 __sh_cas_ptr = __sh_cas_gusa;
25 #if !defined(__SH3__) && !defined(__SH4__)
26 for (aux=libc.auxv; *aux; aux+=2) {
27 if (*aux != AT_PLATFORM) continue;
28 const char *s = (void *)aux[1];
29 if (s[0]!='s' || s[1]!='h' || s[2]!='2' || s[3]-'0'<10u) break;
30 __sh_cas_ptr = __sh_cas_imask;
34 if (__hwcap & CPU_HAS_CAS_L)
35 __sh_cas_ptr = __sh_cas_cas_l;
36 else if (__hwcap & CPU_HAS_LLSC)
37 __sh_cas_ptr = __sh_cas_llsc;