@@ -139,52 +139,20 @@ inline unsigned long user_stack(const struct pt_regs *regs)
139139 return user_mode (regs ) ? regs -> sp : 0 ;
140140}
141141
142- asmlinkage 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-
152- asmlinkage 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- */
163- asmlinkage 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-
172142/*
173143 * set up the kernel stack and exception frames for a new process
174144 */
175145int copy_thread (unsigned long clone_flags ,
176146 unsigned long usp , unsigned long arg ,
177- struct task_struct * p , struct pt_regs * regs )
147+ struct task_struct * p , struct pt_regs * unused )
178148{
179149 struct pt_regs * childregs ;
180150
181151 childregs = (struct pt_regs * )
182152 (task_stack_page (p ) + THREAD_SIZE - FRV_FRAME0_SIZE );
183153
184154 /* set up the userspace frame (the only place that the USP is stored) */
185- * childregs = * __kernel_frame0_ptr ;
186-
187- p -> set_child_tid = p -> clear_child_tid = NULL ;
155+ * childregs = * current_pt_regs ();
188156
189157 p -> thread .frame = childregs ;
190158 p -> thread .curr = p ;
@@ -193,18 +161,15 @@ int copy_thread(unsigned long clone_flags,
193161 p -> thread .lr = 0 ;
194162 p -> thread .frame0 = childregs ;
195163
196- if (unlikely (! regs )) {
164+ if (unlikely (p -> flags & PF_KTHREAD )) {
197165 childregs -> gr9 = usp ; /* function */
198166 childregs -> gr8 = arg ;
199167 p -> thread .pc = (unsigned long ) ret_from_kernel_thread ;
200168 save_user_regs (p -> thread .user );
201169 return 0 ;
202170 }
203-
204- /* set up the userspace frame (the only place that the USP is stored) */
205- * childregs = * regs ;
206-
207- childregs -> sp = usp ;
171+ if (usp )
172+ childregs -> sp = usp ;
208173 childregs -> next_frame = NULL ;
209174
210175 p -> thread .pc = (unsigned long ) ret_from_fork ;
0 commit comments