__vfork14.S revision 1.6
11.6Smatt/*	$NetBSD: __vfork14.S,v 1.6 2009/12/14 01:07:42 matt 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.6Smatt#if 0
391.6Smatt	RCSID("from: @(#)Ovfork.s	8.1 (Berkeley) 6/4/93")
401.6Smatt#else
411.6Smatt	RCSID("$NetBSD: __vfork14.S,v 1.6 2009/12/14 01:07:42 matt Exp $")
421.6Smatt#endif
431.1Sthorpej#endif /* LIBC_SCCS and not lint */
441.1Sthorpej
451.1Sthorpej/*
461.1Sthorpej * pid = vfork();
471.1Sthorpej *
481.1Sthorpej * v1 == 0 in parent process, v1 == 1 in child process.
491.1Sthorpej * v0 == pid of child in parent, v0 == pid of parent in child.
501.1Sthorpej */
511.1Sthorpej
521.1SthorpejLEAF(__vfork14)
531.6Smatt	PIC_PROLOGUE(__vfork14)
541.1Sthorpej	li	v0, SYS___vfork14	# system call number for vfork
551.1Sthorpej	syscall
561.1Sthorpej	beq	a3, zero, 1f		# jump if no errors
571.6Smatt	PIC_TAILCALL(__cerror)
581.1Sthorpej1:
591.1Sthorpej	beq	v1, zero, 2f		# parent process ?
601.1Sthorpej	move	v0, zero		# return zero in child
611.1Sthorpej2:
621.6Smatt	PIC_RETURN()
631.1SthorpejEND(__vfork14)
64