1*f45a8c29Smatt/* $NetBSD: compat_Ovfork.S,v 1.2 2009/12/14 03:04:33 matt Exp $ */ 2f80595caStsutsui 3f80595caStsutsui/*- 4f80595caStsutsui * Copyright (c) 1991, 1993 5f80595caStsutsui * The Regents of the University of California. All rights reserved. 6f80595caStsutsui * 7f80595caStsutsui * This code is derived from software contributed to Berkeley by 8f80595caStsutsui * Ralph Campbell. 9f80595caStsutsui * 10f80595caStsutsui * Redistribution and use in source and binary forms, with or without 11f80595caStsutsui * modification, are permitted provided that the following conditions 12f80595caStsutsui * are met: 13f80595caStsutsui * 1. Redistributions of source code must retain the above copyright 14f80595caStsutsui * notice, this list of conditions and the following disclaimer. 15f80595caStsutsui * 2. Redistributions in binary form must reproduce the above copyright 16f80595caStsutsui * notice, this list of conditions and the following disclaimer in the 17f80595caStsutsui * documentation and/or other materials provided with the distribution. 18f80595caStsutsui * 3. Neither the name of the University nor the names of its contributors 19f80595caStsutsui * may be used to endorse or promote products derived from this software 20f80595caStsutsui * without specific prior written permission. 21f80595caStsutsui * 22f80595caStsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23f80595caStsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24f80595caStsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25f80595caStsutsui * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26f80595caStsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27f80595caStsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28f80595caStsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29f80595caStsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30f80595caStsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31f80595caStsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32f80595caStsutsui * SUCH DAMAGE. 33f80595caStsutsui */ 34f80595caStsutsui 35f80595caStsutsui#include "SYS.h" 36f80595caStsutsui 37f80595caStsutsui#if defined(LIBC_SCCS) && !defined(lint) 38*f45a8c29Smatt#if 0 39*f45a8c29Smatt RCSID("from: @(#)Ovfork.s 8.1 (Berkeley) 6/4/93") 40*f45a8c29Smatt#else 41*f45a8c29Smatt RCSID("$NetBSD: compat_Ovfork.S,v 1.2 2009/12/14 03:04:33 matt Exp $") 42*f45a8c29Smatt#endif 43f80595caStsutsui#endif /* LIBC_SCCS and not lint */ 44f80595caStsutsui 45f80595caStsutsuiWARN_REFERENCES(vfork, \ 46f80595caStsutsui "warning: reference to compatibility vfork(); include <unistd.h> for correct reference") 47f80595caStsutsui 48f80595caStsutsui/* 49f80595caStsutsui * pid = vfork(); 50f80595caStsutsui * 51f80595caStsutsui * v1 == 0 in parent process, v1 == 1 in child process. 52f80595caStsutsui * v0 == pid of child in parent, v0 == pid of parent in child. 53f80595caStsutsui */ 54f80595caStsutsui 55f80595caStsutsuiLEAF(vfork) 56*f45a8c29Smatt PIC_PROLOGUE(vfork) 57*f45a8c29Smatt 58*f45a8c29Smatt SYSTRAP(vfork) # system call number for vfork 59f80595caStsutsui beq a3, zero, 1f # jump if no errors 60*f45a8c29Smatt 61*f45a8c29Smatt PIC_TAILCALL(__cerror) 62*f45a8c29Smatt 63f80595caStsutsui1: 64f80595caStsutsui beq v1, zero, 2f # parent process ? 65f80595caStsutsui move v0, zero # return zero in child 66f80595caStsutsui2: 67*f45a8c29Smatt PIC_RETURN() 68f80595caStsutsuiEND(vfork) 69