Blame sysdeps/unix/sysv/linux/arm/vfork.S

Packit Service 82fcde
/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
   Contributed by Philip Blundell <philb@gnu.org>.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library.  If not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include <sysdep.h>
Packit Service 82fcde
#define _ERRNO_H	1
Packit Service 82fcde
#include <bits/errno.h>
Packit Service 82fcde
#include <tcb-offsets.h>
Packit Service 82fcde
Packit Service 82fcde
Packit Service 82fcde
/* Clone the calling process, but without copying the whole address space.
Packit Service 82fcde
   The calling process is suspended until the new process exits or is
Packit Service 82fcde
   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
Packit Service 82fcde
   and the process ID of the new process to the old process.  */
Packit Service 82fcde
Packit Service 82fcde
ENTRY (__vfork)
Packit Service 82fcde
	/* The DO_CALL macro saves r7 on the stack, to enable generation
Packit Service 82fcde
	   of ARM unwind info.  Since the stack is initially shared between
Packit Service 82fcde
	   parent and child of vfork, that saved value could be corrupted.
Packit Service 82fcde
	   To avoid this problem, we save r7 into ip as well, and restore
Packit Service 82fcde
	   from there.  */
Packit Service 82fcde
	mov	ip, r7
Packit Service 82fcde
	cfi_register (r7, ip)
Packit Service 82fcde
	.fnstart
Packit Service 82fcde
	push	{ r7 }
Packit Service 82fcde
	cfi_adjust_cfa_offset (4)
Packit Service 82fcde
	.save { r7 }
Packit Service 82fcde
	ldr	r7, =SYS_ify (vfork)
Packit Service 82fcde
	swi	0x0
Packit Service 82fcde
	.fnend
Packit Service 82fcde
	add	sp, sp, #4
Packit Service 82fcde
	cfi_adjust_cfa_offset (-4)
Packit Service 82fcde
	mov	r7, ip
Packit Service 82fcde
	cfi_restore (r7)
Packit Service 82fcde
Packit Service 82fcde
	cmn	a1, #4096
Packit Service 82fcde
	it	cc
Packit Service 82fcde
	RETINSTR(cc, lr)
Packit Service 82fcde
Packit Service 82fcde
	b	PLTJMP(SYSCALL_ERROR)
Packit Service 82fcde
PSEUDO_END (__vfork)
Packit Service 82fcde
libc_hidden_def (__vfork)
Packit Service 82fcde
Packit Service 82fcde
weak_alias (__vfork, vfork)
Packit Service 82fcde
strong_alias (__vfork, __libc_vfork)