aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-11-02 09:20:43 -0400
committerDavid Howells <dhowells@redhat.com>2012-11-02 09:20:43 -0400
commite7aa51b2e52274b13be3209e2787d1b2ce9624fd (patch)
tree43498c88cd786e17c7545a574152c986ab756c12 /arch/frv
parent1ee6f5669a7eaba0e2f4e0dd0599b56eb8a9a090 (diff)
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 02ce496f152df87be081a64796498942c433a2fd 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>
Diffstat (limited to 'arch/frv')
-rw-r--r--arch/frv/kernel/process.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index e1e3aa196aa4..7e33215f1d8f 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -181,6 +181,9 @@ int copy_thread(unsigned long clone_flags,
181 childregs = (struct pt_regs *) 181 childregs = (struct pt_regs *)
182 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); 182 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
183 183
184 /* set up the userspace frame (the only place that the USP is stored) */
185 *childregs = *__kernel_frame0_ptr;
186
184 p->set_child_tid = p->clear_child_tid = NULL; 187 p->set_child_tid = p->clear_child_tid = NULL;
185 188
186 p->thread.frame = childregs; 189 p->thread.frame = childregs;
@@ -191,10 +194,8 @@ int copy_thread(unsigned long clone_flags,
191 p->thread.frame0 = childregs; 194 p->thread.frame0 = childregs;
192 195
193 if (unlikely(!regs)) { 196 if (unlikely(!regs)) {
194 memset(childregs, 0, sizeof(struct pt_regs));
195 childregs->gr9 = usp; /* function */ 197 childregs->gr9 = usp; /* function */
196 childregs->gr8 = arg; 198 childregs->gr8 = arg;
197 childregs->psr = PSR_S;
198 p->thread.pc = (unsigned long) ret_from_kernel_thread; 199 p->thread.pc = (unsigned long) ret_from_kernel_thread;
199 save_user_regs(p->thread.user); 200 save_user_regs(p->thread.user);
200 return 0; 201 return 0;