summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/x86_64/vfork.S
blob: e1c8090af4a20677103b4a1874d0cc9b4092c308 (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
#
# usr/klibc/arch/x86_64/vfork.S
#
# vfork is nasty - there must be nothing at all on the stack above
# the stack frame of the enclosing function.
#

#include <asm/unistd.h>

	.text
	.align	4
	.globl	vfork
	.type	vfork, @function
vfork:
	pop	%rdx			/* Return address */
	movl	$__NR_vfork, %eax
	syscall
	push	%rdx
	cmpq	$-4095, %rax
	jae	1f
	ret
1:
	negl	%eax
	movl	%eax, errno(%rip)
	orq	$-1, %rax
	ret