xref: /onnv-gate/usr/src/lib/libc/sparc/sys/forkx.s (revision 3235:9af05252020c)
1*3235Sraf/*
2*3235Sraf * CDDL HEADER START
3*3235Sraf *
4*3235Sraf * The contents of this file are subject to the terms of the
5*3235Sraf * Common Development and Distribution License (the "License").
6*3235Sraf * You may not use this file except in compliance with the License.
7*3235Sraf *
8*3235Sraf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3235Sraf * or http://www.opensolaris.org/os/licensing.
10*3235Sraf * See the License for the specific language governing permissions
11*3235Sraf * and limitations under the License.
12*3235Sraf *
13*3235Sraf * When distributing Covered Code, include this CDDL HEADER in each
14*3235Sraf * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3235Sraf * If applicable, add the following below this CDDL HEADER, with the
16*3235Sraf * fields enclosed by brackets "[]" replaced with your own identifying
17*3235Sraf * information: Portions Copyright [yyyy] [name of copyright owner]
18*3235Sraf *
19*3235Sraf * CDDL HEADER END
20*3235Sraf */
21*3235Sraf
22*3235Sraf/*	Copyright (c) 1988 AT&T	*/
23*3235Sraf/*	  All Rights Reserved	*/
24*3235Sraf
25*3235Sraf/*
26*3235Sraf * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
27*3235Sraf * Use is subject to license terms.
28*3235Sraf */
29*3235Sraf
30*3235Sraf#pragma ident	"%Z%%M%	%I%	%E% SMI"
31*3235Sraf
32*3235Sraf	.file	"%M%"
33*3235Sraf
34*3235Sraf#include "SYS.h"
35*3235Sraf
36*3235Sraf/*
37*3235Sraf * pid = __forkx(flags);
38*3235Sraf *
39*3235Sraf * syscall trap: forksys(0, flags)
40*3235Sraf *
41*3235Sraf * From the syscall:
42*3235Sraf * %o1 == 0 in parent process, %o1 == 1 in child process.
43*3235Sraf * %o0 == pid of child in parent, %o0 == pid of parent in child.
44*3235Sraf *
45*3235Sraf * The child gets a zero return value.
46*3235Sraf * The parent gets the pid of the child.
47*3235Sraf */
48*3235Sraf
49*3235Sraf	ENTRY(__forkx)
50*3235Sraf	mov	%o0, %o1
51*3235Sraf	clr	%o0
52*3235Sraf	SYSTRAP_2RVALS(forksys)
53*3235Sraf	SYSCERROR
54*3235Sraf	movrnz	%o1, 0, %o0
55*3235Sraf	RET
56*3235Sraf	SET_SIZE(__forkx)
57