Skip to content

Commit f9c4e3a

Browse files
jcowgillralfbaechle
authored andcommitted
MIPS: Opt into HAVE_COPY_THREAD_TLS
This the mips version of commit c1bd55f ("x86: opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit"). Simply use the tls system call argument instead of extracting the tls argument by magic from the pt_regs structure. See commit 3033f14 ("clone: support passing tls argument via C rather than pt_regs magic") for more background. Signed-off-by: James Cowgill <James.Cowgill@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/15855/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 759f534 commit f9c4e3a

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ config MIPS
7070
select HAVE_EXIT_THREAD
7171
select HAVE_REGS_AND_STACK_ACCESS_API
7272
select HAVE_ARCH_HARDENED_USERCOPY
73+
select HAVE_COPY_THREAD_TLS
7374

7475
menu "Machine selection"
7576

‎arch/mips/kernel/process.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
114114
/*
115115
* Copy architecture-specific thread state
116116
*/
117-
int copy_thread(unsigned long clone_flags, unsigned long usp,
118-
unsigned long kthread_arg, struct task_struct *p)
117+
int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
118+
unsigned long kthread_arg, struct task_struct *p, unsigned long tls)
119119
{
120120
struct thread_info *ti = task_thread_info(p);
121121
struct pt_regs *childregs, *regs = current_pt_regs();
@@ -176,7 +176,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
176176
atomic_set(&p->thread.bd_emu_frame, BD_EMUFRAME_NONE);
177177

178178
if (clone_flags & CLONE_SETTLS)
179-
ti->tp_value = regs->regs[7];
179+
ti->tp_value = tls;
180180

181181
return 0;
182182
}

0 commit comments

Comments
 (0)