aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 15:22:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 15:22:13 -0500
commit9977d9b379cb77e0f67bd6f4563618106e58e11d (patch)
tree0191accfddf578edb52c69c933d64521e3dce297 /arch/frv
parentcf4af01221579a4e895f43dbfc47598fbfc5a731 (diff)
parent541880d9a2c7871f6370071d55aa6662d329c51e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull big execve/kernel_thread/fork unification series from Al Viro: "All architectures are converted to new model. Quite a bit of that stuff is actually shared with architecture trees; in such cases it's literally shared branch pulled by both, not a cherry-pick. A lot of ugliness and black magic is gone (-3KLoC total in this one): - kernel_thread()/kernel_execve()/sys_execve() redesign. We don't do syscalls from kernel anymore for either kernel_thread() or kernel_execve(): kernel_thread() is essentially clone(2) with callback run before we return to userland, the callbacks either never return or do successful do_execve() before returning. kernel_execve() is a wrapper for do_execve() - it doesn't need to do transition to user mode anymore. As a result kernel_thread() and kernel_execve() are arch-independent now - they live in kernel/fork.c and fs/exec.c resp. sys_execve() is also in fs/exec.c and it's completely architecture-independent. - daemonize() is gone, along with its parts in fs/*.c - struct pt_regs * is no longer passed to do_fork/copy_process/ copy_thread/do_execve/search_binary_handler/->load_binary/do_coredump. - sys_fork()/sys_vfork()/sys_clone() unified; some architectures still need wrappers (ones with callee-saved registers not saved in pt_regs on syscall entry), but the main part of those suckers is in kernel/fork.c now." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (113 commits) do_coredump(): get rid of pt_regs argument print_fatal_signal(): get rid of pt_regs argument ptrace_signal(): get rid of unused arguments get rid of ptrace_signal_deliver() arguments new helper: signal_pt_regs() unify default ptrace_signal_deliver flagday: kill pt_regs argument of do_fork() death to idle_regs() don't pass regs to copy_process() flagday: don't pass regs to copy_thread() bfin: switch to generic vfork, get rid of pointless wrappers xtensa: switch to generic clone() openrisc: switch to use of generic fork and clone unicore32: switch to generic clone(2) score: switch to generic fork/vfork/clone c6x: sanitize copy_thread(), get rid of clone(2) wrapper, switch to generic clone() take sys_fork/sys_vfork/sys_clone prototypes to linux/syscalls.h mn10300: switch to generic fork/vfork/clone h8300: switch to generic fork/vfork/clone tile: switch to generic clone() ... Conflicts: arch/microblaze/include/asm/Kbuild
Diffstat (limited to 'arch/frv')
-rw-r--r--arch/frv/include/asm/unistd.h3
-rw-r--r--arch/frv/kernel/process.c45
2 files changed, 8 insertions, 40 deletions
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index 2358634cacca..1807d8ea8cb5 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -30,6 +30,9 @@
30#define __ARCH_WANT_SYS_RT_SIGACTION 30#define __ARCH_WANT_SYS_RT_SIGACTION
31#define __ARCH_WANT_SYS_RT_SIGSUSPEND 31#define __ARCH_WANT_SYS_RT_SIGSUSPEND
32#define __ARCH_WANT_SYS_EXECVE 32#define __ARCH_WANT_SYS_EXECVE
33#define __ARCH_WANT_SYS_FORK
34#define __ARCH_WANT_SYS_VFORK
35#define __ARCH_WANT_SYS_CLONE
33 36
34/* 37/*
35 * "Conditional" syscalls 38 * "Conditional" syscalls
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;