Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

openrisc: Convert copy_thread to copy_thread_tls

This is required for clone3 which passes the TLS value through a
struct rather than a register.

Signed-off-by: Stafford Horne <shorne@gmail.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>

+7 -11
+1
arch/openrisc/Kconfig
··· 14 14 select HANDLE_DOMAIN_IRQ 15 15 select GPIOLIB 16 16 select HAVE_ARCH_TRACEHOOK 17 + select HAVE_COPY_THREAD_TLS 17 18 select SPARSE_IRQ 18 19 select GENERIC_IRQ_CHIP 19 20 select GENERIC_IRQ_PROBE
+6 -11
arch/openrisc/kernel/process.c
··· 117 117 extern asmlinkage void ret_from_fork(void); 118 118 119 119 /* 120 - * copy_thread 120 + * copy_thread_tls 121 121 * @clone_flags: flags 122 122 * @usp: user stack pointer or fn for kernel thread 123 123 * @arg: arg to fn for kernel thread; always NULL for userspace thread 124 124 * @p: the newly created task 125 125 * @regs: CPU context to copy for userspace thread; always NULL for kthread 126 + * @tls: the Thread Local Storage pointer for the new process 126 127 * 127 128 * At the top of a newly initialized kernel stack are two stacked pt_reg 128 129 * structures. The first (topmost) is the userspace context of the thread. ··· 149 148 */ 150 149 151 150 int 152 - copy_thread(unsigned long clone_flags, unsigned long usp, 153 - unsigned long arg, struct task_struct *p) 151 + copy_thread_tls(unsigned long clone_flags, unsigned long usp, 152 + unsigned long arg, struct task_struct *p, unsigned long tls) 154 153 { 155 154 struct pt_regs *userregs; 156 155 struct pt_regs *kregs; ··· 180 179 userregs->sp = usp; 181 180 182 181 /* 183 - * For CLONE_SETTLS set "tp" (r10) to the TLS pointer passed to sys_clone. 184 - * 185 - * The kernel entry is: 186 - * int clone (long flags, void *child_stack, int *parent_tid, 187 - * int *child_tid, struct void *tls) 188 - * 189 - * This makes the source r7 in the kernel registers. 182 + * For CLONE_SETTLS set "tp" (r10) to the TLS pointer. 190 183 */ 191 184 if (clone_flags & CLONE_SETTLS) 192 - userregs->gpr[10] = userregs->gpr[7]; 185 + userregs->gpr[10] = tls; 193 186 194 187 userregs->gpr[11] = 0; /* Result from fork() */ 195 188