vfork.S revision 217106
12088Ssos/*-
25994Ssos * Copyright (c) 1990 The Regents of the University of California.
32088Ssos * All rights reserved.
42088Ssos *
52088Ssos * This code is derived from software contributed to Berkeley by
62088Ssos * William Jolitz.
72088Ssos *
82088Ssos * Redistribution and use in source and binary forms, with or without
95994Ssos * modification, are permitted provided that the following conditions
105994Ssos * are met:
112088Ssos * 1. Redistributions of source code must retain the above copyright
122088Ssos *    notice, this list of conditions and the following disclaimer.
132088Ssos * 2. Redistributions in binary form must reproduce the above copyright
142088Ssos *    notice, this list of conditions and the following disclaimer in the
1597748Sschweikh *    documentation and/or other materials provided with the distribution.
162088Ssos * 4. Neither the name of the University nor the names of its contributors
172088Ssos *    may be used to endorse or promote products derived from this software
182088Ssos *    without specific prior written permission.
192088Ssos *
202088Ssos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
212088Ssos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
222088Ssos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
232088Ssos * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
242088Ssos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
252088Ssos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
262088Ssos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
272088Ssos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2850479Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
292088Ssos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
302088Ssos * SUCH DAMAGE.
312088Ssos */
322088Ssos
332088Ssos#if defined(SYSLIBC_SCCS) && !defined(lint)
342088Ssos	.asciz "@(#)Ovfork.s	5.1 (Berkeley) 4/23/90"
352088Ssos#endif /* SYSLIBC_SCCS and not lint */
362088Ssos#include <machine/asm.h>
372088Ssos__FBSDID("$FreeBSD: head/lib/libc/amd64/sys/vfork.S 217106 2011-01-07 16:08:40Z kib $");
382088Ssos
392088Ssos#include "SYS.h"
402088Ssos
412088Ssos	.weak	_vfork
422088Ssos	.set	_vfork,__sys_vfork
432088Ssos	.weak	vfork
442088Ssos	.set	vfork,__sys_vfork
452088SsosENTRY(__sys_vfork)
462088Ssos	popq	%rsi		/* fetch return address (%rsi preserved) */
472088Ssos	mov	$SYS_vfork,%rax
482088Ssos	KERNCALL
492088Ssos	jb	1f
502088Ssos	jmp	*%rsi
512088Ssos1:
522088Ssos	pushq	%rsi
535994Ssos#ifdef PIC
5432316Syokota	movq	PIC_GOT(HIDENAME(cerror)),%rdx
5538053Syokota	jmp	*%rdx
5648105Syokota#else
5754380Syokota	jmp	HIDENAME(cerror)
5854380Syokota#endif
5954380SyokotaEND(__sys_vfork)
6054380Syokota
6154380Syokota	.section .note.GNU-stack,"",%progbits
6254380Syokota