__vfork14.S revision 1.1
11.1Sthorpej/* $NetBSD: __vfork14.S,v 1.1 1998/01/04 20:58:09 thorpej Exp $ */ 21.1Sthorpej 31.1Sthorpej/*- 41.1Sthorpej * Copyright (c) 1990 The Regents of the University of California. 51.1Sthorpej * All rights reserved. 61.1Sthorpej * 71.1Sthorpej * This code is derived from software contributed to Berkeley by 81.1Sthorpej * William Jolitz. 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.1Sthorpej * 3. All advertising materials mentioning features or use of this software 191.1Sthorpej * must display the following acknowledgement: 201.1Sthorpej * This product includes software developed by the University of 211.1Sthorpej * California, Berkeley and its contributors. 221.1Sthorpej * 4. Neither the name of the University nor the names of its contributors 231.1Sthorpej * may be used to endorse or promote products derived from this software 241.1Sthorpej * without specific prior written permission. 251.1Sthorpej * 261.1Sthorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 271.1Sthorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 281.1Sthorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 291.1Sthorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 301.1Sthorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 311.1Sthorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 321.1Sthorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 331.1Sthorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341.1Sthorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351.1Sthorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361.1Sthorpej * SUCH DAMAGE. 371.1Sthorpej * 381.1Sthorpej * from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90 391.1Sthorpej */ 401.1Sthorpej 411.1Sthorpej#include <machine/asm.h> 421.1Sthorpej#if defined(SYSLIBC_SCCS) && !defined(lint) 431.1Sthorpej RCSID("$NetBSD: __vfork14.S,v 1.1 1998/01/04 20:58:09 thorpej Exp $") 441.1Sthorpej#endif /* SYSLIBC_SCCS and not lint */ 451.1Sthorpej 461.1Sthorpej#include "SYS.h" 471.1Sthorpej 481.1Sthorpej/* 491.1Sthorpej * pid = vfork(); 501.1Sthorpej * 511.1Sthorpej * %edx == 0 in parent process, %edx == 1 in child process. 521.1Sthorpej * %eax == pid of child in parent, %eax == pid of parent in child. 531.1Sthorpej * 541.1Sthorpej */ 551.1SthorpejENTRY(__vfork14) 561.1Sthorpej popl %ecx /* my rta into ecx */ 571.1Sthorpej movl $(SYS___vfork14),%eax 581.1Sthorpej int $0x80 591.1Sthorpej jc err 601.1Sthorpej decl %edx 611.1Sthorpej andl %edx,%eax 621.1Sthorpej jmp %ecx 631.1Sthorpejerr: 641.1Sthorpej#ifdef PIC 651.1Sthorpej PIC_PROLOGUE 661.1Sthorpej movl PIC_GOT(_errno),%edx 671.1Sthorpej PIC_EPILOGUE 681.1Sthorpej movl %eax,(%edx) 691.1Sthorpej#else 701.1Sthorpej movl %eax,_errno 711.1Sthorpej#endif 721.1Sthorpej movl $-1,%eax 731.1Sthorpej jmp %ecx 74