aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-09-22 18:10:15 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-01 00:53:11 -0400
commit49ed3398b75c98c087537a7d5a1a23f86a8c8746 (patch)
tree29d8f77210dcec7dac19fc7355ae8e07fd35a444 /arch/frv
parent019f96a345b6e23d4e0bc2c136ec5f7500b95834 (diff)
frv: switch to generic kernel_thread()
Diffstat (limited to 'arch/frv')
-rw-r--r--arch/frv/Kconfig1
-rw-r--r--arch/frv/include/asm/processor.h1
-rw-r--r--arch/frv/kernel/process.c41
3 files changed, 20 insertions, 23 deletions
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 971c0a19facb..a27a1c6f8457 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -10,6 +10,7 @@ config FRV
10 select ARCH_HAVE_NMI_SAFE_CMPXCHG 10 select ARCH_HAVE_NMI_SAFE_CMPXCHG
11 select GENERIC_CPU_DEVICES 11 select GENERIC_CPU_DEVICES
12 select ARCH_WANT_IPC_PARSE_VERSION 12 select ARCH_WANT_IPC_PARSE_VERSION
13 select GENERIC_KERNEL_THREAD
13 14
14config ZONE_DMA 15config ZONE_DMA
15 bool 16 bool
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h
index cc86e07a4119..a34f309e5801 100644
--- a/arch/frv/include/asm/processor.h
+++ b/arch/frv/include/asm/processor.h
@@ -105,7 +105,6 @@ static inline void release_thread(struct task_struct *dead_task)
105{ 105{
106} 106}
107 107
108extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
109extern asmlinkage void save_user_regs(struct user_context *target); 108extern asmlinkage void save_user_regs(struct user_context *target);
110extern asmlinkage void *restore_user_regs(const struct user_context *target, ...); 109extern asmlinkage void *restore_user_regs(const struct user_context *target, ...);
111 110
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 7ff4dbef0567..014f855362b9 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -170,7 +170,7 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
170 * set up the kernel stack and exception frames for a new process 170 * set up the kernel stack and exception frames for a new process
171 */ 171 */
172int copy_thread(unsigned long clone_flags, 172int copy_thread(unsigned long clone_flags,
173 unsigned long usp, unsigned long topstk, 173 unsigned long usp, unsigned long arg,
174 struct task_struct *p, struct pt_regs *regs) 174 struct task_struct *p, struct pt_regs *regs)
175{ 175{
176 struct pt_regs *childregs; 176 struct pt_regs *childregs;
@@ -178,17 +178,6 @@ int copy_thread(unsigned long clone_flags,
178 childregs = (struct pt_regs *) 178 childregs = (struct pt_regs *)
179 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); 179 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
180 180
181 /* set up the userspace frame (the only place that the USP is stored) */
182 *childregs = *regs;
183
184 childregs->sp = usp;
185 childregs->next_frame = NULL;
186
187 if (unlikely(!user_mode(regs)))
188 p->thread.pc = (unsigned long) ret_from_kernel_thread;
189 else
190 p->thread.pc = (unsigned long) ret_from_fork;
191
192 p->set_child_tid = p->clear_child_tid = NULL; 181 p->set_child_tid = p->clear_child_tid = NULL;
193 182
194 p->thread.frame = childregs; 183 p->thread.frame = childregs;
@@ -198,6 +187,24 @@ int copy_thread(unsigned long clone_flags,
198 p->thread.lr = 0; 187 p->thread.lr = 0;
199 p->thread.frame0 = childregs; 188 p->thread.frame0 = childregs;
200 189
190 if (unlikely(!regs)) {
191 memset(childregs, 0, sizeof(struct pt_regs));
192 childregs->gr9 = usp; /* function */
193 childregs->gr8 = arg;
194 chilregs->psr = PSR_S;
195 p->thread.pc = (unsigned long) ret_from_kernel_thread;
196 save_user_regs(p->thread.user);
197 return 0;
198 }
199
200 /* set up the userspace frame (the only place that the USP is stored) */
201 *childregs = *regs;
202
203 childregs->sp = usp;
204 childregs->next_frame = NULL;
205
206 p->thread.pc = (unsigned long) ret_from_fork;
207
201 /* the new TLS pointer is passed in as arg #5 to sys_clone() */ 208 /* the new TLS pointer is passed in as arg #5 to sys_clone() */
202 if (clone_flags & CLONE_SETTLS) 209 if (clone_flags & CLONE_SETTLS)
203 childregs->gr29 = childregs->gr12; 210 childregs->gr29 = childregs->gr12;
@@ -320,13 +327,3 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs)
320 sizeof(current->thread.user->f)); 327 sizeof(current->thread.user->f));
321 return 1; 328 return 1;
322} 329}
323
324int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
325{
326 struct pt_regs regs = {
327 .gr8 = (unsigned long)arg;
328 .gr9 = (unsigned long)fn;
329 .psr = PSR_S;
330 };
331 return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
332}