Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 1 | #include <machine/asm.h> |
Elliott Hughes | 5c2772f | 2013-03-21 22:15:06 -0700 | [diff] [blame] | 2 | #include <asm/unistd.h> |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 3 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 4 | /* Get rid of the stack modifications (popl/ret) after vfork() success. |
| 5 | * vfork is VERY sneaky. One has to be very careful about what can be done |
| 6 | * between a successful vfork and a a subsequent execve() |
| 7 | */ |
| 8 | |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 9 | ENTRY(vfork) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 10 | /* grab the return address */ |
| 11 | popl %ecx |
| 12 | movl $__NR_vfork, %eax |
| 13 | int $0x80 |
| 14 | cmpl $-129, %eax |
| 15 | jb 1f |
| 16 | negl %eax |
| 17 | pushl %eax |
| 18 | call __set_errno |
| 19 | orl $-1, %eax |
| 20 | 1: |
| 21 | jmp *%ecx |
Elliott Hughes | bdff26d | 2013-02-11 17:08:16 -0800 | [diff] [blame] | 22 | END(vfork) |