f355559cf7
x86_64 needs some TLS fixes. What was missing was remembering the child thread id during clone and stuffing it into the child during each context switch. The %fs value is stored separately in the thread structure since the host controls what effect it has on the actual register file. The host also needs to store it in its own thread struct, so we need the value kept outside the register file. arch_prctl_skas was fixed to call PTRACE_ARCH_PRCTL appropriately. There is some saving and restoring of registers in the ARCH_SET_* cases so that the correct set of registers are changed on the host and restored to the process when it runs again. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
18 lines
375 B
C
18 lines
375 B
C
#include "linux/sched.h"
|
|
|
|
void clear_flushed_tls(struct task_struct *task)
|
|
{
|
|
}
|
|
|
|
int arch_copy_tls(struct task_struct *t)
|
|
{
|
|
/*
|
|
* If CLONE_SETTLS is set, we need to save the thread id
|
|
* (which is argument 5, child_tid, of clone) so it can be set
|
|
* during context switches.
|
|
*/
|
|
t->thread.arch.fs = t->thread.regs.regs.skas.regs[R8 / sizeof(long)];
|
|
|
|
return 0;
|
|
}
|