OSDN Git Service

Kill the runtime fallback to fork and make it be compile time
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / i386 / vfork.S
1 /*
2  * June 3, 2003             Erik Andersen
3  *
4  */
5
6 #define _ERRNO_H        1
7 #include <bits/errno.h>
8 #include <sys/syscall.h>
9
10 #ifndef __NR_vfork
11
12 /* No vfork so use fork instead */
13 .weak vfork ; vfork = __libc_fork
14
15 #else
16
17         .text
18         .globl __vfork;
19         .type __vfork,@function;
20         .align 1<<4;
21         
22 __vfork:
23         popl %ecx
24         movl $__NR_vfork,%eax
25         int $0x80
26         pushl %ecx
27         cmpl $-4095,%eax
28         jae __syscall_error
29         ret
30
31 __syscall_error:
32         negl    %eax
33         pushl   %eax
34 #ifdef __PIC__
35         call .Lthere
36 .Lthere:
37         popl    %ebx
38         addl    $_GLOBAL_OFFSET_TABLE_+[.- .Lthere  ], %ebx
39         call    __errno_location@PLT
40 #else
41         call    __errno_location
42 #endif
43         popl    %ecx
44         movl    %ecx, (%eax)
45         xorl    %eax, %eax
46         decl    %eax
47
48 .Lsize:
49         .size    __vfork,.Lsize-__vfork
50
51
52 .weak vfork ; vfork = __vfork
53 #endif