diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-21 16:44:57 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-28 23:43:40 -0500 |
commit | eda96977024c84e677191cad785351abbb945901 (patch) | |
tree | a1038d27bb6b4399d8625da045c4af31d12df4e5 /arch | |
parent | 951b39619a76643972f6f23e007fd0f3fbbd71c2 (diff) |
score: switch to generic fork/vfork/clone
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/score/Kconfig | 1 | ||||
-rw-r--r-- | arch/score/include/asm/syscalls.h | 1 | ||||
-rw-r--r-- | arch/score/include/asm/unistd.h | 3 | ||||
-rw-r--r-- | arch/score/kernel/entry.S | 18 | ||||
-rw-r--r-- | arch/score/kernel/process.c | 8 | ||||
-rw-r--r-- | arch/score/kernel/sys_score.c | 35 |
6 files changed, 8 insertions, 58 deletions
diff --git a/arch/score/Kconfig b/arch/score/Kconfig index a285e78fb9c5..45893390c7dd 100644 --- a/arch/score/Kconfig +++ b/arch/score/Kconfig | |||
@@ -15,6 +15,7 @@ config SCORE | |||
15 | select MODULES_USE_ELF_REL | 15 | select MODULES_USE_ELF_REL |
16 | select GENERIC_KERNEL_THREAD | 16 | select GENERIC_KERNEL_THREAD |
17 | select GENERIC_KERNEL_EXECVE | 17 | select GENERIC_KERNEL_EXECVE |
18 | select CLONE_BACKWARDS | ||
18 | 19 | ||
19 | choice | 20 | choice |
20 | prompt "System type" | 21 | prompt "System type" |
diff --git a/arch/score/include/asm/syscalls.h b/arch/score/include/asm/syscalls.h index 8d332534342f..acaeed680956 100644 --- a/arch/score/include/asm/syscalls.h +++ b/arch/score/include/asm/syscalls.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SYSCALLS_H | 1 | #ifndef _ASM_SCORE_SYSCALLS_H |
2 | #define _ASM_SCORE_SYSCALLS_H | 2 | #define _ASM_SCORE_SYSCALLS_H |
3 | 3 | ||
4 | asmlinkage long score_clone(struct pt_regs *regs); | ||
5 | asmlinkage long score_sigaltstack(struct pt_regs *regs); | 4 | asmlinkage long score_sigaltstack(struct pt_regs *regs); |
6 | asmlinkage long score_rt_sigreturn(struct pt_regs *regs); | 5 | asmlinkage long score_rt_sigreturn(struct pt_regs *regs); |
7 | 6 | ||
diff --git a/arch/score/include/asm/unistd.h b/arch/score/include/asm/unistd.h index b006ca435120..56001c93095a 100644 --- a/arch/score/include/asm/unistd.h +++ b/arch/score/include/asm/unistd.h | |||
@@ -5,5 +5,8 @@ | |||
5 | #define __ARCH_WANT_SYSCALL_OFF_T | 5 | #define __ARCH_WANT_SYSCALL_OFF_T |
6 | #define __ARCH_WANT_SYSCALL_DEPRECATED | 6 | #define __ARCH_WANT_SYSCALL_DEPRECATED |
7 | #define __ARCH_WANT_SYS_EXECVE | 7 | #define __ARCH_WANT_SYS_EXECVE |
8 | #define __ARCH_WANT_SYS_CLONE | ||
9 | #define __ARCH_WANT_SYS_FORK | ||
10 | #define __ARCH_WANT_SYS_VFORK | ||
8 | 11 | ||
9 | #include <asm-generic/unistd.h> | 12 | #include <asm-generic/unistd.h> |
diff --git a/arch/score/kernel/entry.S b/arch/score/kernel/entry.S index da9901088bbb..1557ca1a2951 100644 --- a/arch/score/kernel/entry.S +++ b/arch/score/kernel/entry.S | |||
@@ -487,11 +487,6 @@ illegal_syscall: | |||
487 | sw r9, [r0, PT_R7] | 487 | sw r9, [r0, PT_R7] |
488 | j syscall_return | 488 | j syscall_return |
489 | 489 | ||
490 | ENTRY(sys_clone) | ||
491 | mv r4, r0 | ||
492 | la r8, score_clone | ||
493 | br r8 | ||
494 | |||
495 | ENTRY(sys_rt_sigreturn) | 490 | ENTRY(sys_rt_sigreturn) |
496 | mv r4, r0 | 491 | mv r4, r0 |
497 | la r8, score_rt_sigreturn | 492 | la r8, score_rt_sigreturn |
@@ -501,16 +496,3 @@ ENTRY(sys_sigaltstack) | |||
501 | mv r4, r0 | 496 | mv r4, r0 |
502 | la r8, score_sigaltstack | 497 | la r8, score_sigaltstack |
503 | br r8 | 498 | br r8 |
504 | |||
505 | #ifdef __ARCH_WANT_SYSCALL_DEPRECATED | ||
506 | ENTRY(sys_fork) | ||
507 | mv r4, r0 | ||
508 | la r8, score_fork | ||
509 | br r8 | ||
510 | |||
511 | ENTRY(sys_vfork) | ||
512 | mv r4, r0 | ||
513 | la r8, score_vfork | ||
514 | br r8 | ||
515 | #endif /* __ARCH_WANT_SYSCALL_DEPRECATED */ | ||
516 | |||
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c index 6f311cf64b99..f96379a5aee0 100644 --- a/arch/score/kernel/process.c +++ b/arch/score/kernel/process.c | |||
@@ -94,17 +94,17 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
94 | struct pt_regs *childregs = task_pt_regs(p); | 94 | struct pt_regs *childregs = task_pt_regs(p); |
95 | 95 | ||
96 | p->thread.reg0 = (unsigned long) childregs; | 96 | p->thread.reg0 = (unsigned long) childregs; |
97 | if (unlikely(!regs)) { | 97 | if (unlikely(p->flags & PF_KTHREAD)) { |
98 | memset(childregs, 0, sizeof(struct pt_regs)); | 98 | memset(childregs, 0, sizeof(struct pt_regs)); |
99 | p->thread->reg12 = usp; | 99 | p->thread->reg12 = usp; |
100 | p->thread->reg13 = arg; | 100 | p->thread->reg13 = arg; |
101 | p->thread.reg3 = (unsigned long) ret_from_kernel_thread; | 101 | p->thread.reg3 = (unsigned long) ret_from_kernel_thread; |
102 | } else { | 102 | } else { |
103 | *childregs = *regs; | 103 | *childregs = *current_pt_regs(); |
104 | childregs->regs[7] = 0; /* Clear error flag */ | 104 | childregs->regs[7] = 0; /* Clear error flag */ |
105 | childregs->regs[4] = 0; /* Child gets zero as return value */ | 105 | childregs->regs[4] = 0; /* Child gets zero as return value */ |
106 | childregs->regs[0] = usp; /* user fork */ | 106 | if (usp) |
107 | regs->regs[4] = p->pid; /* WTF? */ | 107 | childregs->regs[0] = usp; /* user fork */ |
108 | p->thread.reg3 = (unsigned long) ret_from_fork; | 108 | p->thread.reg3 = (unsigned long) ret_from_fork; |
109 | } | 109 | } |
110 | 110 | ||
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c index c54434c2fd9d..47c20ba46167 100644 --- a/arch/score/kernel/sys_score.c +++ b/arch/score/kernel/sys_score.c | |||
@@ -48,38 +48,3 @@ sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, | |||
48 | return -EINVAL; | 48 | return -EINVAL; |
49 | return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); | 49 | return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); |
50 | } | 50 | } |
51 | |||
52 | asmlinkage long | ||
53 | score_fork(struct pt_regs *regs) | ||
54 | { | ||
55 | return do_fork(SIGCHLD, regs->regs[0], regs, 0, NULL, NULL); | ||
56 | } | ||
57 | |||
58 | /* | ||
59 | * Clone a task - this clones the calling program thread. | ||
60 | * This is called indirectly via a small wrapper | ||
61 | */ | ||
62 | asmlinkage long | ||
63 | score_clone(struct pt_regs *regs) | ||
64 | { | ||
65 | unsigned long clone_flags; | ||
66 | unsigned long newsp; | ||
67 | int __user *parent_tidptr, *child_tidptr; | ||
68 | |||
69 | clone_flags = regs->regs[4]; | ||
70 | newsp = regs->regs[5]; | ||
71 | if (!newsp) | ||
72 | newsp = regs->regs[0]; | ||
73 | parent_tidptr = (int __user *)regs->regs[6]; | ||
74 | child_tidptr = (int __user *)regs->regs[8]; | ||
75 | |||
76 | return do_fork(clone_flags, newsp, regs, 0, | ||
77 | parent_tidptr, child_tidptr); | ||
78 | } | ||
79 | |||
80 | asmlinkage long | ||
81 | score_vfork(struct pt_regs *regs) | ||
82 | { | ||
83 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, | ||
84 | regs->regs[0], regs, 0, NULL, NULL); | ||
85 | } | ||