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