aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-21 16:40:35 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-11-28 22:16:06 -0500
commitb9763ce33fff6b37e1f2e2effb14fb25e67a68f2 (patch)
tree22b34cd0cfdcec8f20aa67dd67ef8183c1b5cc1f /arch
parent0bcfe5404962cfb1dd0d4b3755357c12a98ef3d1 (diff)
frv: switch to generic fork/vfork/clone
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/frv/include/asm/unistd.h3
-rw-r--r--arch/frv/kernel/process.c45
2 files changed, 8 insertions, 40 deletions
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index 2358634cacca..1807d8ea8cb5 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -30,6 +30,9 @@
30#define __ARCH_WANT_SYS_RT_SIGACTION 30#define __ARCH_WANT_SYS_RT_SIGACTION
31#define __ARCH_WANT_SYS_RT_SIGSUSPEND 31#define __ARCH_WANT_SYS_RT_SIGSUSPEND
32#define __ARCH_WANT_SYS_EXECVE 32#define __ARCH_WANT_SYS_EXECVE
33#define __ARCH_WANT_SYS_FORK
34#define __ARCH_WANT_SYS_VFORK
35#define __ARCH_WANT_SYS_CLONE
33 36
34/* 37/*
35 * "Conditional" syscalls 38 * "Conditional" syscalls
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 7e33215f1d8f..0039bf77b192 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -139,42 +139,12 @@ inline unsigned long user_stack(const struct pt_regs *regs)
139 return user_mode(regs) ? regs->sp : 0; 139 return user_mode(regs) ? regs->sp : 0;
140} 140}
141 141
142asmlinkage int sys_fork(void)
143{
144#ifndef CONFIG_MMU
145 /* fork almost works, enough to trick you into looking elsewhere:-( */
146 return -EINVAL;
147#else
148 return do_fork(SIGCHLD, user_stack(__frame), __frame, 0, NULL, NULL);
149#endif
150}
151
152asmlinkage int sys_vfork(void)
153{
154 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, user_stack(__frame), __frame, 0,
155 NULL, NULL);
156}
157
158/*****************************************************************************/
159/*
160 * clone a process
161 * - tlsptr is retrieved by copy_thread()
162 */
163asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
164 int __user *parent_tidptr, int __user *child_tidptr,
165 int __user *tlsptr)
166{
167 if (!newsp)
168 newsp = user_stack(__frame);
169 return do_fork(clone_flags, newsp, __frame, 0, parent_tidptr, child_tidptr);
170} /* end sys_clone() */
171
172/* 142/*
173 * set up the kernel stack and exception frames for a new process 143 * set up the kernel stack and exception frames for a new process
174 */ 144 */
175int copy_thread(unsigned long clone_flags, 145int copy_thread(unsigned long clone_flags,
176 unsigned long usp, unsigned long arg, 146 unsigned long usp, unsigned long arg,
177 struct task_struct *p, struct pt_regs *regs) 147 struct task_struct *p, struct pt_regs *unused)
178{ 148{
179 struct pt_regs *childregs; 149 struct pt_regs *childregs;
180 150
@@ -182,9 +152,7 @@ int copy_thread(unsigned long clone_flags,
182 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); 152 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
183 153
184 /* set up the userspace frame (the only place that the USP is stored) */ 154 /* set up the userspace frame (the only place that the USP is stored) */
185 *childregs = *__kernel_frame0_ptr; 155 *childregs = *current_pt_regs();
186
187 p->set_child_tid = p->clear_child_tid = NULL;
188 156
189 p->thread.frame = childregs; 157 p->thread.frame = childregs;
190 p->thread.curr = p; 158 p->thread.curr = p;
@@ -193,18 +161,15 @@ int copy_thread(unsigned long clone_flags,
193 p->thread.lr = 0; 161 p->thread.lr = 0;
194 p->thread.frame0 = childregs; 162 p->thread.frame0 = childregs;
195 163
196 if (unlikely(!regs)) { 164 if (unlikely(p->flags & PF_KTHREAD)) {
197 childregs->gr9 = usp; /* function */ 165 childregs->gr9 = usp; /* function */
198 childregs->gr8 = arg; 166 childregs->gr8 = arg;
199 p->thread.pc = (unsigned long) ret_from_kernel_thread; 167 p->thread.pc = (unsigned long) ret_from_kernel_thread;
200 save_user_regs(p->thread.user); 168 save_user_regs(p->thread.user);
201 return 0; 169 return 0;
202 } 170 }
203 171 if (usp)
204 /* set up the userspace frame (the only place that the USP is stored) */ 172 childregs->sp = usp;
205 *childregs = *regs;
206
207 childregs->sp = usp;
208 childregs->next_frame = NULL; 173 childregs->next_frame = NULL;
209 174
210 p->thread.pc = (unsigned long) ret_from_fork; 175 p->thread.pc = (unsigned long) ret_from_fork;