Ovfork.S revision 50476
1218585Sjkim/*- 2218585Sjkim * Copyright (c) 1990 The Regents of the University of California. 3218585Sjkim * All rights reserved. 4218585Sjkim * 5218585Sjkim * This code is derived from software contributed to Berkeley by 6218585Sjkim * William Jolitz. 7218585Sjkim * 8218585Sjkim * Redistribution and use in source and binary forms, with or without 9298714Sjkim * modification, are permitted provided that the following conditions 10218585Sjkim * are met: 11218585Sjkim * 1. Redistributions of source code must retain the above copyright 12218585Sjkim * notice, this list of conditions and the following disclaimer. 13218585Sjkim * 2. Redistributions in binary form must reproduce the above copyright 14218585Sjkim * notice, this list of conditions and the following disclaimer in the 15218585Sjkim * documentation and/or other materials provided with the distribution. 16218585Sjkim * 3. All advertising materials mentioning features or use of this software 17218585Sjkim * must display the following acknowledgement: 18218585Sjkim * This product includes software developed by the University of 19218585Sjkim * California, Berkeley and its contributors. 20218585Sjkim * 4. Neither the name of the University nor the names of its contributors 21218585Sjkim * may be used to endorse or promote products derived from this software 22218585Sjkim * without specific prior written permission. 23218585Sjkim * 24218585Sjkim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25218585Sjkim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26218585Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27218585Sjkim * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28218585Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29218585Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30218585Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31218585Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32218585Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33218585Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34218585Sjkim * SUCH DAMAGE. 35218585Sjkim * 36218585Sjkim * $FreeBSD: head/lib/libc/i386/sys/Ovfork.S 50476 1999-08-28 00:22:10Z peter $ 37218585Sjkim */ 38218585Sjkim 39218585Sjkim#if defined(SYSLIBC_RCS) && !defined(lint) 40218585Sjkim .text 41218585Sjkim .asciz "$FreeBSD: head/lib/libc/i386/sys/Ovfork.S 50476 1999-08-28 00:22:10Z peter $" 42218585Sjkim#endif /* SYSLIBC_RCS and not lint */ 43218585Sjkim 44218585Sjkim#include "DEFS.h" 45218590Sjkim#include "SYS.h" 46218590Sjkim 47218590Sjkim/* 48218590Sjkim * pid = vfork(); 49218590Sjkim * 50298714Sjkim * %edx == 0 in parent process, %edx == 1 in child process. 51218585Sjkim * %eax == pid of child in parent, %eax == pid of parent in child. 52218585Sjkim * 53218585Sjkim */ 54218585Sjkim 55218585Sjkim#ifdef _THREAD_SAFE 56218585SjkimENTRY(_thread_sys_vfork) 57218585Sjkim#else 58218585SjkimENTRY(vfork) 59218585Sjkim#endif 60218585Sjkim popl %ecx /* my rta into ecx */ 61218585Sjkim lea SYS_vfork,%eax 62218585Sjkim KERNCALL 63218585Sjkim jb 2f 64218585Sjkim cmpl $0,%edx /* parent process? */ 65218585Sjkim je 1f /* yes */ 66218585Sjkim movl $0,%eax 67218585Sjkim1: 68218585Sjkim jmp %ecx 69218585Sjkim2: 70218585Sjkim pushl %ecx 71218585Sjkim PIC_PROLOGUE 72218585Sjkim jmp PIC_PLT(HIDENAME(cerror)) 73218585Sjkim