1221828Sgrehan/*	$NetBSD: __vfork14.S,v 1.1 1998/01/04 20:58:13 thorpej Exp $	*/
2221828Sgrehan
3221828Sgrehan/*
4221828Sgrehan * Copyright (c) 1992, 1993
5221828Sgrehan *	The Regents of the University of California.  All rights reserved.
6221828Sgrehan *
7221828Sgrehan * This software was developed by the Computer Systems Engineering group
8221828Sgrehan * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9221828Sgrehan * contributed to Berkeley.
10221828Sgrehan *
11221828Sgrehan * Redistribution and use in source and binary forms, with or without
12221828Sgrehan * modification, are permitted provided that the following conditions
13221828Sgrehan * are met:
14221828Sgrehan * 1. Redistributions of source code must retain the above copyright
15221828Sgrehan *    notice, this list of conditions and the following disclaimer.
16221828Sgrehan * 2. Redistributions in binary form must reproduce the above copyright
17221828Sgrehan *    notice, this list of conditions and the following disclaimer in the
18221828Sgrehan *    documentation and/or other materials provided with the distribution.
19221828Sgrehan * 3. Neither the name of the University nor the names of its contributors
20221828Sgrehan *    may be used to endorse or promote products derived from this software
21221828Sgrehan *    without specific prior written permission.
22221828Sgrehan *
23221828Sgrehan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24221828Sgrehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25221828Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26221828Sgrehan * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27221828Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28221828Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29221828Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30221828Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31221828Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32221828Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33221828Sgrehan * SUCH DAMAGE.
34221828Sgrehan *
35221828Sgrehan * from: Header: Ovfork.s,v 1.1 91/07/06 13:05:56 torek Exp
36221828Sgrehan */
37221828Sgrehan
38221828Sgrehan#include <machine/asm.h>
39221828Sgrehan#if defined(SYSLIBC_SCCS) && !defined(lint)
40221828Sgrehan#if 0
41221828Sgrehan	.asciz "@(#)Ovfork.s	8.1 (Berkeley) 6/4/93"
42221828Sgrehan#else
43221828Sgrehan	RCSID("$NetBSD: __vfork14.S,v 1.1 1998/01/04 20:58:13 thorpej Exp $")
44221828Sgrehan#endif
45221828Sgrehan#endif /* SYSLIBC_SCCS and not lint */
46221828Sgrehan
47221828Sgrehan/*
48221828Sgrehan * pid = vfork();
49221828Sgrehan *
50221828Sgrehan * %o1 == 0 in parent process, 1 in child process.
51221828Sgrehan * %o0 == pid of child in parent, pid of parent in child.
52221828Sgrehan */
53221828Sgrehan
54221828Sgrehan#include "SYS.h"
55221828Sgrehan
56221828SgrehanSYSCALL(__vfork14)
57221828Sgrehan	dec	%o1		! from 1 to 0 in child, 0 to -1 in parent
58221828Sgrehan	retl
59221828Sgrehan	and	%o0, %o1, %o0	! return 0 in child, pid in parent
60221828Sgrehan