thread: move clear_child_tid, etc. to main structure
This commit is contained in:
@ -1340,7 +1340,7 @@ ihk_mc_user_context_t *lookup_user_context(struct thread *thread)
|
||||
}
|
||||
|
||||
if (!uctx->is_sr_valid) {
|
||||
uctx->sr.fs_base = thread->thread.tlsblock_base;
|
||||
uctx->sr.fs_base = thread->tlsblock_base;
|
||||
uctx->sr.gs_base = 0;
|
||||
uctx->sr.ds = 0;
|
||||
uctx->sr.es = 0;
|
||||
|
||||
@ -485,10 +485,8 @@ struct thread {
|
||||
|
||||
ihk_atomic_t refcount;
|
||||
|
||||
struct {
|
||||
int *clear_child_tid;
|
||||
unsigned long tlsblock_base, tlsblock_limit;
|
||||
} thread;
|
||||
int *clear_child_tid;
|
||||
unsigned long tlsblock_base, tlsblock_limit;
|
||||
|
||||
// thread info
|
||||
cpu_set_t cpu_set;
|
||||
|
||||
@ -2581,10 +2581,10 @@ redo:
|
||||
ihk_mc_load_page_table(next->vm->address_space->page_table);
|
||||
|
||||
dkprintf("[%d] schedule: tlsblock_base: 0x%lX\n",
|
||||
ihk_mc_get_processor_id(), next->thread.tlsblock_base);
|
||||
ihk_mc_get_processor_id(), next->tlsblock_base);
|
||||
|
||||
/* Set up new TLS.. */
|
||||
do_arch_prctl(ARCH_SET_FS, next->thread.tlsblock_base);
|
||||
do_arch_prctl(ARCH_SET_FS, next->tlsblock_base);
|
||||
|
||||
if (prev) {
|
||||
last = ihk_mc_switch_context(&prev->ctx, &next->ctx, prev);
|
||||
|
||||
@ -1475,7 +1475,7 @@ long do_arch_prctl(unsigned long code, unsigned long address)
|
||||
case ARCH_SET_FS:
|
||||
dkprintf("[%d] arch_prctl: ARCH_SET_FS: 0x%lX\n",
|
||||
ihk_mc_get_processor_id(), address);
|
||||
cpu_local_var(current)->thread.tlsblock_base = address;
|
||||
cpu_local_var(current)->tlsblock_base = address;
|
||||
err = ihk_mc_arch_set_special_register(type, address);
|
||||
break;
|
||||
case ARCH_SET_GS:
|
||||
@ -1893,7 +1893,7 @@ unsigned long do_fork(int clone_flags, unsigned long newsp,
|
||||
dkprintf("clone_flags & CLONE_CHILD_CLEARTID: 0x%lX\n",
|
||||
child_tidptr);
|
||||
|
||||
new->thread.clear_child_tid = (int*)child_tidptr;
|
||||
new->clear_child_tid = (int*)child_tidptr;
|
||||
}
|
||||
|
||||
if (clone_flags & CLONE_CHILD_SETTID) {
|
||||
@ -1915,11 +1915,11 @@ unsigned long do_fork(int clone_flags, unsigned long newsp,
|
||||
dkprintf("clone_flags & CLONE_SETTLS: 0x%lX\n",
|
||||
tlsblock_base);
|
||||
|
||||
new->thread.tlsblock_base = tlsblock_base;
|
||||
new->tlsblock_base = tlsblock_base;
|
||||
}
|
||||
else {
|
||||
new->thread.tlsblock_base =
|
||||
cpu_local_var(current)->thread.tlsblock_base;
|
||||
new->tlsblock_base =
|
||||
cpu_local_var(current)->tlsblock_base;
|
||||
}
|
||||
|
||||
ihk_mc_syscall_ret(new->uctx) = 0;
|
||||
@ -1967,7 +1967,7 @@ SYSCALL_DECLARE(clone)
|
||||
|
||||
SYSCALL_DECLARE(set_tid_address)
|
||||
{
|
||||
cpu_local_var(current)->thread.clear_child_tid =
|
||||
cpu_local_var(current)->clear_child_tid =
|
||||
(int*)ihk_mc_syscall_arg0(ctx);
|
||||
|
||||
return cpu_local_var(current)->proc->pid;
|
||||
@ -3535,13 +3535,13 @@ SYSCALL_DECLARE(exit)
|
||||
*/
|
||||
/* If there is a clear_child_tid address set, clear it and wake it.
|
||||
* This unblocks any pthread_join() waiters. */
|
||||
if (thread->thread.clear_child_tid) {
|
||||
if (thread->clear_child_tid) {
|
||||
|
||||
dkprintf("exit clear_child!\n");
|
||||
|
||||
*thread->thread.clear_child_tid = 0;
|
||||
*thread->clear_child_tid = 0;
|
||||
barrier();
|
||||
futex((uint32_t *)thread->thread.clear_child_tid,
|
||||
futex((uint32_t *)thread->clear_child_tid,
|
||||
FUTEX_WAKE, 1, 0, NULL, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user