2005-04-16 15:20:36 -07:00
|
|
|
/*
|
|
|
|
* This file contains various random system calls that
|
|
|
|
* have a non-standard calling sequence on the Linux/i386
|
|
|
|
* platform.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/mm.h>
|
2007-07-29 15:36:13 -07:00
|
|
|
#include <linux/fs.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <linux/sem.h>
|
|
|
|
#include <linux/msg.h>
|
|
|
|
#include <linux/shm.h>
|
|
|
|
#include <linux/stat.h>
|
|
|
|
#include <linux/syscalls.h>
|
|
|
|
#include <linux/mman.h>
|
|
|
|
#include <linux/file.h>
|
|
|
|
#include <linux/utsname.h>
|
2007-10-16 23:29:24 -07:00
|
|
|
#include <linux/ipc.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-06-07 05:34:42 -07:00
|
|
|
#include <linux/uaccess.h>
|
|
|
|
#include <linux/unistd.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-07-21 09:04:13 -07:00
|
|
|
#include <asm/syscalls.h>
|
|
|
|
|
2006-10-02 02:18:34 -07:00
|
|
|
/*
|
|
|
|
* Do a system call from kernel instead of calling sys_execve so we
|
|
|
|
* end up with proper pt_regs.
|
|
|
|
*/
|
2010-08-17 15:52:56 -07:00
|
|
|
int kernel_execve(const char *filename,
|
|
|
|
const char *const argv[],
|
|
|
|
const char *const envp[])
|
2006-10-02 02:18:34 -07:00
|
|
|
{
|
|
|
|
long __res;
|
2010-09-02 06:01:58 -07:00
|
|
|
asm volatile ("int $0x80"
|
2006-10-02 02:18:34 -07:00
|
|
|
: "=a" (__res)
|
2010-09-02 06:01:58 -07:00
|
|
|
: "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory");
|
2006-10-02 02:18:34 -07:00
|
|
|
return __res;
|
|
|
|
}
|