__vfork14.S revision 1.3
11.3Skleink/* $NetBSD: __vfork14.S,v 1.3 1998/10/01 19:25:05 kleink 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.3Skleink RCSID("$NetBSD: __vfork14.S,v 1.3 1998/10/01 19:25:05 kleink Exp $") 441.1Sthorpej#endif /* SYSLIBC_SCCS and not lint */ 451.1Sthorpej 461.1Sthorpej#include "SYS.h" 471.1Sthorpej 481.3Skleink#ifdef _REENTRANT 491.3Skleink .globl _C_LABEL(__errno) 501.3Skleink#else 511.3Skleink .globl _C_LABEL(errno) 521.3Skleink#endif 531.3Skleink 541.1Sthorpej/* 551.1Sthorpej * pid = vfork(); 561.1Sthorpej * 571.1Sthorpej * %edx == 0 in parent process, %edx == 1 in child process. 581.1Sthorpej * %eax == pid of child in parent, %eax == pid of parent in child. 591.1Sthorpej * 601.1Sthorpej */ 611.1SthorpejENTRY(__vfork14) 621.1Sthorpej popl %ecx /* my rta into ecx */ 631.1Sthorpej movl $(SYS___vfork14),%eax 641.1Sthorpej int $0x80 651.1Sthorpej jc err 661.1Sthorpej decl %edx 671.1Sthorpej andl %edx,%eax 681.1Sthorpej jmp %ecx 691.1Sthorpejerr: 701.3Skleink#ifdef _REENTRANT 711.3Skleink pushl %ecx 721.3Skleink pushl %eax 731.3Skleink#ifdef PIC 741.3Skleink PIC_PROLOGUE 751.3Skleink call PIC_PLT(_C_LABEL(__errno)) 761.3Skleink PIC_EPILOGUE 771.3Skleink#else 781.3Skleink call _C_LABEL(__errno) 791.3Skleink#endif /* PIC */ 801.3Skleink popl %ecx 811.3Skleink movl %ecx,(%eax) 821.3Skleink popl %ecx 831.3Skleink#else 841.1Sthorpej#ifdef PIC 851.1Sthorpej PIC_PROLOGUE 861.2Sthorpej movl PIC_GOT(_C_LABEL(errno)),%edx 871.1Sthorpej PIC_EPILOGUE 881.1Sthorpej movl %eax,(%edx) 891.1Sthorpej#else 901.2Sthorpej movl %eax,_C_LABEL(errno) 911.3Skleink#endif /* PIC */ 921.3Skleink#endif /* _REENTRANT */ 931.1Sthorpej movl $-1,%eax 941.1Sthorpej jmp %ecx 95