2005-04-16 16:20:36 -06: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 16:36:13 -06:00
|
|
|
#include <linux/fs.h>
|
2005-04-16 16:20:36 -06: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-17 00:29:24 -06:00
|
|
|
#include <linux/ipc.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2008-06-07 06:34:42 -06:00
|
|
|
#include <linux/uaccess.h>
|
|
|
|
#include <linux/unistd.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2008-07-21 10:04:13 -06:00
|
|
|
#include <asm/syscalls.h>
|
|
|
|
|
2006-10-02 03:18:34 -06:00
|
|
|
/*
|
|
|
|
* Do a system call from kernel instead of calling sys_execve so we
|
|
|
|
* end up with proper pt_regs.
|
|
|
|
*/
|
2010-08-17 16:52:56 -06:00
|
|
|
int kernel_execve(const char *filename,
|
|
|
|
const char *const argv[],
|
|
|
|
const char *const envp[])
|
2006-10-02 03:18:34 -06:00
|
|
|
{
|
|
|
|
long __res;
|
|
|
|
asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
|
|
|
|
: "=a" (__res)
|
2008-06-07 06:34:42 -06:00
|
|
|
: "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
|
2006-10-02 03:18:34 -06:00
|
|
|
return __res;
|
|
|
|
}
|