aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/frv/kernel/process.c')
-rw-r--r--arch/frv/kernel/process.c45
1 files changed, 5 insertions, 40 deletions
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 7e33215f1d8f..23916b2a12a2 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)
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;