1ca1443570
These registers are saved/restored together with the other general registers using ptrace. In arch_set_tls we then just need to set the register and it will be synced back normally. Most of this logic was introduced in commit f355559cf7845 ("[PATCH] uml: x86_64 thread fixes"). However, at least today we can rely on ptrace to restore the base registers for us. As such, only the part of the patch that tracks the FS register for use as thread local storage is actually needed. Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net> Signed-off-by: Richard Weinberger <richard@nod.at>
19 lines
396 B
C
19 lines
396 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/sched.h>
|
|
#include <asm/ptrace-abi.h>
|
|
|
|
void clear_flushed_tls(struct task_struct *task)
|
|
{
|
|
}
|
|
|
|
int arch_set_tls(struct task_struct *t, unsigned long tls)
|
|
{
|
|
/*
|
|
* If CLONE_SETTLS is set, we need to save the thread id
|
|
* so it can be set during context switches.
|
|
*/
|
|
t->thread.regs.regs.gp[FS_BASE / sizeof(unsigned long)] = tls;
|
|
|
|
return 0;
|
|
}
|