xref: /netbsd-src/lib/libc/arch/i386/sys/__vfork14.S (revision 0d34bfa26d596b4f9bcb49175a92020d91572850)
1*0d34bfa2Suebayasi/*	$NetBSD: __vfork14.S,v 1.10 2014/05/23 02:34:19 uebayasi Exp $	*/
2bedc7b48Sthorpej
3bedc7b48Sthorpej/*-
4bedc7b48Sthorpej * Copyright (c) 1990 The Regents of the University of California.
5bedc7b48Sthorpej * All rights reserved.
6bedc7b48Sthorpej *
7bedc7b48Sthorpej * This code is derived from software contributed to Berkeley by
8bedc7b48Sthorpej * William Jolitz.
9bedc7b48Sthorpej *
10bedc7b48Sthorpej * Redistribution and use in source and binary forms, with or without
11bedc7b48Sthorpej * modification, are permitted provided that the following conditions
12bedc7b48Sthorpej * are met:
13bedc7b48Sthorpej * 1. Redistributions of source code must retain the above copyright
14bedc7b48Sthorpej *    notice, this list of conditions and the following disclaimer.
15bedc7b48Sthorpej * 2. Redistributions in binary form must reproduce the above copyright
16bedc7b48Sthorpej *    notice, this list of conditions and the following disclaimer in the
17bedc7b48Sthorpej *    documentation and/or other materials provided with the distribution.
18eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
19bedc7b48Sthorpej *    may be used to endorse or promote products derived from this software
20bedc7b48Sthorpej *    without specific prior written permission.
21bedc7b48Sthorpej *
22bedc7b48Sthorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23bedc7b48Sthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24bedc7b48Sthorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25bedc7b48Sthorpej * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26bedc7b48Sthorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27bedc7b48Sthorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28bedc7b48Sthorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29bedc7b48Sthorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30bedc7b48Sthorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31bedc7b48Sthorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32bedc7b48Sthorpej * SUCH DAMAGE.
33bedc7b48Sthorpej *
34bedc7b48Sthorpej *	from: @(#)Ovfork.s	5.1 (Berkeley) 4/23/90
35bedc7b48Sthorpej */
36bedc7b48Sthorpej
37bedc7b48Sthorpej#include <machine/asm.h>
38bedc7b48Sthorpej#if defined(SYSLIBC_SCCS) && !defined(lint)
39*0d34bfa2Suebayasi	RCSID("$NetBSD: __vfork14.S,v 1.10 2014/05/23 02:34:19 uebayasi Exp $")
40bedc7b48Sthorpej#endif /* SYSLIBC_SCCS and not lint */
41bedc7b48Sthorpej
42bedc7b48Sthorpej#include "SYS.h"
43bedc7b48Sthorpej
44bedc7b48Sthorpej/*
45bedc7b48Sthorpej * pid = vfork();
46bedc7b48Sthorpej *
47bedc7b48Sthorpej * %edx == 0 in parent process, %edx == 1 in child process.
48bedc7b48Sthorpej * %eax == pid of child in parent, %eax == pid of parent in child.
49bedc7b48Sthorpej *
50bedc7b48Sthorpej */
51bedc7b48SthorpejENTRY(__vfork14)
523cac6dbbSad	popl	%ecx		/* my rta into %ecx */
533cac6dbbSad	OSYSTRAP(__vfork14)	/* don't clobber %ecx */
54bedc7b48Sthorpej	jc	err
55bedc7b48Sthorpej	decl	%edx
56bedc7b48Sthorpej	andl	%edx,%eax
57e1a248faSross	jmp	*%ecx
58bedc7b48Sthorpejerr:
59b5fe349eSkleink	pushl	%ecx
6072e604e4Smycroft	jmp	CERROR
61*0d34bfa2SuebayasiEND(__vfork14)
62