Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * This file contains various random system calls that |
| 3 | * have a non-standard calling sequence on the Linux/i386 |
| 4 | * platform. |
| 5 | */ |
| 6 | |
| 7 | #include <linux/errno.h> |
| 8 | #include <linux/sched.h> |
| 9 | #include <linux/mm.h> |
Alexey Dobriyan | 4e950f6 | 2007-07-30 02:36:13 +0400 | [diff] [blame] | 10 | #include <linux/fs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/smp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/sem.h> |
| 13 | #include <linux/msg.h> |
| 14 | #include <linux/shm.h> |
| 15 | #include <linux/stat.h> |
| 16 | #include <linux/syscalls.h> |
| 17 | #include <linux/mman.h> |
| 18 | #include <linux/file.h> |
| 19 | #include <linux/utsname.h> |
Adrian Bunk | cba4fbb | 2007-10-16 23:29:24 -0700 | [diff] [blame] | 20 | #include <linux/ipc.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Paolo Ciarrocchi | 5b80fe8 | 2008-06-07 14:34:42 +0200 | [diff] [blame] | 22 | #include <linux/uaccess.h> |
| 23 | #include <linux/unistd.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
Jaswinder Singh | bbc1f69 | 2008-07-21 21:34:13 +0530 | [diff] [blame] | 25 | #include <asm/syscalls.h> |
| 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | /* |
Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 28 | * Do a system call from kernel instead of calling sys_execve so we |
| 29 | * end up with proper pt_regs. |
| 30 | */ |
David Howells | d762746 | 2010-08-17 23:52:56 +0100 | [diff] [blame] | 31 | int kernel_execve(const char *filename, |
| 32 | const char *const argv[], |
| 33 | const char *const envp[]) |
Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 34 | { |
| 35 | long __res; |
Jan Beulich | 7fe977d | 2010-09-02 14:01:58 +0100 | [diff] [blame] | 36 | asm volatile ("int $0x80" |
Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 37 | : "=a" (__res) |
Jan Beulich | 7fe977d | 2010-09-02 14:01:58 +0100 | [diff] [blame] | 38 | : "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory"); |
Arnd Bergmann | fe74290 | 2006-10-02 02:18:34 -0700 | [diff] [blame] | 39 | return __res; |
| 40 | } |