__vfork14.S revision 1.5
11.5Sagc/*	$NetBSD: __vfork14.S,v 1.5 2003/08/07 16:42:17 agc Exp $	*/
21.1Sthorpej
31.1Sthorpej/*-
41.1Sthorpej * Copyright (c) 1991, 1993
51.1Sthorpej *	The Regents of the University of California.  All rights reserved.
61.1Sthorpej *
71.1Sthorpej * This code is derived from software contributed to Berkeley by
81.1Sthorpej * Ralph Campbell.
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.5Sagc * 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
351.1Sthorpej#include "SYS.h"
361.1Sthorpej
371.1Sthorpej#if defined(LIBC_SCCS) && !defined(lint)
381.1Sthorpej	ASMSTR("from: @(#)Ovfork.s	8.1 (Berkeley) 6/4/93")
391.5Sagc	ASMSTR("$NetBSD: __vfork14.S,v 1.5 2003/08/07 16:42:17 agc Exp $")
401.1Sthorpej#endif /* LIBC_SCCS and not lint */
411.1Sthorpej
421.1Sthorpej/*
431.1Sthorpej * pid = vfork();
441.1Sthorpej *
451.1Sthorpej * v1 == 0 in parent process, v1 == 1 in child process.
461.1Sthorpej * v0 == pid of child in parent, v0 == pid of parent in child.
471.1Sthorpej */
481.1Sthorpej
491.1SthorpejLEAF(__vfork14)
501.4Sthorpej#ifdef __ABICALLS__
511.1Sthorpej	.set	noreorder
521.1Sthorpej	.cpload	t9
531.1Sthorpej	.set	reorder
541.1Sthorpej#endif
551.1Sthorpej	li	v0, SYS___vfork14	# system call number for vfork
561.1Sthorpej	syscall
571.1Sthorpej	beq	a3, zero, 1f		# jump if no errors
581.2Skleink	la	t9, __cerror
591.1Sthorpej	jr	t9
601.1Sthorpej1:
611.1Sthorpej	beq	v1, zero, 2f		# parent process ?
621.1Sthorpej	move	v0, zero		# return zero in child
631.1Sthorpej2:
641.1Sthorpej	j	ra
651.1SthorpejEND(__vfork14)
66