19ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes/*
25386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert * Copyright (C) 2013 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 <asm/signal.h>
315386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert#include <linux/sched.h>
329ea4d5f3a852a03b5a2c5676da148a2779821518Elliott Hughes
335386a741e77bfff4e72ca6861fdd3fe2208452ceDan AlbertENTRY(vfork)
345386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    mov     x0, #(CLONE_VM | CLONE_VFORK | SIGCHLD)
355386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    mov     x1, xzr
365386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    mov     x2, xzr
375386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    mov     x3, xzr
385386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    mov     x4, xzr
395386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert
405386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    mov     x8, __NR_clone
415386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    svc     #0
425386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert
435386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    cmn     x0, #(MAX_ERRNO + 1)
445386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    cneg    x0, x0, hi
457efad83d430f4d824f2aaa75edea5106f6ff8aaeElliott Hughes    b.hi    __set_errno_internal
465386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert
475386a741e77bfff4e72ca6861fdd3fe2208452ceDan Albert    ret
485386a741e77bfff4e72ca6861fdd3fe2208452ceDan AlbertEND(vfork)
49