Merge master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-drm-fsl-dcu.git] / arch / v850 / kernel / syscalls.c
index 2ec0700fc46bc75cc0ab9c312c0be75cdba674b9..f9f00ccf53245e4aa4e0fe36b833e3fc5b69fed4 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 #include <linux/syscalls.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
@@ -33,6 +32,7 @@
 #include <asm/uaccess.h>
 #include <asm/ipc.h>
 #include <asm/semaphore.h>
+#include <asm/unistd.h>
 
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
@@ -194,3 +194,22 @@ unsigned long sys_mmap (unsigned long addr, size_t len,
 out:
        return err;
 }
+
+/*
+ * 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[])
+{
+       register char *__a __asm__ ("r6") = filename;
+       register void *__b __asm__ ("r7") = argv;
+       register void *__c __asm__ ("r8") = envp;
+       register unsigned long __syscall __asm__ ("r12") = __NR_execve;
+       register unsigned long __ret __asm__ ("r10");
+       __asm__ __volatile__ ("trap 0"
+                       : "=r" (__ret), "=r" (__syscall)
+                       : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c)
+                       : "r1", "r5", "r11", "r13", "r14",
+                         "r15", "r16", "r17", "r18", "r19");
+       return __ret;
+}