diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-04-04 03:26:06 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-04-04 03:26:06 +0000 |
commit | 8bff50a485059fe12389243cff1a7c87c1106531 (patch) | |
tree | aa51415180b41bdb161e607aed018f1da6c064a9 | |
parent | 60609380bc28101514b8b5e88a2182bb37a9e6ff (diff) | |
download | FreeBSD-src-8bff50a485059fe12389243cff1a7c87c1106531.zip FreeBSD-src-8bff50a485059fe12389243cff1a7c87c1106531.tar.gz |
Simplify _get_curthread() and _tcb_ctor because libc and rtld now
already allocate thread pointer space in tls block for initial thread.
Only i386 and amd64 have been done, others still have to be tested.
-rw-r--r-- | lib/libthr/arch/amd64/amd64/pthread_md.c | 6 | ||||
-rw-r--r-- | lib/libthr/arch/amd64/include/pthread_md.h | 4 | ||||
-rw-r--r-- | lib/libthr/arch/i386/i386/pthread_md.c | 7 | ||||
-rw-r--r-- | lib/libthr/arch/i386/include/pthread_md.h | 4 |
4 files changed, 6 insertions, 15 deletions
diff --git a/lib/libthr/arch/amd64/amd64/pthread_md.c b/lib/libthr/arch/amd64/amd64/pthread_md.c index d2477df..b661657 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 4500f6b..d12d6e4 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 20e76c8..a8b31d5 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 2a17ccc..f3ea4cb 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 |