sys_i386_32.c 929 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * This file contains various random system calls that
  3. * have a non-standard calling sequence on the Linux/i386
  4. * platform.
  5. */
  6. #include <linux/errno.h>
  7. #include <linux/sched.h>
  8. #include <linux/mm.h>
  9. #include <linux/fs.h>
  10. #include <linux/smp.h>
  11. #include <linux/sem.h>
  12. #include <linux/msg.h>
  13. #include <linux/shm.h>
  14. #include <linux/stat.h>
  15. #include <linux/syscalls.h>
  16. #include <linux/mman.h>
  17. #include <linux/file.h>
  18. #include <linux/utsname.h>
  19. #include <linux/ipc.h>
  20. #include <linux/uaccess.h>
  21. #include <linux/unistd.h>
  22. #include <asm/syscalls.h>
  23. /*
  24. * Do a system call from kernel instead of calling sys_execve so we
  25. * end up with proper pt_regs.
  26. */
  27. int kernel_execve(const char *filename, char *const argv[], char *const envp[])
  28. {
  29. long __res;
  30. asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
  31. : "=a" (__res)
  32. : "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
  33. return __res;
  34. }