diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-21 16:43:13 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-28 22:47:24 -0500 |
commit | 1ea2a0160588582cd8414a8026d5b54f1705dfa1 (patch) | |
tree | 65c2b543d3e9045c9766ab957f4cfdb92340d0e0 /arch/mn10300 | |
parent | 3416e8098aa4c0eea1b2e5c4efc68cf61a848864 (diff) |
mn10300: switch to generic fork/vfork/clone
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/mn10300')
-rw-r--r-- | arch/mn10300/include/asm/unistd.h | 3 | ||||
-rw-r--r-- | arch/mn10300/kernel/process.c | 33 |
2 files changed, 8 insertions, 28 deletions
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h index 9711d51b0212..cabf8ba73b27 100644 --- a/arch/mn10300/include/asm/unistd.h +++ b/arch/mn10300/include/asm/unistd.h | |||
@@ -44,6 +44,9 @@ | |||
44 | #define __ARCH_WANT_SYS_RT_SIGACTION | 44 | #define __ARCH_WANT_SYS_RT_SIGACTION |
45 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 45 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
46 | #define __ARCH_WANT_SYS_EXECVE | 46 | #define __ARCH_WANT_SYS_EXECVE |
47 | #define __ARCH_WANT_SYS_FORK | ||
48 | #define __ARCH_WANT_SYS_VFORK | ||
49 | #define __ARCH_WANT_SYS_CLONE | ||
47 | 50 | ||
48 | /* | 51 | /* |
49 | * "Conditional" syscalls | 52 | * "Conditional" syscalls |
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index d0c671b6d9ff..5e0ef396458d 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c | |||
@@ -206,7 +206,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
206 | */ | 206 | */ |
207 | int copy_thread(unsigned long clone_flags, | 207 | int copy_thread(unsigned long clone_flags, |
208 | unsigned long c_usp, unsigned long ustk_size, | 208 | unsigned long c_usp, unsigned long ustk_size, |
209 | struct task_struct *p, struct pt_regs *kregs) | 209 | struct task_struct *p, struct pt_regs *unused) |
210 | { | 210 | { |
211 | struct thread_info *ti = task_thread_info(p); | 211 | struct thread_info *ti = task_thread_info(p); |
212 | struct pt_regs *c_regs; | 212 | struct pt_regs *c_regs; |
@@ -227,7 +227,7 @@ int copy_thread(unsigned long clone_flags, | |||
227 | p->thread.wchan = p->thread.pc; | 227 | p->thread.wchan = p->thread.pc; |
228 | p->thread.usp = c_usp; | 228 | p->thread.usp = c_usp; |
229 | 229 | ||
230 | if (unlikely(!kregs)) { | 230 | if (unlikely(p->flags & PF_KTHREAD)) { |
231 | memset(c_regs, 0, sizeof(struct pt_regs)); | 231 | memset(c_regs, 0, sizeof(struct pt_regs)); |
232 | c_regs->a0 = c_usp; /* function */ | 232 | c_regs->a0 = c_usp; /* function */ |
233 | c_regs->d0 = ustk_size; /* argument */ | 233 | c_regs->d0 = ustk_size; /* argument */ |
@@ -236,8 +236,9 @@ int copy_thread(unsigned long clone_flags, | |||
236 | p->thread.pc = (unsigned long) ret_from_kernel_thread; | 236 | p->thread.pc = (unsigned long) ret_from_kernel_thread; |
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | *c_regs = *kregs; | 239 | *c_regs = *current_pt_regs(); |
240 | c_regs->sp = c_usp; | 240 | if (c_usp) |
241 | c_regs->sp = c_usp; | ||
241 | c_regs->epsw &= ~EPSW_FE; /* my FPU */ | 242 | c_regs->epsw &= ~EPSW_FE; /* my FPU */ |
242 | 243 | ||
243 | /* the new TLS pointer is passed in as arg #5 to sys_clone() */ | 244 | /* the new TLS pointer is passed in as arg #5 to sys_clone() */ |
@@ -249,30 +250,6 @@ int copy_thread(unsigned long clone_flags, | |||
249 | return 0; | 250 | return 0; |
250 | } | 251 | } |
251 | 252 | ||
252 | /* | ||
253 | * clone a process | ||
254 | * - tlsptr is retrieved by copy_thread() from current_frame()->d3 | ||
255 | */ | ||
256 | asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
257 | int __user *parent_tidptr, int __user *child_tidptr, | ||
258 | int __user *tlsptr) | ||
259 | { | ||
260 | return do_fork(clone_flags, newsp ?: current_frame()->sp, | ||
261 | current_frame(), 0, parent_tidptr, child_tidptr); | ||
262 | } | ||
263 | |||
264 | asmlinkage long sys_fork(void) | ||
265 | { | ||
266 | return do_fork(SIGCHLD, current_frame()->sp, | ||
267 | current_frame(), 0, NULL, NULL); | ||
268 | } | ||
269 | |||
270 | asmlinkage long sys_vfork(void) | ||
271 | { | ||
272 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, current_frame()->sp, | ||
273 | current_frame(), 0, NULL, NULL); | ||
274 | } | ||
275 | |||
276 | unsigned long get_wchan(struct task_struct *p) | 253 | unsigned long get_wchan(struct task_struct *p) |
277 | { | 254 | { |
278 | return p->thread.wchan; | 255 | return p->thread.wchan; |