diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-15 16:37:12 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-31 22:59:39 -0400 |
commit | 8eae10e86c57b6be5e4842b34ea541efbca28bf8 (patch) | |
tree | 400a56bab5e2fdbf3cd4e30fab9f6eb5e3ada3ba /arch | |
parent | ea4a1da9b2e6f419526b5fde15cd5563096368eb (diff) |
m32r: switch to generic sys_execve()
... and get rid of the horrors in fork()/vfork()/clone() prototypes.
It's fscking faster to calculate pt_regs in question than to fetch
the pointer from stack...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/m32r/include/asm/ptrace.h | 2 | ||||
-rw-r--r-- | arch/m32r/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/m32r/kernel/process.c | 46 |
3 files changed, 13 insertions, 36 deletions
diff --git a/arch/m32r/include/asm/ptrace.h b/arch/m32r/include/asm/ptrace.h index 4313aa62b51b..c4432f1fb2cf 100644 --- a/arch/m32r/include/asm/ptrace.h +++ b/arch/m32r/include/asm/ptrace.h | |||
@@ -139,6 +139,8 @@ extern void withdraw_debug_trap(struct pt_regs *regs); | |||
139 | 139 | ||
140 | #define task_pt_regs(task) \ | 140 | #define task_pt_regs(task) \ |
141 | ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1) | 141 | ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1) |
142 | #define current_pt_regs() ((struct pt_regs *) \ | ||
143 | ((unsigned long)current_thread_info() + THREAD_SIZE) - 1) | ||
142 | 144 | ||
143 | #endif /* __KERNEL */ | 145 | #endif /* __KERNEL */ |
144 | 146 | ||
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h index d5e66a480782..b27bdcbc7c2c 100644 --- a/arch/m32r/include/asm/unistd.h +++ b/arch/m32r/include/asm/unistd.h | |||
@@ -352,6 +352,7 @@ | |||
352 | #define __ARCH_WANT_SYS_OLDUMOUNT | 352 | #define __ARCH_WANT_SYS_OLDUMOUNT |
353 | #define __ARCH_WANT_SYS_RT_SIGACTION | 353 | #define __ARCH_WANT_SYS_RT_SIGACTION |
354 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 354 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
355 | #define __ARCH_WANT_SYS_EXECVE | ||
355 | 356 | ||
356 | #define __IGNORE_lchown | 357 | #define __IGNORE_lchown |
357 | #define __IGNORE_setuid | 358 | #define __IGNORE_setuid |
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index fa89f027c04a..62c713f5694a 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c | |||
@@ -216,12 +216,11 @@ int copy_thread(unsigned long clone_flags, unsigned long spu, | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2, | 219 | asmlinkage int sys_fork(void) |
220 | unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, | ||
221 | struct pt_regs regs) | ||
222 | { | 220 | { |
223 | #ifdef CONFIG_MMU | 221 | #ifdef CONFIG_MMU |
224 | return do_fork(SIGCHLD, regs.spu, ®s, 0, NULL, NULL); | 222 | struct pt_regs *regs = current_pt_regs(); |
223 | return do_fork(SIGCHLD, regs->spu, regs, 0, NULL, NULL); | ||
225 | #else | 224 | #else |
226 | return -EINVAL; | 225 | return -EINVAL; |
227 | #endif /* CONFIG_MMU */ | 226 | #endif /* CONFIG_MMU */ |
@@ -229,14 +228,13 @@ asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2, | |||
229 | 228 | ||
230 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | 229 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, |
231 | unsigned long parent_tidptr, | 230 | unsigned long parent_tidptr, |
232 | unsigned long child_tidptr, | 231 | unsigned long child_tidptr) |
233 | unsigned long r4, unsigned long r5, unsigned long r6, | ||
234 | struct pt_regs regs) | ||
235 | { | 232 | { |
233 | struct pt_regs *regs = current_pt_regs(); | ||
236 | if (!newsp) | 234 | if (!newsp) |
237 | newsp = regs.spu; | 235 | newsp = regs->spu; |
238 | 236 | ||
239 | return do_fork(clone_flags, newsp, ®s, 0, | 237 | return do_fork(clone_flags, newsp, regs, 0, |
240 | (int __user *)parent_tidptr, (int __user *)child_tidptr); | 238 | (int __user *)parent_tidptr, (int __user *)child_tidptr); |
241 | } | 239 | } |
242 | 240 | ||
@@ -250,38 +248,14 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | |||
250 | * do not have enough call-clobbered registers to hold all | 248 | * do not have enough call-clobbered registers to hold all |
251 | * the information you need. | 249 | * the information you need. |
252 | */ | 250 | */ |
253 | asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2, | 251 | asmlinkage int sys_vfork(void) |
254 | unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, | ||
255 | struct pt_regs regs) | ||
256 | { | 252 | { |
257 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.spu, ®s, 0, | 253 | struct pt_regs *regs = current_pt_regs(); |
254 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->spu, regs, 0, | ||
258 | NULL, NULL); | 255 | NULL, NULL); |
259 | } | 256 | } |
260 | 257 | ||
261 | /* | 258 | /* |
262 | * sys_execve() executes a new program. | ||
263 | */ | ||
264 | asmlinkage int sys_execve(const char __user *ufilename, | ||
265 | const char __user *const __user *uargv, | ||
266 | const char __user *const __user *uenvp, | ||
267 | unsigned long r3, unsigned long r4, unsigned long r5, | ||
268 | unsigned long r6, struct pt_regs regs) | ||
269 | { | ||
270 | int error; | ||
271 | struct filename *filename; | ||
272 | |||
273 | filename = getname(ufilename); | ||
274 | error = PTR_ERR(filename); | ||
275 | if (IS_ERR(filename)) | ||
276 | goto out; | ||
277 | |||
278 | error = do_execve(filename->name, uargv, uenvp, ®s); | ||
279 | putname(filename); | ||
280 | out: | ||
281 | return error; | ||
282 | } | ||
283 | |||
284 | /* | ||
285 | * These bracket the sleeping functions.. | 259 | * These bracket the sleeping functions.. |
286 | */ | 260 | */ |
287 | #define first_sched ((unsigned long) scheduling_functions_start_here) | 261 | #define first_sched ((unsigned long) scheduling_functions_start_here) |