diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-28 14:20:01 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-16 19:03:53 -0400 |
commit | ab3486813bbbd9e74efb4c130183f3994dada4bd (patch) | |
tree | 360d3fd62ca0b9d7940573091b5d700c4471b78a /arch/sparc | |
parent | c78e06430ea621ce59d20cb899a9a86bdcf4487b (diff) |
sparc32: switch to generic kernel_execve()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/Kconfig | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/ptrace.h | 3 | ||||
-rw-r--r-- | arch/sparc/kernel/entry.S | 11 | ||||
-rw-r--r-- | arch/sparc/kernel/sys_sparc_32.c | 24 |
4 files changed, 13 insertions, 27 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index edc4ede8ec3e..e52f3c2ad3dd 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -41,6 +41,7 @@ config SPARC | |||
41 | select GENERIC_STRNLEN_USER | 41 | select GENERIC_STRNLEN_USER |
42 | select MODULES_USE_ELF_RELA | 42 | select MODULES_USE_ELF_RELA |
43 | select GENERIC_KERNEL_THREAD | 43 | select GENERIC_KERNEL_THREAD |
44 | select GENERIC_KERNEL_EXECVE | ||
44 | 45 | ||
45 | config SPARC32 | 46 | config SPARC32 |
46 | def_bool !64BIT | 47 | def_bool !64BIT |
@@ -75,7 +76,6 @@ config SPARC64 | |||
75 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 76 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
76 | select HAVE_C_RECORDMCOUNT | 77 | select HAVE_C_RECORDMCOUNT |
77 | select NO_BOOTMEM | 78 | select NO_BOOTMEM |
78 | select GENERIC_KERNEL_EXECVE | ||
79 | 79 | ||
80 | config ARCH_DEFCONFIG | 80 | config ARCH_DEFCONFIG |
81 | string | 81 | string |
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h index 7a4075003e76..1e8b81802263 100644 --- a/arch/sparc/include/asm/ptrace.h +++ b/arch/sparc/include/asm/ptrace.h | |||
@@ -90,6 +90,9 @@ static inline bool pt_regs_clear_syscall(struct pt_regs *regs) | |||
90 | #define arch_ptrace_stop(exit_code, info) \ | 90 | #define arch_ptrace_stop(exit_code, info) \ |
91 | synchronize_user_stack() | 91 | synchronize_user_stack() |
92 | 92 | ||
93 | #define current_pt_regs() \ | ||
94 | ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE) - 1) | ||
95 | |||
93 | #define user_mode(regs) (!((regs)->psr & PSR_PS)) | 96 | #define user_mode(regs) (!((regs)->psr & PSR_PS)) |
94 | #define instruction_pointer(regs) ((regs)->pc) | 97 | #define instruction_pointer(regs) ((regs)->pc) |
95 | #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) | 98 | #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) |
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S index 6114672a1b0e..36b35e54a6de 100644 --- a/arch/sparc/kernel/entry.S +++ b/arch/sparc/kernel/entry.S | |||
@@ -990,8 +990,15 @@ ret_from_kernel_thread: | |||
990 | ld [%sp + STACKFRAME_SZ + PT_G1], %l0 | 990 | ld [%sp + STACKFRAME_SZ + PT_G1], %l0 |
991 | call %l0 | 991 | call %l0 |
992 | ld [%sp + STACKFRAME_SZ + PT_G2], %o0 | 992 | ld [%sp + STACKFRAME_SZ + PT_G2], %o0 |
993 | call do_exit /* won't return */ | 993 | rd %psr, %l1 |
994 | clr %o0 | 994 | ld [%sp + STACKFRAME_SZ + PT_PSR], %l0 |
995 | andn %l0, PSR_CWP, %l0 | ||
996 | nop | ||
997 | and %l1, PSR_CWP, %l1 | ||
998 | or %l0, %l1, %l0 | ||
999 | st %l0, [%sp + STACKFRAME_SZ + PT_PSR] | ||
1000 | b ret_sys_call | ||
1001 | mov 0, %o0 | ||
995 | 1002 | ||
996 | /* Linux native system calls enter here... */ | 1003 | /* Linux native system calls enter here... */ |
997 | .align 4 | 1004 | .align 4 |
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c index 0c9b31b22e07..a8e6eb0a11d5 100644 --- a/arch/sparc/kernel/sys_sparc_32.c +++ b/arch/sparc/kernel/sys_sparc_32.c | |||
@@ -258,27 +258,3 @@ out: | |||
258 | up_read(&uts_sem); | 258 | up_read(&uts_sem); |
259 | return err; | 259 | return err; |
260 | } | 260 | } |
261 | |||
262 | /* | ||
263 | * Do a system call from kernel instead of calling sys_execve so we | ||
264 | * end up with proper pt_regs. | ||
265 | */ | ||
266 | int kernel_execve(const char *filename, | ||
267 | const char *const argv[], | ||
268 | const char *const envp[]) | ||
269 | { | ||
270 | long __res; | ||
271 | register long __g1 __asm__ ("g1") = __NR_execve; | ||
272 | register long __o0 __asm__ ("o0") = (long)(filename); | ||
273 | register long __o1 __asm__ ("o1") = (long)(argv); | ||
274 | register long __o2 __asm__ ("o2") = (long)(envp); | ||
275 | asm volatile ("t 0x10\n\t" | ||
276 | "bcc 1f\n\t" | ||
277 | "mov %%o0, %0\n\t" | ||
278 | "sub %%g0, %%o0, %0\n\t" | ||
279 | "1:\n\t" | ||
280 | : "=r" (__res), "=&r" (__o0) | ||
281 | : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) | ||
282 | : "cc"); | ||
283 | return __res; | ||
284 | } | ||