13235Sraf/* 23235Sraf * CDDL HEADER START 33235Sraf * 43235Sraf * The contents of this file are subject to the terms of the 53235Sraf * Common Development and Distribution License (the "License"). 63235Sraf * You may not use this file except in compliance with the License. 73235Sraf * 83235Sraf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 93235Sraf * or http://www.opensolaris.org/os/licensing. 103235Sraf * See the License for the specific language governing permissions 113235Sraf * and limitations under the License. 123235Sraf * 133235Sraf * When distributing Covered Code, include this CDDL HEADER in each 143235Sraf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153235Sraf * If applicable, add the following below this CDDL HEADER, with the 163235Sraf * fields enclosed by brackets "[]" replaced with your own identifying 173235Sraf * information: Portions Copyright [yyyy] [name of copyright owner] 183235Sraf * 193235Sraf * CDDL HEADER END 203235Sraf */ 213235Sraf 223235Sraf/* 233235Sraf * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 243235Sraf * Use is subject to license terms. 253235Sraf */ 263235Sraf 27*7298SMark.J.Nelson@Sun.COM .file "forkx.s" 283235Sraf 293235Sraf#include "SYS.h" 303235Sraf 313235Sraf/* 323235Sraf * pid = __forkx(flags); 333235Sraf * 343235Sraf * syscall trap: forksys(0, flags) 353235Sraf * 363235Sraf * From the syscall: 373235Sraf * %edx == 0 in parent process, %edx = 1 in child process. 383235Sraf * %eax == pid of child in parent, %eax == pid of parent in child. 393235Sraf * 403235Sraf * The child gets a zero return value. 413235Sraf * The parent gets the pid of the child. 423235Sraf */ 433235Sraf 443235Sraf ENTRY(__forkx) 453235Sraf movl %edi, %esi 463235Sraf xorl %edi, %edi 473235Sraf SYSTRAP_2RVALS(forksys) 483235Sraf SYSCERROR 493235Sraf testl %edx, %edx 503235Sraf jz 1f /* jump if parent */ 513235Sraf xorl %eax, %eax /* child, return (0) */ 523235Sraf1: 533235Sraf RET 543235Sraf SET_SIZE(__forkx) 55