aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r/kernel/sys_m32r.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m32r/kernel/sys_m32r.c')
-rw-r--r--arch/m32r/kernel/sys_m32r.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index 7c29396cc670..b567351f3c52 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -25,6 +25,8 @@
25#include <asm/cachectl.h> 25#include <asm/cachectl.h>
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/ipc.h> 27#include <asm/ipc.h>
28#include <asm/syscall.h>
29#include <asm/unistd.h>
28 30
29/* 31/*
30 * sys_tas() - test-and-set 32 * sys_tas() - test-and-set
@@ -223,3 +225,21 @@ asmlinkage int sys_cachectl(char *addr, int nbytes, int op)
223 return -ENOSYS; 225 return -ENOSYS;
224} 226}
225 227
228/*
229 * Do a system call from kernel instead of calling sys_execve so we
230 * end up with proper pt_regs.
231 */
232int kernel_execve(const char *filename, char *const argv[], char *const envp[])
233{
234 register long __scno __asm__ ("r7") = __NR_execve;
235 register long __arg3 __asm__ ("r2") = (long)(envp);
236 register long __arg2 __asm__ ("r1") = (long)(argv);
237 register long __res __asm__ ("r0") = (long)(filename);
238 __asm__ __volatile__ (
239 "trap #" SYSCALL_VECTOR "|| nop"
240 : "=r" (__res)
241 : "r" (__scno), "0" (__res), "r" (__arg2),
242 "r" (__arg3)
243 : "memory");
244 return __res;
245}