diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-26 19:44:26 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-16 19:03:12 -0400 |
commit | eb48ffcf0e55e511ae87e9d99117d5e2b9e27153 (patch) | |
tree | 44c36daed6184943ecb740af487d80e8870924d6 /arch/sparc | |
parent | 2f12af35a988082700373acdebe049dfebaf49b6 (diff) |
sparc64: convert to generic execve
We still have wrappers, but nowhere near as scary as they used to be.
I'm not sure how necessary that flushw is now, TBH...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/asm/syscalls.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/process_64.c | 29 | ||||
-rw-r--r-- | arch/sparc/kernel/sys_sparc32.c | 29 | ||||
-rw-r--r-- | arch/sparc/kernel/syscalls.S | 20 | ||||
-rw-r--r-- | arch/sparc/kernel/systbls_64.S | 2 |
6 files changed, 12 insertions, 71 deletions
diff --git a/arch/sparc/include/asm/syscalls.h b/arch/sparc/include/asm/syscalls.h index 45a43f637a14..4b05df397740 100644 --- a/arch/sparc/include/asm/syscalls.h +++ b/arch/sparc/include/asm/syscalls.h | |||
@@ -8,6 +8,8 @@ extern asmlinkage long sparc_do_fork(unsigned long clone_flags, | |||
8 | struct pt_regs *regs, | 8 | struct pt_regs *regs, |
9 | unsigned long stack_size); | 9 | unsigned long stack_size); |
10 | 10 | ||
11 | #ifndef __arch64__ | ||
11 | extern asmlinkage int sparc_execve(struct pt_regs *regs); | 12 | extern asmlinkage int sparc_execve(struct pt_regs *regs); |
13 | #endif | ||
12 | 14 | ||
13 | #endif /* _SPARC64_SYSCALLS_H */ | 15 | #endif /* _SPARC64_SYSCALLS_H */ |
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index 0ecea6ed943e..32bd0aaeedfa 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h | |||
@@ -45,6 +45,7 @@ | |||
45 | #define __ARCH_WANT_COMPAT_SYS_TIME | 45 | #define __ARCH_WANT_COMPAT_SYS_TIME |
46 | #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND | 46 | #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND |
47 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE | 47 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE |
48 | #define __ARCH_WANT_SYS_EXECVE | ||
48 | #endif | 49 | #endif |
49 | 50 | ||
50 | /* | 51 | /* |
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index 55aa68da213b..6b36e879b2a0 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c | |||
@@ -667,35 +667,6 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs) | |||
667 | } | 667 | } |
668 | EXPORT_SYMBOL(dump_fpu); | 668 | EXPORT_SYMBOL(dump_fpu); |
669 | 669 | ||
670 | /* | ||
671 | * sparc_execve() executes a new program after the asm stub has set | ||
672 | * things up for us. This should basically do what I want it to. | ||
673 | */ | ||
674 | asmlinkage int sparc_execve(struct pt_regs *regs) | ||
675 | { | ||
676 | int error, base = 0; | ||
677 | struct filename *filename; | ||
678 | |||
679 | /* User register window flush is done by entry.S */ | ||
680 | |||
681 | /* Check for indirect call. */ | ||
682 | if (regs->u_regs[UREG_G1] == 0) | ||
683 | base = 1; | ||
684 | |||
685 | filename = getname((char __user *)regs->u_regs[base + UREG_I0]); | ||
686 | error = PTR_ERR(filename); | ||
687 | if (IS_ERR(filename)) | ||
688 | goto out; | ||
689 | error = do_execve(filename->name, | ||
690 | (const char __user *const __user *) | ||
691 | regs->u_regs[base + UREG_I1], | ||
692 | (const char __user *const __user *) | ||
693 | regs->u_regs[base + UREG_I2], regs); | ||
694 | putname(filename); | ||
695 | out: | ||
696 | return error; | ||
697 | } | ||
698 | |||
699 | unsigned long get_wchan(struct task_struct *task) | 670 | unsigned long get_wchan(struct task_struct *task) |
700 | { | 671 | { |
701 | unsigned long pc, fp, bias = 0; | 672 | unsigned long pc, fp, bias = 0; |
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c index 2f116ff46b11..03c7e929ec34 100644 --- a/arch/sparc/kernel/sys_sparc32.c +++ b/arch/sparc/kernel/sys_sparc32.c | |||
@@ -396,35 +396,6 @@ asmlinkage long compat_sys_rt_sigaction(int sig, | |||
396 | return ret; | 396 | return ret; |
397 | } | 397 | } |
398 | 398 | ||
399 | /* | ||
400 | * sparc32_execve() executes a new program after the asm stub has set | ||
401 | * things up for us. This should basically do what I want it to. | ||
402 | */ | ||
403 | asmlinkage long sparc32_execve(struct pt_regs *regs) | ||
404 | { | ||
405 | int error, base = 0; | ||
406 | struct filename *filename; | ||
407 | |||
408 | /* User register window flush is done by entry.S */ | ||
409 | |||
410 | /* Check for indirect call. */ | ||
411 | if ((u32)regs->u_regs[UREG_G1] == 0) | ||
412 | base = 1; | ||
413 | |||
414 | filename = getname(compat_ptr(regs->u_regs[base + UREG_I0])); | ||
415 | error = PTR_ERR(filename); | ||
416 | if (IS_ERR(filename)) | ||
417 | goto out; | ||
418 | |||
419 | error = compat_do_execve(filename->name, | ||
420 | compat_ptr(regs->u_regs[base + UREG_I1]), | ||
421 | compat_ptr(regs->u_regs[base + UREG_I2]), regs); | ||
422 | |||
423 | putname(filename); | ||
424 | out: | ||
425 | return error; | ||
426 | } | ||
427 | |||
428 | #ifdef CONFIG_MODULES | 399 | #ifdef CONFIG_MODULES |
429 | 400 | ||
430 | asmlinkage long sys32_init_module(void __user *umod, u32 len, | 401 | asmlinkage long sys32_init_module(void __user *umod, u32 len, |
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S index f72c12433869..2ef41e67f0be 100644 --- a/arch/sparc/kernel/syscalls.S +++ b/arch/sparc/kernel/syscalls.S | |||
@@ -1,23 +1,19 @@ | |||
1 | /* SunOS's execv() call only specifies the argv argument, the | 1 | /* SunOS's execv() call only specifies the argv argument, the |
2 | * environment settings are the same as the calling processes. | 2 | * environment settings are the same as the calling processes. |
3 | */ | 3 | */ |
4 | sys_execve: | 4 | sys64_execve: |
5 | sethi %hi(sparc_execve), %g1 | 5 | set sys_execve, %g1 |
6 | ba,pt %xcc, execve_merge | 6 | jmpl %g1, %g0 |
7 | or %g1, %lo(sparc_execve), %g1 | 7 | flushw |
8 | 8 | ||
9 | #ifdef CONFIG_COMPAT | 9 | #ifdef CONFIG_COMPAT |
10 | sunos_execv: | 10 | sunos_execv: |
11 | stx %g0, [%sp + PTREGS_OFF + PT_V9_I2] | 11 | mov %g0, %o2 |
12 | sys32_execve: | 12 | sys32_execve: |
13 | sethi %hi(sparc32_execve), %g1 | 13 | set compat_sys_execve, %g1 |
14 | or %g1, %lo(sparc32_execve), %g1 | ||
15 | #endif | ||
16 | |||
17 | execve_merge: | ||
18 | flushw | ||
19 | jmpl %g1, %g0 | 14 | jmpl %g1, %g0 |
20 | add %sp, PTREGS_OFF, %o0 | 15 | flushw |
16 | #endif | ||
21 | 17 | ||
22 | .align 32 | 18 | .align 32 |
23 | sys_sparc_pipe: | 19 | sys_sparc_pipe: |
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index 3a58e0d66f51..acad343667d0 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
@@ -106,7 +106,7 @@ sys_call_table: | |||
106 | /*40*/ .word sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_nis_syscall | 106 | /*40*/ .word sys_newlstat, sys_dup, sys_sparc_pipe, sys_times, sys_nis_syscall |
107 | .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid | 107 | .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid |
108 | /*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl | 108 | /*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl |
109 | .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve | 109 | .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys64_execve |
110 | /*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize | 110 | /*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize |
111 | .word sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_nis_syscall | 111 | .word sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_nis_syscall |
112 | /*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys_64_munmap, sys_mprotect | 112 | /*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys_64_munmap, sys_mprotect |