From 1c303981431e3b8542a874370971d50687c6e11a Mon Sep 17 00:00:00 2001 From: Raghu Gandham Date: Thu, 2 Aug 2012 17:47:37 -0700 Subject: [PATCH] [MIPS] Support for TLS register Change-Id: I6b5194e5e379b573e3b1203d8015e20fb3edd647 Signed-off-by: Chris Dearman --- libc/private/bionic_tls.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h index af19554ec..465886606 100644 --- a/libc/private/bionic_tls.h +++ b/libc/private/bionic_tls.h @@ -127,9 +127,20 @@ extern int __set_tls(void *ptr); # define __get_tls() ( *((volatile void **) 0xffff0ff0) ) # endif # endif /* !LIBC_STATIC */ -#else /* !ARM */ +#elif defined(__mips__) +# define __get_tls() \ + ({ 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; }) +#else extern void* __get_tls( void ); -#endif /* !ARM */ +#endif /* return the stack base and size, used by our malloc debugger */ extern void* __get_stack_base(int *p_stack_size);