aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/sys_sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/sys_sh.c')
-rw-r--r--arch/sh/kernel/sys_sh.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 11c2acde6eaa..8fde95001c34 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -25,6 +25,7 @@
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/ipc.h> 27#include <asm/ipc.h>
28#include <asm/unistd.h>
28 29
29/* 30/*
30 * sys_pipe() is the normal C calling standard for creating 31 * sys_pipe() is the normal C calling standard for creating
@@ -309,3 +310,19 @@ asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1,
309 (u64)len0 << 32 | len1, advice); 310 (u64)len0 << 32 | len1, advice);
310#endif 311#endif
311} 312}
313
314/*
315 * Do a system call from kernel instead of calling sys_execve so we
316 * end up with proper pt_regs.
317 */
318int kernel_execve(const char *filename, char *const argv[], char *const envp[])
319{
320 register long __sc0 __asm__ ("r3") = __NR_execve;
321 register long __sc4 __asm__ ("r4") = (long) filename;
322 register long __sc5 __asm__ ("r5") = (long) argv;
323 register long __sc6 __asm__ ("r6") = (long) envp;
324 __asm__ __volatile__ ("trapa #0x13" : "=z" (__sc0)
325 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6)
326 : "memory");
327 return __sc0;
328}