diff options
author | David 'Digit' Turner <digit@google.com> | 2009-09-22 15:41:36 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2009-09-22 15:41:36 -0700 |
commit | 7910e39d197bc32ed79a144d06279c2be3c7f296 (patch) | |
tree | 2be732d00b499cd6d2e1be8084ba81730ca6c113 | |
parent | 7ed086eb99a0dc326bf47fb387fa8be394fe3da4 (diff) | |
parent | 4a05d12cf52a9a40759f11f28543bd75715c8f00 (diff) | |
download | bionic-7910e39d197bc32ed79a144d06279c2be3c7f296.zip bionic-7910e39d197bc32ed79a144d06279c2be3c7f296.tar.gz bionic-7910e39d197bc32ed79a144d06279c2be3c7f296.tar.bz2 |
resolved conflicts for merge of 4a05d12c to eclair-plus-aosp
-rw-r--r-- | libc/Android.mk | 10 | ||||
-rw-r--r-- | libc/private/bionic_tls.h | 16 |
2 files changed, 23 insertions, 3 deletions
diff --git a/libc/Android.mk b/libc/Android.mk index 59a4c6b..12d5c92 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -366,6 +366,16 @@ endif ifeq ($(TARGET_ARCH),arm) libc_common_cflags += -fstrict-aliasing libc_crt_target_cflags := -mthumb-interwork + # + # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library + # that it should access the hardware TLS register directly in + # private/bionic_tls.h + # + # The value must match your kernel configuration + # + ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + libc_common_cflags += -DHAVE_ARM_TLS_REGISTER + endif else # !arm ifeq ($(TARGET_ARCH),x86) libc_crt_target_cflags := -m32 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 |