blob: 0b0cb5fede1993d8dc45b54ffcf27ff8732c3082 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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 Dobriyan4e950f62007-07-30 02:36:13 +040010#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/smp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#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 Bunkcba4fbb2007-10-16 23:29:24 -070020#include <linux/ipc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Paolo Ciarrocchi5b80fe82008-06-07 14:34:42 +020022#include <linux/uaccess.h>
23#include <linux/unistd.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Jaswinder Singhbbc1f692008-07-21 21:34:13 +053025#include <asm/syscalls.h>
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027/*
Arnd Bergmannfe742902006-10-02 02:18:34 -070028 * Do a system call from kernel instead of calling sys_execve so we
29 * end up with proper pt_regs.
30 */
David Howellsd7627462010-08-17 23:52:56 +010031int kernel_execve(const char *filename,
32 const char *const argv[],
33 const char *const envp[])
Arnd Bergmannfe742902006-10-02 02:18:34 -070034{
35 long __res;
Jan Beulich7fe977d2010-09-02 14:01:58 +010036 asm volatile ("int $0x80"
Arnd Bergmannfe742902006-10-02 02:18:34 -070037 : "=a" (__res)
Jan Beulich7fe977d2010-09-02 14:01:58 +010038 : "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory");
Arnd Bergmannfe742902006-10-02 02:18:34 -070039 return __res;
40}