From 194d3fa048cf909ca592dd56fa538dc9cd3f5ddb Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Queru Date: Thu, 12 Nov 2009 18:45:14 -0800 Subject: eclair snapshot --- libc/private/bionic_tls.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libc/private/bionic_tls.h') diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h index 82c8cd9..2e7a82b 100644 --- a/libc/private/bionic_tls.h +++ b/libc/private/bionic_tls.h @@ -88,7 +88,18 @@ extern int __set_tls(void *ptr); /* get the TLS */ #ifdef __arm__ -# define __get_tls() ( *((volatile void **) 0xffff0ff0) ) +/* 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 -- cgit v1.1