summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_init.c
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2003-08-05 22:46:00 +0000
committerdeischen <deischen@FreeBSD.org>2003-08-05 22:46:00 +0000
commit73db9e759e57e01346011c961658790abf22719c (patch)
tree72d4a76c0fc38dbe53f86f2219914d854a838dbb /lib/libpthread/thread/thr_init.c
parente6b31b28140188d90a9dd49e4543af529f64843f (diff)
downloadFreeBSD-src-73db9e759e57e01346011c961658790abf22719c.zip
FreeBSD-src-73db9e759e57e01346011c961658790abf22719c.tar.gz
Rethink the MD interfaces for libpthread to account for
archs that can (or are required to) have per-thread registers. Tested on i386, amd64; marcel is testing on ia64 and will have some follow-up commits. Reviewed by: davidxu
Diffstat (limited to 'lib/libpthread/thread/thr_init.c')
-rw-r--r--lib/libpthread/thread/thr_init.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c
index 5c31ae7..f9e0d9b 100644
--- a/lib/libpthread/thread/thr_init.c
+++ b/lib/libpthread/thread/thr_init.c
@@ -68,7 +68,6 @@
#include "libc_private.h"
#include "thr_private.h"
-#include "ksd.h"
int __pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
int __pthread_mutex_lock(pthread_mutex_t *);
@@ -306,12 +305,10 @@ _libpthread_init(struct pthread *curthread)
KSEG_THRQ_ADD(_kse_initial->k_kseg, _thr_initial);
/* Setup the KSE/thread specific data for the current KSE/thread. */
- if (_ksd_setprivate(&_thr_initial->kse->k_ksd) != 0)
- PANIC("Can't set initial KSE specific data");
- _set_curkse(_thr_initial->kse);
_thr_initial->kse->k_curthread = _thr_initial;
+ _kcb_set(_thr_initial->kse->k_kcb);
+ _tcb_set(_thr_initial->kse->k_kcb, _thr_initial->tcb);
_thr_initial->kse->k_flags |= KF_INITIALIZED;
- _kse_initial->k_curthread = _thr_initial;
_thr_rtld_init();
}
@@ -323,14 +320,8 @@ _libpthread_init(struct pthread *curthread)
static void
init_main_thread(struct pthread *thread)
{
- void *p;
int i;
- /* Zero the initial thread structure. */
- p = thread->alloc_addr;
- memset(thread, 0, sizeof(struct pthread));
- thread->alloc_addr = p;
-
/* Setup the thread attributes. */
thread->attr = _pthread_attr_default;
#ifdef SYSTEM_SCOPE_ONLY
@@ -381,9 +372,11 @@ init_main_thread(struct pthread *thread)
* Set up the thread mailbox. The threads saved context
* is also in the mailbox.
*/
- thread->tmbx.tm_udata = thread;
- thread->tmbx.tm_context.uc_stack.ss_size = thread->attr.stacksize_attr;
- thread->tmbx.tm_context.uc_stack.ss_sp = thread->attr.stackaddr_attr;
+ thread->tcb->tcb_tmbx.tm_udata = thread;
+ thread->tcb->tcb_tmbx.tm_context.uc_stack.ss_size =
+ thread->attr.stacksize_attr;
+ thread->tcb->tcb_tmbx.tm_context.uc_stack.ss_sp =
+ thread->attr.stackaddr_attr;
/* Default the priority of the initial thread: */
thread->base_priority = THR_DEFAULT_PRIORITY;
OpenPOWER on IntegriCloud