summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/i386/vfork.S
blob: d32b9b93dffafdf58a71cf5c49ca0ffe3426c5d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#
# usr/klibc/arch/i386/vfork.S
#
# vfork is nasty - there must be nothing at all on the stack above
# the stack frame of the enclosing function.
#
# We *MUST* use int $0x80, because calling the vdso would screw up
# our stack handling.
#
	
#include <asm/unistd.h>

        .text
        .align  4
	.globl	vfork
	.type	vfork, @function
vfork:
	popl	%edx			/* Return address */
	movl	$__NR_vfork, %eax
	int	$0x80			/* DO NOT call the vdso here! */
	pushl	%edx
	cmpl	$-4095, %eax
	jae	1f
	ret
1:
	negl	%eax
	movl	%eax, errno
	orl	$-1, %eax
	ret