summaryrefslogtreecommitdiffstats
path: root/libc/private/bionic_tls.h
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-10-08 18:50:24 -0700
committerElliott Hughes <enh@google.com>2013-10-09 13:39:13 -0700
commit2a0b873065edb304fa2d1c54f8de663ea638b8ab (patch)
tree4753b74b87e713379965bb051482036e6726afb1 /libc/private/bionic_tls.h
parent777a4ee6771e6fe3362ef4f24244a44fcd0aabe4 (diff)
downloadbionic-2a0b873065edb304fa2d1c54f8de663ea638b8ab.zip
bionic-2a0b873065edb304fa2d1c54f8de663ea638b8ab.tar.gz
bionic-2a0b873065edb304fa2d1c54f8de663ea638b8ab.tar.bz2
Fix __errno for LP64 and clean up __get_tls.
If __get_tls has the right type, a lot of confusing casting can disappear. It was probably a mistake that __get_tls was exposed as a function for mips and x86 (but not arm), so let's (a) ensure that the __get_tls function always matches the macro, (b) that we have the function for arm too, and (c) that we don't have the function for any 64-bit architecture. Change-Id: Ie9cb989b66e2006524ad7733eb6e1a65055463be
Diffstat (limited to 'libc/private/bionic_tls.h')
-rw-r--r--libc/private/bionic_tls.h41
1 files changed, 5 insertions, 36 deletions
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index 2e20364..a14bd3c 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -25,10 +25,12 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#ifndef _SYS_TLS_H
-#define _SYS_TLS_H
+
+#ifndef __BIONIC_PRIVATE_BIONIC_TLS_H_
+#define __BIONIC_PRIVATE_BIONIC_TLS_H_
#include <sys/cdefs.h>
+#include "__get_tls.h"
__BEGIN_DECLS
@@ -83,39 +85,6 @@ enum {
#define BIONIC_ALIGN(x, a) (((x) + (a - 1)) & ~(a - 1))
#define BIONIC_TLS_SLOTS BIONIC_ALIGN(128 + TLS_SLOT_FIRST_USER_SLOT + GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT, 4)
-/* syscall only, do not call directly */
-extern int __set_tls(void* ptr);
-
-/* get the TLS */
-#if defined(__arm__)
-# define __get_tls() \
- ({ unsigned int __val; \
- asm ("mrc p15, 0, %0, c13, c0, 3" : "=r"(__val)); \
- (volatile void*) __val; })
-#elif defined(__mips__)
-# define __get_tls() \
- /* On mips32r1, this goes via a kernel illegal instruction trap that's optimized for v1. */ \
- ({ register unsigned int __val asm("v1"); \
- asm (" .set push\n" \
- " .set mips32r2\n" \
- " rdhwr %0,$29\n" \
- " .set pop\n" : "=r"(__val)); \
- (volatile void*) __val; })
-#elif defined(__i386__)
-# define __get_tls() \
- ({ void* __val; \
- asm ("movl %%gs:0, %0" : "=r"(__val)); \
- (volatile void*) __val; })
-
-#elif defined(__x86_64__)
-# define __get_tls() \
- ({ void* __val; \
- asm ("mov %%fs:0, %0" : "=r"(__val)); \
- (volatile void*) __val; })
-#else
-#error unsupported architecture
-#endif
-
__END_DECLS
#if defined(__cplusplus)
@@ -123,4 +92,4 @@ class KernelArgumentBlock;
extern __LIBC_HIDDEN__ void __libc_init_tls(KernelArgumentBlock& args);
#endif
-#endif /* _SYS_TLS_H */
+#endif /* __BIONIC_PRIVATE_BIONIC_TLS_H_ */