diff --git a/lib/libthr/arch/amd64/amd64/pthread_md.c b/lib/libthr/arch/amd64/amd64/pthread_md.c index d2477df82506..b661657b44c2 100644 --- a/lib/libthr/arch/amd64/amd64/pthread_md.c +++ b/lib/libthr/arch/amd64/amd64/pthread_md.c @@ -38,13 +38,11 @@ struct tcb * _tcb_ctor(struct pthread *thread, int initial) { struct tcb *tcb; - void *oldtls; if (initial) - __asm __volatile("movq %%fs:0, %0" : "=r" (oldtls)); + __asm __volatile("movq %%fs:0, %0" : "=r" (tcb)); else - oldtls = NULL; - tcb = _rtld_allocate_tls(oldtls, sizeof(struct tcb), 16); + tcb = _rtld_allocate_tls(NULL, sizeof(struct tcb), 16); if (tcb) tcb->tcb_thread = thread; return (tcb); diff --git a/lib/libthr/arch/amd64/include/pthread_md.h b/lib/libthr/arch/amd64/include/pthread_md.h index 4500f6b51e2f..d12d6e45935d 100644 --- a/lib/libthr/arch/amd64/include/pthread_md.h +++ b/lib/libthr/arch/amd64/include/pthread_md.h @@ -96,8 +96,6 @@ extern struct pthread *_thr_initial; static __inline struct pthread * _get_curthread(void) { - if (_thr_initial) - return (TCB_GET64(tcb_thread)); - return (NULL); + return (TCB_GET64(tcb_thread)); } #endif diff --git a/lib/libthr/arch/i386/i386/pthread_md.c b/lib/libthr/arch/i386/i386/pthread_md.c index 20e76c84066d..a8b31d503ea7 100644 --- a/lib/libthr/arch/i386/i386/pthread_md.c +++ b/lib/libthr/arch/i386/i386/pthread_md.c @@ -39,14 +39,11 @@ struct tcb * _tcb_ctor(struct pthread *thread, int initial) { struct tcb *tcb; - void *oldtls; if (initial) - __asm __volatile("movl %%gs:0, %0" : "=r" (oldtls)); + __asm __volatile("movl %%gs:0, %0" : "=r" (tcb)); else - oldtls = NULL; - - tcb = _rtld_allocate_tls(oldtls, sizeof(struct tcb), 16); + tcb = _rtld_allocate_tls(NULL, sizeof(struct tcb), 16); if (tcb) tcb->tcb_thread = thread; return (tcb); diff --git a/lib/libthr/arch/i386/include/pthread_md.h b/lib/libthr/arch/i386/include/pthread_md.h index 2a17cccd68f4..f3ea4cb87bd9 100644 --- a/lib/libthr/arch/i386/include/pthread_md.h +++ b/lib/libthr/arch/i386/include/pthread_md.h @@ -100,8 +100,6 @@ extern struct pthread *_thr_initial; static __inline struct pthread * _get_curthread(void) { - if (_thr_initial) - return (TCB_GET32(tcb_thread)); - return (NULL); + return (TCB_GET32(tcb_thread)); } #endif