Skip to content

Commit e7aa51b

Browse files
committed
FRV: Fix the new-style kernel_thread() stuff
The kernel_thread() changes for FRV don't work, and FRV fails to boot, starting with: commit 02ce496 Author: Al Viro <viro@zeniv.linux.org.uk> Date: Tue Sep 18 22:18:51 2012 -0400 Subject: frv: split ret_from_fork, simplify kernel_thread() a lot The problem is that the userspace registers are completely cleared when a kernel thread is created and all subsequent user threads are then copied from that. Unfortunately, however, the TBR and PSR registers are restored from the pt_regs and the values they should be set to are clobbered by the memset. Instead, copy across the old user registers as normal, and then merely alter GR8 and GR9 in it if we're going to execute a kernel thread. Signed-off-by: David Howells <dhowells@redhat.com>
1 parent 1ee6f56 commit e7aa51b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎arch/frv/kernel/process.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ int copy_thread(unsigned long clone_flags,
181181
childregs = (struct pt_regs *)
182182
(task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
183183

184+
/* set up the userspace frame (the only place that the USP is stored) */
185+
*childregs = *__kernel_frame0_ptr;
186+
184187
p->set_child_tid = p->clear_child_tid = NULL;
185188

186189
p->thread.frame = childregs;
@@ -191,10 +194,8 @@ int copy_thread(unsigned long clone_flags,
191194
p->thread.frame0 = childregs;
192195

193196
if (unlikely(!regs)) {
194-
memset(childregs, 0, sizeof(struct pt_regs));
195197
childregs->gr9 = usp; /* function */
196198
childregs->gr8 = arg;
197-
childregs->psr = PSR_S;
198199
p->thread.pc = (unsigned long) ret_from_kernel_thread;
199200
save_user_regs(p->thread.user);
200201
return 0;

0 commit comments

Comments
 (0)