aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-21 16:52:56 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-11-28 22:36:46 -0500
commit92bbe6cdfdeeaf9ac2a240b1829bab219e7e91d0 (patch)
tree01f0fcd9307bbf09850fcc82baaec879f8313bfc /arch
parent27d892fb27f492921cfd6df15ab4153f1badbb46 (diff)
m32r: switch to generic fork/vfork/clone
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/m32r/include/asm/unistd.h3
-rw-r--r--arch/m32r/kernel/process.c46
2 files changed, 7 insertions, 42 deletions
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h
index b27bdcbc7c2c..d9e7351af2a4 100644
--- a/arch/m32r/include/asm/unistd.h
+++ b/arch/m32r/include/asm/unistd.h
@@ -353,6 +353,9 @@
353#define __ARCH_WANT_SYS_RT_SIGACTION 353#define __ARCH_WANT_SYS_RT_SIGACTION
354#define __ARCH_WANT_SYS_RT_SIGSUSPEND 354#define __ARCH_WANT_SYS_RT_SIGSUSPEND
355#define __ARCH_WANT_SYS_EXECVE 355#define __ARCH_WANT_SYS_EXECVE
356#define __ARCH_WANT_SYS_CLONE
357#define __ARCH_WANT_SYS_FORK
358#define __ARCH_WANT_SYS_VFORK
356 359
357#define __IGNORE_lchown 360#define __IGNORE_lchown
358#define __IGNORE_setuid 361#define __IGNORE_setuid
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index 62c713f5694a..c37e9a9a8f27 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -192,7 +192,7 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
192} 192}
193 193
194int copy_thread(unsigned long clone_flags, unsigned long spu, 194int copy_thread(unsigned long clone_flags, unsigned long spu,
195 unsigned long arg, struct task_struct *tsk, struct pt_regs *regs) 195 unsigned long arg, struct task_struct *tsk, struct pt_regs *unused)
196{ 196{
197 struct pt_regs *childregs = task_pt_regs(tsk); 197 struct pt_regs *childregs = task_pt_regs(tsk);
198 extern void ret_from_fork(void); 198 extern void ret_from_fork(void);
@@ -206,8 +206,9 @@ int copy_thread(unsigned long clone_flags, unsigned long spu,
206 tsk->thread.lr = (unsigned long)ret_from_kernel_thread; 206 tsk->thread.lr = (unsigned long)ret_from_kernel_thread;
207 } else { 207 } else {
208 /* Copy registers */ 208 /* Copy registers */
209 *childregs = *regs; 209 *childregs = *current_pt_regs();
210 childregs->spu = spu; 210 if (spu)
211 childregs->spu = spu;
211 childregs->r0 = 0; /* Child gets zero as return value */ 212 childregs->r0 = 0; /* Child gets zero as return value */
212 tsk->thread.lr = (unsigned long)ret_from_fork; 213 tsk->thread.lr = (unsigned long)ret_from_fork;
213 } 214 }
@@ -216,45 +217,6 @@ int copy_thread(unsigned long clone_flags, unsigned long spu,
216 return 0; 217 return 0;
217} 218}
218 219
219asmlinkage int sys_fork(void)
220{
221#ifdef CONFIG_MMU
222 struct pt_regs *regs = current_pt_regs();
223 return do_fork(SIGCHLD, regs->spu, regs, 0, NULL, NULL);
224#else
225 return -EINVAL;
226#endif /* CONFIG_MMU */
227}
228
229asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
230 unsigned long parent_tidptr,
231 unsigned long child_tidptr)
232{
233 struct pt_regs *regs = current_pt_regs();
234 if (!newsp)
235 newsp = regs->spu;
236
237 return do_fork(clone_flags, newsp, regs, 0,
238 (int __user *)parent_tidptr, (int __user *)child_tidptr);
239}
240
241/*
242 * This is trivial, and on the face of it looks like it
243 * could equally well be done in user mode.
244 *
245 * Not so, for quite unobvious reasons - register pressure.
246 * In user mode vfork() cannot have a stack frame, and if
247 * done by calling the "clone()" system call directly, you
248 * do not have enough call-clobbered registers to hold all
249 * the information you need.
250 */
251asmlinkage int sys_vfork(void)
252{
253 struct pt_regs *regs = current_pt_regs();
254 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->spu, regs, 0,
255 NULL, NULL);
256}
257
258/* 220/*
259 * These bracket the sleeping functions.. 221 * These bracket the sleeping functions..
260 */ 222 */