1657b1f3dSraf/* 2657b1f3dSraf * CDDL HEADER START 3657b1f3dSraf * 4657b1f3dSraf * The contents of this file are subject to the terms of the 5657b1f3dSraf * Common Development and Distribution License (the "License"). 6657b1f3dSraf * You may not use this file except in compliance with the License. 7657b1f3dSraf * 8657b1f3dSraf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9657b1f3dSraf * or http://www.opensolaris.org/os/licensing. 10657b1f3dSraf * See the License for the specific language governing permissions 11657b1f3dSraf * and limitations under the License. 12657b1f3dSraf * 13657b1f3dSraf * When distributing Covered Code, include this CDDL HEADER in each 14657b1f3dSraf * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15657b1f3dSraf * If applicable, add the following below this CDDL HEADER, with the 16657b1f3dSraf * fields enclosed by brackets "[]" replaced with your own identifying 17657b1f3dSraf * information: Portions Copyright [yyyy] [name of copyright owner] 18657b1f3dSraf * 19657b1f3dSraf * CDDL HEADER END 20657b1f3dSraf */ 21657b1f3dSraf 22657b1f3dSraf/* 23657b1f3dSraf * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24657b1f3dSraf * Use is subject to license terms. 25657b1f3dSraf */ 26657b1f3dSraf 27*9a70fc3bSMark J. Nelson .file "forkx.s" 28657b1f3dSraf 29657b1f3dSraf#include "SYS.h" 30657b1f3dSraf 31657b1f3dSraf/* 32657b1f3dSraf * pid = __forkx(flags); 33657b1f3dSraf * 34657b1f3dSraf * syscall trap: forksys(0, flags) 35657b1f3dSraf * 36657b1f3dSraf * From the syscall: 37657b1f3dSraf * %edx == 0 in parent process, %edx = 1 in child process. 38657b1f3dSraf * %eax == pid of child in parent, %eax == pid of parent in child. 39657b1f3dSraf * 40657b1f3dSraf * The child gets a zero return value. 41657b1f3dSraf * The parent gets the pid of the child. 42657b1f3dSraf */ 43657b1f3dSraf 44657b1f3dSraf ENTRY(__forkx) 45657b1f3dSraf movl %edi, %esi 46657b1f3dSraf xorl %edi, %edi 47657b1f3dSraf SYSTRAP_2RVALS(forksys) 48657b1f3dSraf SYSCERROR 49657b1f3dSraf testl %edx, %edx 50657b1f3dSraf jz 1f /* jump if parent */ 51657b1f3dSraf xorl %eax, %eax /* child, return (0) */ 52657b1f3dSraf1: 53657b1f3dSraf RET 54657b1f3dSraf SET_SIZE(__forkx) 55