11.11Schristos/*	$NetBSD: __vfork14.S,v 1.11 2025/11/06 15:25:18 christos Exp $	*/
21.1Sthorpej
31.1Sthorpej/*-
41.1Sthorpej * Copyright (c) 1990 The Regents of the University of California.
51.1Sthorpej * All rights reserved.
61.1Sthorpej *
71.1Sthorpej * This code is derived from software contributed to Berkeley by
81.1Sthorpej * William Jolitz.
91.1Sthorpej *
101.1Sthorpej * Redistribution and use in source and binary forms, with or without
111.1Sthorpej * modification, are permitted provided that the following conditions
121.1Sthorpej * are met:
131.1Sthorpej * 1. Redistributions of source code must retain the above copyright
141.1Sthorpej *    notice, this list of conditions and the following disclaimer.
151.1Sthorpej * 2. Redistributions in binary form must reproduce the above copyright
161.1Sthorpej *    notice, this list of conditions and the following disclaimer in the
171.1Sthorpej *    documentation and/or other materials provided with the distribution.
181.7Sagc * 3. Neither the name of the University nor the names of its contributors
191.1Sthorpej *    may be used to endorse or promote products derived from this software
201.1Sthorpej *    without specific prior written permission.
211.1Sthorpej *
221.1Sthorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231.1Sthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241.1Sthorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251.1Sthorpej * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261.1Sthorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271.1Sthorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281.1Sthorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291.1Sthorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301.1Sthorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311.1Sthorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321.1Sthorpej * SUCH DAMAGE.
331.1Sthorpej *
341.1Sthorpej *	from: @(#)Ovfork.s	5.1 (Berkeley) 4/23/90
351.1Sthorpej */
361.1Sthorpej
371.1Sthorpej#include <machine/asm.h>
381.1Sthorpej#if defined(SYSLIBC_SCCS) && !defined(lint)
391.11Schristos	RCSID("$NetBSD: __vfork14.S,v 1.11 2025/11/06 15:25:18 christos Exp $")
401.1Sthorpej#endif /* SYSLIBC_SCCS and not lint */
411.1Sthorpej
421.1Sthorpej#include "SYS.h"
431.1Sthorpej
441.1Sthorpej/*
451.1Sthorpej * pid = vfork();
461.1Sthorpej *
471.1Sthorpej * %edx == 0 in parent process, %edx == 1 in child process.
481.1Sthorpej * %eax == pid of child in parent, %eax == pid of parent in child.
491.1Sthorpej *
501.1Sthorpej */
511.1SthorpejENTRY(__vfork14)
521.8Sad	popl	%ecx		/* my rta into %ecx */
531.8Sad	OSYSTRAP(__vfork14)	/* don't clobber %ecx */
541.1Sthorpej	jc	err
551.1Sthorpej	decl	%edx
561.1Sthorpej	andl	%edx,%eax
571.6Sross	jmp	*%ecx
581.1Sthorpejerr:
591.3Skleink	pushl	%ecx
601.11Schristos	_SYSCALL_ERR
611.10SuebayasiEND(__vfork14)
62