blob: 235be0c0e57057f00c802e481babd77cc31b9bac [file] [log] [blame]
Elliott Hughesbdff26d2013-02-11 17:08:16 -08001#include <machine/asm.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08002#include <sys/linux-syscalls.h>
3
4#ifndef __NR_vfork
5#define __NR_vfork 190
6#endif
7
8
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08009/* Get rid of the stack modifications (popl/ret) after vfork() success.
10 * vfork is VERY sneaky. One has to be very careful about what can be done
11 * between a successful vfork and a a subsequent execve()
12 */
13
Elliott Hughesbdff26d2013-02-11 17:08:16 -080014ENTRY(vfork)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015 /* grab the return address */
16 popl %ecx
17 movl $__NR_vfork, %eax
18 int $0x80
19 cmpl $-129, %eax
20 jb 1f
21 negl %eax
22 pushl %eax
23 call __set_errno
24 orl $-1, %eax
251:
26 jmp *%ecx
Elliott Hughesbdff26d2013-02-11 17:08:16 -080027END(vfork)