19ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes/* 25386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert * Copyright (C) 2008 The Android Open Source Project 39ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * All rights reserved. 49ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * 59ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * Redistribution and use in source and binary forms, with or without 69ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * modification, are permitted provided that the following conditions 79ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * are met: 89ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * * Redistributions of source code must retain the above copyright 99ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * notice, this list of conditions and the following disclaimer. 109ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * * Redistributions in binary form must reproduce the above copyright 119ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * notice, this list of conditions and the following disclaimer in 129ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * the documentation and/or other materials provided with the 139ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * distribution. 149ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * 159ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 169ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 179ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 189ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 199ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 209ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 219ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 229ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 239ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 249ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 259ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes * SUCH DAMAGE. 279ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes */ 289ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes 295386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#include <private/bionic_asm.h> 305386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#include <linux/sched.h> 319ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes 325386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert// TODO: mips' uapi signal.h is missing #ifndef __ASSEMBLY__. 335386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert// #include <asm/signal.h> 345386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#define SIGCHLD 18 355386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert 365386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert .text 375386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert 385386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32) 395386a741e77bfff4e72ca6861fdd3fe2208452ceDan AlbertFRAMESZ = MKFSIZ(5,0) 405386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#else 415386a741e77bfff4e72ca6861fdd3fe2208452ceDan AlbertFRAMESZ = MKFSIZ(0,0) 425386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#endif 435386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert 445386a741e77bfff4e72ca6861fdd3fe2208452ceDan AlbertLEAF(vfork,FRAMESZ) 455386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#if FRAMESZ!=0 465386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert PTR_SUBU sp, FRAMESZ 475386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#endif 485386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert SETUP_GP64(a5, vfork) 495386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert LI a0, (CLONE_VM | CLONE_VFORK | SIGCHLD) 505386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert move a1, $0 515386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert move a2, $0 525386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert move a3, $0 535386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#if (_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABI32) 545386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert REG_S $0, 4*REGSZ(sp) 555386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#else 565386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert move a4, $0 575386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#endif 585386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert LI v0, __NR_clone 595386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert syscall 605386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#if FRAMESZ!=0 615386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert PTR_ADDU sp,FRAMESZ 625386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#endif 635386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert move a0, v0 645386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert bnez a3, 1f 655386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert RESTORE_GP64 665386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert j ra 675386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert1: 687efad83d430f4d824f2aaa75edea5106f6ff8aaeElliott Hughes LA t9,__set_errno_internal 695386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert RESTORE_GP64 705386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert j t9 715386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert END(vfork) 72