[PATCH] provide kernel_execve on all architectures
[deliverable/linux.git] / arch / xtensa / kernel / syscalls.c
index 37c90ca5b98df35d3201f2c3fa9d3d3628d55097..d9285d4d5565bfbfa21ae1043697a2cdd5ba0f15 100644 (file)
@@ -266,3 +266,23 @@ void system_call (struct pt_regs *regs)
        regs->areg[2] = res;
        do_syscall_trace();
 }
+
+/*
+ * Do a system call from kernel instead of calling sys_execve so we
+ * end up with proper pt_regs.
+ */
+int kernel_execve(const char *filename, char *const argv[], char *const envp[])
+{
+       long __res;
+       asm volatile (
+               "  mov   a5, %2 \n"
+               "  mov   a4, %4 \n"
+               "  mov   a3, %3 \n"
+               "  movi  a2, %1 \n"
+               "  syscall      \n"
+               "  mov   %0, a2 \n"
+               : "=a" (__res)
+               : "i" (__NR_execve), "a" (filename), "a" (argv), "a" (envp)
+               : "a2", "a3", "a4", "a5");
+       return __res;
+}
This page took 0.027849 seconds and 5 git commands to generate.