xref: /netbsd-src/lib/libc/arch/x86_64/sys/fork.S (revision 92d1d4411b9f8cbaff3d5eb0b336fcc1c32deb29)
1*92d1d441Suebayasi/*	$NetBSD: fork.S,v 1.4 2014/05/22 15:01:57 uebayasi Exp $	*/
210f59d7bSfvdl
310f59d7bSfvdl/*-
410f59d7bSfvdl * Copyright (c) 1990 The Regents of the University of California.
510f59d7bSfvdl * All rights reserved.
610f59d7bSfvdl *
710f59d7bSfvdl * This code is derived from software contributed to Berkeley by
810f59d7bSfvdl * William Jolitz.
910f59d7bSfvdl *
1010f59d7bSfvdl * Redistribution and use in source and binary forms, with or without
1110f59d7bSfvdl * modification, are permitted provided that the following conditions
1210f59d7bSfvdl * are met:
1310f59d7bSfvdl * 1. Redistributions of source code must retain the above copyright
1410f59d7bSfvdl *    notice, this list of conditions and the following disclaimer.
1510f59d7bSfvdl * 2. Redistributions in binary form must reproduce the above copyright
1610f59d7bSfvdl *    notice, this list of conditions and the following disclaimer in the
1710f59d7bSfvdl *    documentation and/or other materials provided with the distribution.
18eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
1910f59d7bSfvdl *    may be used to endorse or promote products derived from this software
2010f59d7bSfvdl *    without specific prior written permission.
2110f59d7bSfvdl *
2210f59d7bSfvdl * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2310f59d7bSfvdl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2410f59d7bSfvdl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2510f59d7bSfvdl * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2610f59d7bSfvdl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2710f59d7bSfvdl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2810f59d7bSfvdl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2910f59d7bSfvdl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3010f59d7bSfvdl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3110f59d7bSfvdl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3210f59d7bSfvdl * SUCH DAMAGE.
3310f59d7bSfvdl *
3410f59d7bSfvdl *	from: @(#)fork.s	5.1 (Berkeley) 4/23/90
3510f59d7bSfvdl */
3610f59d7bSfvdl
3710f59d7bSfvdl#include <machine/asm.h>
3810f59d7bSfvdl#if defined(SYSLIBC_SCCS) && !defined(lint)
39*92d1d441Suebayasi	RCSID("$NetBSD: fork.S,v 1.4 2014/05/22 15:01:57 uebayasi Exp $")
4010f59d7bSfvdl#endif /* SYSLIBC_SCCS and not lint */
4110f59d7bSfvdl
4210f59d7bSfvdl#include "SYS.h"
4310f59d7bSfvdl
444fb740b8Snathanw_SYSCALL(__fork,fork)
4510f59d7bSfvdl	decl	%edx	/* from 1 to 0 in child, 0 to -1 in parent */
4610f59d7bSfvdl	andl	%edx,%eax
4710f59d7bSfvdl	ret		/* pid = fork(); */
48*92d1d441SuebayasiEND(__fork)
49