am 621df526: am 31e72bc3: bionic: fix __get_tls( ) crash issue

* commit '621df52644cc19001688c0964ad425c5ed6c8990':
  bionic: fix __get_tls( ) crash issue
This commit is contained in:
Jack Ren 2011-11-30 10:50:58 -08:00 committed by Android Git Automerger
commit 338a06f4bc

View File

@ -60,6 +60,8 @@ static struct user_desc _tls_desc =
0
};
static pthread_mutex_t _tls_desc_lock = PTHREAD_MUTEX_INITIALIZER;
struct _thread_area_head {
void *self;
};
@ -71,6 +73,7 @@ int __set_tls(void *ptr)
{
int rc, segment;
pthread_mutex_lock(&_tls_desc_lock);
_tls_desc.base_addr = (unsigned long)ptr;
/* We also need to write the location of the tls to ptr[0] */
@ -88,6 +91,8 @@ int __set_tls(void *ptr)
asm __volatile__ (
" movw %w0, %%gs" :: "q"(segment)
);
pthread_mutex_unlock(&_tls_desc_lock);
return 0;
}