sys_i386_32.c 949 字节
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9
/*
 * 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>
A
Alexey Dobriyan 已提交
10
#include <linux/fs.h>
L
Linus Torvalds 已提交
11 12 13 14 15 16 17 18 19
#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>
A
Adrian Bunk 已提交
20
#include <linux/ipc.h>
L
Linus Torvalds 已提交
21

22 23
#include <linux/uaccess.h>
#include <linux/unistd.h>
L
Linus Torvalds 已提交
24

25 26
#include <asm/syscalls.h>

27 28 29 30
/*
 * Do a system call from kernel instead of calling sys_execve so we
 * end up with proper pt_regs.
 */
31 32 33
int kernel_execve(const char *filename,
		  const char *const argv[],
		  const char *const envp[])
34 35 36 37
{
	long __res;
	asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
	: "=a" (__res)
38
	: "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
39 40
	return __res;
}