2015-01-02 16:28:19 +00:00
|
|
|
/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
|
1999-04-12 09:03:50 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Contributed by Philip Blundell <philb@gnu.org>.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:56:23 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1999-04-12 09:03:50 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:56:23 +00:00
|
|
|
Lesser General Public License for more details.
|
1999-04-12 09:03:50 +00:00
|
|
|
|
2001-07-06 04:56:23 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-03-09 23:56:38 +00:00
|
|
|
License along with the GNU C Library. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1999-04-12 09:03:50 +00:00
|
|
|
|
|
|
|
#include <sysdep.h>
|
|
|
|
#define _ERRNO_H 1
|
|
|
|
#include <bits/errno.h>
|
2014-05-14 16:44:24 +00:00
|
|
|
#include <tcb-offsets.h>
|
|
|
|
|
1999-04-12 09:03:50 +00:00
|
|
|
|
|
|
|
/* Clone the calling process, but without copying the whole address space.
|
|
|
|
The calling process is suspended until the new process exits or is
|
|
|
|
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
|
|
|
|
and the process ID of the new process to the old process. */
|
|
|
|
|
|
|
|
ENTRY (__vfork)
|
2014-05-14 16:44:24 +00:00
|
|
|
/* Save the PID value. */
|
|
|
|
GET_TLS (r2)
|
|
|
|
NEGOFF_ADJ_BASE2 (r2, r0, PID_OFFSET) /* Save the TLS addr in r2. */
|
|
|
|
ldr r3, NEGOFF_OFF1 (r2, PID_OFFSET) /* Load the saved PID. */
|
|
|
|
rsbs r0, r3, #0 /* Negate it, and test for zero. */
|
|
|
|
/* Use 0x80000000 if it was 0. See raise.c for how this is used. */
|
|
|
|
it eq
|
|
|
|
moveq r0, #0x80000000
|
|
|
|
str r0, NEGOFF_OFF1 (r2, PID_OFFSET) /* Store the temp PID. */
|
|
|
|
|
2011-03-21 20:44:01 +00:00
|
|
|
/* The DO_CALL macro saves r7 on the stack, to enable generation
|
|
|
|
of ARM unwind info. Since the stack is initially shared between
|
|
|
|
parent and child of vfork, that saved value could be corrupted.
|
|
|
|
To avoid this problem, we save r7 into ip as well, and restore
|
|
|
|
from there. */
|
|
|
|
mov ip, r7
|
|
|
|
cfi_register (r7, ip)
|
|
|
|
.fnstart
|
2013-02-15 05:00:14 +00:00
|
|
|
push { r7 }
|
2011-03-21 20:44:01 +00:00
|
|
|
cfi_adjust_cfa_offset (4)
|
|
|
|
.save { r7 }
|
|
|
|
ldr r7, =SYS_ify (vfork)
|
|
|
|
swi 0x0
|
|
|
|
.fnend
|
|
|
|
add sp, sp, #4
|
|
|
|
cfi_adjust_cfa_offset (-4)
|
|
|
|
mov r7, ip
|
2014-05-14 16:44:24 +00:00
|
|
|
cfi_restore (r7)
|
|
|
|
|
|
|
|
/* Restore the old PID value in the parent. */
|
|
|
|
cmp r0, #0 /* If we are the parent... */
|
|
|
|
it ne
|
|
|
|
strne r3, NEGOFF_OFF1 (r2, PID_OFFSET) /* restore the saved PID. */
|
|
|
|
|
1999-04-12 09:03:50 +00:00
|
|
|
cmn a1, #4096
|
2013-02-14 04:27:09 +00:00
|
|
|
it cc
|
2004-12-04 21:20:17 +00:00
|
|
|
RETINSTR(cc, lr)
|
1999-04-12 09:03:50 +00:00
|
|
|
|
* sysdeps/arm/bits/setjmp.h, sysdeps/arm/fpu/bits/setjmp.h: Update
include guards.
* sysdeps/unix/arm/sysdep.S (syscall_error): Handle USE___THREAD and
RTLD_PRIVATE_ERRNO.
* sysdeps/unix/sysv/linux/arm/clone.S (__clone): Handle RESET_PID.
Handle new arguments.
* sysdeps/unix/sysv/linux/arm/vfork.S (__vfork): Use SAVE_PID and
RESTORE_PID. Use the right syscall error handler.
* sysdeps/unix/sysv/linux/arm/eabi/sigrestorer.S
(__default_sa_restorer, __default_rt_sa_restorer): Add unwind
information.
* sysdeps/unix/sysv/linux/arm/eabi/socket.S: Update formatting.
Add unwind information. Correct stack alignment typo.
* sysdeps/unix/sysv/linux/arm/eabi/sysdep.h
(INTERNAL_SYSCALL_NCS): Define.
* sysdeps/unix/sysv/linux/arm/sigaction.c
(__libc_sigaction): Remove never-valid handling for SA_ONSTACK.
* sysdeps/unix/sysv/linux/arm/socket.S: Whitespace cleanup.
* sysdeps/unix/sysv/linux/arm/sysdep.h (SYSCALL_ERROR_HANDLER): Handle
RTLD_PRIVATE_ERRNO.
(INTERNAL_SYSCALL_NCS): Implement.
* sysdeps/arm/nptl/Makefile, sysdeps/arm/nptl/jmpbuf-unwind.h,
sysdeps/arm/nptl/pthread_spin_lock.S,
sysdeps/arm/nptl/pthread_spin_trylock.S,
sysdeps/arm/nptl/pthreaddef.h, sysdeps/arm/nptl/tcb-offsets.sym,
sysdeps/arm/nptl/tls.h, sysdeps/unix/sysv/linux/arm/eabi/Makefile,
sysdeps/unix/sysv/linux/arm/eabi/nptl/Makefile,
sysdeps/unix/sysv/linux/arm/eabi/nptl/configure,
sysdeps/unix/sysv/linux/arm/eabi/nptl/configure.in,
sysdeps/unix/sysv/linux/arm/eabi/nptl/nptl-aeabi_unwind_cpp_pr1.c,
sysdeps/unix/sysv/linux/arm/eabi/nptl/rt-aeabi_unwind_cpp_pr1.c,
sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h,
sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-forcedunwind.c,
sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind-resume.c,
sysdeps/unix/sysv/linux/arm/eabi/nptl/unwind.h,
sysdeps/unix/sysv/linux/arm/nptl/Versions,
sysdeps/unix/sysv/linux/arm/nptl/bits/atomic.h,
sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h,
sysdeps/unix/sysv/linux/arm/nptl/clone.S,
sysdeps/unix/sysv/linux/arm/nptl/createthread.c,
sysdeps/unix/sysv/linux/arm/nptl/fork.c,
sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.c,
sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h,
sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S,
sysdeps/unix/sysv/linux/arm/nptl/pthread_once.c,
sysdeps/unix/sysv/linux/arm/nptl/vfork.S: New files.
2005-11-16 19:03:42 +00:00
|
|
|
b PLTJMP(SYSCALL_ERROR)
|
1999-04-12 09:03:50 +00:00
|
|
|
PSEUDO_END (__vfork)
|
2002-12-31 20:37:32 +00:00
|
|
|
libc_hidden_def (__vfork)
|
1999-04-12 09:03:50 +00:00
|
|
|
|
|
|
|
weak_alias (__vfork, vfork)
|
2014-05-14 16:44:24 +00:00
|
|
|
strong_alias (__vfork, __libc_vfork)
|