summaryrefslogtreecommitdiffstats
path: root/libc/private/bionic_tls.h
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2009-11-15 12:05:31 -0800
committerJean-Baptiste Queru <jbq@google.com>2009-11-15 12:05:31 -0800
commit95604529ec25fe7923ba88312c590f38aa5e3d9e (patch)
treec6f1dd860fcdc273ab21b696778987261f6e4fa8 /libc/private/bionic_tls.h
parent71c0aeb44f2301af85d6a370dbd7308602a1dfe0 (diff)
parent194d3fa048cf909ca592dd56fa538dc9cd3f5ddb (diff)
downloadbionic-95604529ec25fe7923ba88312c590f38aa5e3d9e.zip
bionic-95604529ec25fe7923ba88312c590f38aa5e3d9e.tar.gz
bionic-95604529ec25fe7923ba88312c590f38aa5e3d9e.tar.bz2
merge from eclair
Diffstat (limited to 'libc/private/bionic_tls.h')
-rw-r--r--libc/private/bionic_tls.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index 742ef8c..2412577 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -87,10 +87,20 @@ extern void __init_tls(void** tls, void* thread_info);
extern int __set_tls(void *ptr);
/* get the TLS */
-/* Linux kernel helpers for its TLS implementation */
#ifdef __arm__
-typedef void* (__kernel_get_tls_t)(void);
-#define __get_tls (*(__kernel_get_tls_t *)0xffff0fe0)
+/* Linux kernel helpers for its TLS implementation */
+/* For performance reasons, avoid calling the kernel helper
+ * Note that HAVE_ARM_TLS_REGISTER is build-specific
+ * (it must match your kernel configuration)
+ */
+# ifdef HAVE_ARM_TLS_REGISTER
+# define __get_tls() \
+ ({ register unsigned int __val asm("r0"); \
+ asm ("mrc p15, 0, r0, c13, c0, 3" : "=r"(__val) ); \
+ (volatile void*)__val; })
+# else /* !HAVE_ARM_TLS_REGISTER */
+# define __get_tls() ( *((volatile void **) 0xffff0ff0) )
+# endif
#else
extern void* __get_tls( void );
#endif