aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v32
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-26 15:15:13 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-11-28 22:36:46 -0500
commit27d892fb27f492921cfd6df15ab4153f1badbb46 (patch)
treea5097f8bfe9614ec86db50a84b538afb8399033d /arch/cris/arch-v32
parent584271bcb45b50027c8d87b51634750780c92437 (diff)
cris: switch to generic fork/vfork/clone
same braindamage as on s390 - the first two arguments of clone(2) in the wrong order. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/cris/arch-v32')
-rw-r--r--arch/cris/arch-v32/kernel/process.c37
1 files changed, 5 insertions, 32 deletions
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c
index fe465401b6ec..331e70252df0 100644
--- a/arch/cris/arch-v32/kernel/process.c
+++ b/arch/cris/arch-v32/kernel/process.c
@@ -16,7 +16,7 @@
16#include <hwregs/reg_map.h> 16#include <hwregs/reg_map.h>
17#include <hwregs/timer_defs.h> 17#include <hwregs/timer_defs.h>
18#include <hwregs/intr_vect_defs.h> 18#include <hwregs/intr_vect_defs.h>
19#include <asm/ptrace.h> 19#include <linux/ptrace.h>
20 20
21extern void stop_watchdog(void); 21extern void stop_watchdog(void);
22 22
@@ -110,7 +110,7 @@ extern asmlinkage void ret_from_kernel_thread(void);
110int 110int
111copy_thread(unsigned long clone_flags, unsigned long usp, 111copy_thread(unsigned long clone_flags, unsigned long usp,
112 unsigned long arg, 112 unsigned long arg,
113 struct task_struct *p, struct pt_regs *regs) 113 struct task_struct *p, struct pt_regs *unused)
114{ 114{
115 struct pt_regs *childregs = task_pt_regs(p); 115 struct pt_regs *childregs = task_pt_regs(p);
116 struct switch_stack *swstack = ((struct switch_stack *) childregs) - 1; 116 struct switch_stack *swstack = ((struct switch_stack *) childregs) - 1;
@@ -131,14 +131,14 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
131 p->thread.usp = 0; 131 p->thread.usp = 0;
132 return 0; 132 return 0;
133 } 133 }
134 *childregs = *regs; /* Struct copy of pt_regs. */ 134 *childregs = *current_pt_regs(); /* Struct copy of pt_regs. */
135 childregs->r10 = 0; /* Child returns 0 after a fork/clone. */ 135 childregs->r10 = 0; /* Child returns 0 after a fork/clone. */
136 136
137 /* Set a new TLS ? 137 /* Set a new TLS ?
138 * The TLS is in $mof because it is the 5th argument to sys_clone. 138 * The TLS is in $mof because it is the 5th argument to sys_clone.
139 */ 139 */
140 if (p->mm && (clone_flags & CLONE_SETTLS)) { 140 if (p->mm && (clone_flags & CLONE_SETTLS)) {
141 task_thread_info(p)->tls = regs->mof; 141 task_thread_info(p)->tls = childregs->mof;
142 } 142 }
143 143
144 /* Put the switch stack right below the pt_regs. */ 144 /* Put the switch stack right below the pt_regs. */
@@ -153,39 +153,12 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
153 swstack->return_ip = (unsigned long) ret_from_fork; 153 swstack->return_ip = (unsigned long) ret_from_fork;
154 154
155 /* Fix the user-mode and kernel-mode stackpointer. */ 155 /* Fix the user-mode and kernel-mode stackpointer. */
156 p->thread.usp = usp; 156 p->thread.usp = usp ?: rdusp();
157 p->thread.ksp = (unsigned long) swstack; 157 p->thread.ksp = (unsigned long) swstack;
158 158
159 return 0; 159 return 0;
160} 160}
161 161
162asmlinkage int
163sys_fork(void)
164{
165 return do_fork(SIGCHLD, rdusp(), current_pt_regs(), 0, NULL, NULL);
166}
167
168/* FIXME: Is parent_tid/child_tid really third/fourth argument? Update lib? */
169asmlinkage int
170sys_clone(unsigned long newusp, unsigned long flags, int *parent_tid, int *child_tid,
171 unsigned long tls)
172{
173 if (!newusp)
174 newusp = rdusp();
175
176 return do_fork(flags, newusp, current_pt_regs(), 0, parent_tid, child_tid);
177}
178
179/*
180 * vfork is a system call in i386 because of register-pressure - maybe
181 * we can remove it and handle it in libc but we put it here until then.
182 */
183asmlinkage int
184sys_vfork(void)
185{
186 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), current_pt_regs(), 0, NULL, NULL);
187}
188
189unsigned long 162unsigned long
190get_wchan(struct task_struct *p) 163get_wchan(struct task_struct *p)
191{ 164{