1*2cf5e996Smatt/* $NetBSD: compat_Ovfork.S,v 1.3 2013/08/19 22:11:50 matt Exp $ */ 2b638db2cSchristos 3b638db2cSchristos/*- 4b638db2cSchristos * Copyright (c) 1990 The Regents of the University of California. 5b638db2cSchristos * All rights reserved. 6b638db2cSchristos * 7b638db2cSchristos * Redistribution and use in source and binary forms, with or without 8b638db2cSchristos * modification, are permitted provided that the following conditions 9b638db2cSchristos * are met: 10b638db2cSchristos * 1. Redistributions of source code must retain the above copyright 11b638db2cSchristos * notice, this list of conditions and the following disclaimer. 12b638db2cSchristos * 2. Redistributions in binary form must reproduce the above copyright 13b638db2cSchristos * notice, this list of conditions and the following disclaimer in the 14b638db2cSchristos * documentation and/or other materials provided with the distribution. 15b638db2cSchristos * 3. Neither the name of the University nor the names of its contributors 16b638db2cSchristos * may be used to endorse or promote products derived from this software 17b638db2cSchristos * without specific prior written permission. 18b638db2cSchristos * 19b638db2cSchristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20b638db2cSchristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21b638db2cSchristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22b638db2cSchristos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23b638db2cSchristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24b638db2cSchristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25b638db2cSchristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26b638db2cSchristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27b638db2cSchristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28b638db2cSchristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29b638db2cSchristos * SUCH DAMAGE. 30b638db2cSchristos * 31b638db2cSchristos * from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90 32b638db2cSchristos */ 33b638db2cSchristos 34b638db2cSchristos#include "SYS.h" 35b638db2cSchristos 36b638db2cSchristosWARN_REFERENCES(vfork, \ 37b638db2cSchristos "warning: reference to compatibility vfork(); include <unistd.h> for correct reference") 38b638db2cSchristos 39b638db2cSchristos/* 40b638db2cSchristos * pid = vfork(); 41b638db2cSchristos * 42b638db2cSchristos * On return from the SWI: 43b638db2cSchristos * r1 == 0 in parent process, r1 == 1 in child process. 44b638db2cSchristos * r0 == pid of child in parent, r0 == pid of parent in child. 45b638db2cSchristos */ 46b638db2cSchristosENTRY(vfork) 47*2cf5e996Smatt mov r2, lr 48b638db2cSchristos SYSTRAP(vfork) 49*2cf5e996Smatt _INVOKE_CERROR() 50*2cf5e996Smatt mov lr, r2 51*2cf5e996Smatt subs r1, r1, #1 /* r1 == 0xffffffff if parent, 0 if child */ 52*2cf5e996Smatt ands r0, r0, r1 /* r0 == 0 if child, else unchanged */ 53b638db2cSchristos RET 54*2cf5e996SmattEND(vfork) 55