4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #include <linux/file.h>
23 #include <linux/linkage.h>
25 #include <linux/module.h>
26 #include <linux/sched.h>
27 #include <linux/slab.h>
28 #include <linux/syscalls.h>
29 #include <linux/unistd.h>
31 #include <asm/registers.h>
34 * System calls with architecture-specific wrappers.
35 * See signal.c for signal-related system call wrappers.
38 asmlinkage int sys_execve(char __user *ufilename,
39 const char __user *const __user *argv,
40 const char __user *const __user *envp)
42 struct pt_regs *pregs = current_thread_info()->regs;
43 struct filename *filename;
46 filename = getname(ufilename);
47 retval = PTR_ERR(filename);
51 retval = do_execve(filename->name, argv, envp, pregs);
57 asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
58 unsigned long parent_tidp, unsigned long child_tidp)
60 struct pt_regs *pregs = current_thread_info()->regs;
64 return do_fork(clone_flags, newsp, pregs, 0, (int __user *)parent_tidp,
65 (int __user *)child_tidp);
69 * Do a system call from the kernel, so as to have a proper pt_regs
70 * and recycle the sys_execvpe infrustructure.
72 int kernel_execve(const char *filename,
73 const char *const argv[], const char *const envp[])
75 register unsigned long __a0 asm("r0") = (unsigned long) filename;
76 register unsigned long __a1 asm("r1") = (unsigned long) argv;
77 register unsigned long __a2 asm("r2") = (unsigned long) envp;
85 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_execve)