1246117Skib/* $NetBSD: fork.S,v 1.11 2003/08/07 16:42:17 agc Exp $ */ 2246117Skib 3246117Skib/*- 4246117Skib * Copyright (c) 1991, 1993 5246117Skib * The Regents of the University of California. All rights reserved. 6246117Skib * 7246117Skib * This code is derived from software contributed to Berkeley by 8246117Skib * Ralph Campbell. 9246117Skib * 10246117Skib * Redistribution and use in source and binary forms, with or without 11246117Skib * modification, are permitted provided that the following conditions 12246117Skib * are met: 13246117Skib * 1. Redistributions of source code must retain the above copyright 14246117Skib * notice, this list of conditions and the following disclaimer. 15246117Skib * 2. Redistributions in binary form must reproduce the above copyright 16246117Skib * notice, this list of conditions and the following disclaimer in the 17246117Skib * documentation and/or other materials provided with the distribution. 18246117Skib * 3. Neither the name of the University nor the names of its contributors 19246117Skib * may be used to endorse or promote products derived from this software 20246117Skib * without specific prior written permission. 21246117Skib * 22246117Skib * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23246117Skib * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24246117Skib * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25246117Skib * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26246117Skib * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27246117Skib * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28246117Skib * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29246117Skib * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30246117Skib * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31246117Skib * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32246117Skib * SUCH DAMAGE. 33246117Skib */ 34246117Skib 35246117Skib#include <machine/asm.h> 36246117Skib__FBSDID("$FreeBSD: releng/10.3/lib/libc/mips/sys/fork.S 209231 2010-06-16 12:55:14Z jchandra $"); 37246117Skib#include "SYS.h" 38246117Skib 39246117Skib#if defined(LIBC_SCCS) && !defined(lint) 40246117Skib ASMSTR("from: @(#)fork.s 8.1 (Berkeley) 6/4/93") 41246117Skib ASMSTR("$NetBSD: fork.S,v 1.11 2003/08/07 16:42:17 agc Exp $") 42246117Skib#endif /* LIBC_SCCS and not lint */ 43246117Skib 44246117SkibLEAF(__sys_fork) 45246117Skib WEAK_ALIAS(fork, __sys_fork) 46246117Skib WEAK_ALIAS(_fork, __sys_fork) 47246117Skib PIC_PROLOGUE(__sys_fork) 48246117Skib li v0, SYS_fork # pid = fork() 49 syscall 50 bne a3, zero, 2f 51 beq v1, zero, 1f # v1 == 0 in parent, 1 in child 52 move v0, zero 531: 54 PIC_RETURN() 552: 56 PIC_TAILCALL(__cerror) 57END(__sys_fork) 58