mirror of
git://sourceware.org/git/glibc.git
synced 2026-11-29 05:07:43 +08:00
Update.
2003-01-09 Jakub Jelinek <jakub@redhat.com> * posix/test-vfork.c (noop): Add __attribute_noinline__. * sysdeps/generic/sysdep.h (JUMPTARGET): Define if not defined. * sysdeps/i386/sysdep.h (JUMPTARGET): Undefine JUMPTARGET before defining it. * sysdeps/powerpc/powerpc32/sysdep.h (JUMPTARGET): Likewise. * sysdeps/powerpc/powerpc64/sysdep.h (JUMPTARGET): Likewise. * sysdeps/s390/s390-32/sysdep.h (JUMPTARGET): Likewise. * sysdeps/s390/s390-64/sysdep.h (JUMPTARGET): Likewise. * sysdeps/x86_64/sysdep.h (JUMPTARGET): Likewise.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/* Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
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.
|
||||
|
||||
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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
|
||||
#include <sysdep-cancel.h>
|
||||
|
||||
.globl __vfork
|
||||
.align 4
|
||||
.ent __vfork,0
|
||||
__LABEL(__vfork)
|
||||
ldgp gp, 0(pv)
|
||||
.prologue 1
|
||||
PSEUDO_PROF
|
||||
SINGLE_THREAD_P(t0)
|
||||
bne t0, HIDDEN_JUMPTARGET (__fork) !samegp
|
||||
lda v0, SYS_ify(vfork)
|
||||
call_pal PAL_callsys
|
||||
bne a3, __syscall_error !samegp
|
||||
ret
|
||||
PSEUDO_END(__vfork)
|
||||
libc_hidden_def (__vfork)
|
||||
|
||||
weak_alias (__vfork, vfork)
|
||||
@@ -0,0 +1,81 @@
|
||||
/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Andreas Schwab <schwab@gnu.org>.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
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.
|
||||
|
||||
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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sysdep-cancel.h>
|
||||
#define _ERRNO_H 1
|
||||
#include <bits/errno.h>
|
||||
#include <kernel-features.h>
|
||||
|
||||
/* 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)
|
||||
|
||||
#ifdef __NR_vfork
|
||||
|
||||
SINGLE_THREAD_P
|
||||
jne HIDDEN_JUMPTARGET (__fork)
|
||||
|
||||
/* Pop the return PC value into ECX. */
|
||||
popl %ecx
|
||||
|
||||
/* Stuff the syscall number in EAX and enter into the kernel. */
|
||||
movl $SYS_ify (vfork), %eax
|
||||
int $0x80
|
||||
|
||||
/* Jump to the return PC. Don't jump directly since this
|
||||
disturbs the branch target cache. Instead push the return
|
||||
address back on the stack. */
|
||||
pushl %ecx
|
||||
|
||||
cmpl $-4095, %eax
|
||||
/* Branch forward if it failed. */
|
||||
# ifdef __ASSUME_VFORK_SYSCALL
|
||||
jae SYSCALL_ERROR_LABEL
|
||||
.Lpseudo_end:
|
||||
# else
|
||||
jae .Lerror
|
||||
# endif
|
||||
|
||||
ret
|
||||
|
||||
# ifndef __ASSUME_VFORK_SYSCALL
|
||||
.Lerror:
|
||||
/* Check if vfork syscall is known at all. */
|
||||
cmpl $-ENOSYS, %eax
|
||||
jne SYSCALL_ERROR_LABEL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __ASSUME_VFORK_SYSCALL
|
||||
/* If we don't have vfork, fork is close enough. */
|
||||
|
||||
movl $SYS_ify (fork), %eax
|
||||
int $0x80
|
||||
cmpl $-4095, %eax
|
||||
jae SYSCALL_ERROR_LABEL
|
||||
.Lpseudo_end:
|
||||
ret
|
||||
#endif
|
||||
PSEUDO_END (__vfork)
|
||||
libc_hidden_def (__vfork)
|
||||
|
||||
weak_alias (__vfork, vfork)
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
|
||||
|
||||
@@ -105,7 +105,7 @@ __syscall_error_##args: \
|
||||
p_header.data.multiple_threads) == 0, 1)
|
||||
# else
|
||||
# define SINGLE_THREAD_P \
|
||||
adds r14 = MULTIPLE_THREADS_OFFSET, r13 ;; ld4 r14 = [r14] ;; cmp4.ne p6, p7 = 0, r14 ;;
|
||||
adds r14 = MULTIPLE_THREADS_OFFSET, r13 ;; ld4 r14 = [r14] ;; cmp4.ne p6, p7 = 0, r14
|
||||
# endif
|
||||
|
||||
#elif !defined __ASSEMBLER__
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
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.
|
||||
|
||||
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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
|
||||
#include <sysdep-cancel.h>
|
||||
#define _SIGNAL_H
|
||||
#include <bits/signum.h>
|
||||
|
||||
#define JUMPTARGET(name) name
|
||||
|
||||
/* The following are defined in linux/sched.h, which unfortunately */
|
||||
/* is not safe for inclusion in an assembly file. */
|
||||
#define CLONE_VM 0x00000100 /* set if VM shared between processes */
|
||||
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
|
||||
|
||||
/* pid_t vfork(void); */
|
||||
/* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */
|
||||
|
||||
ENTRY(__vfork)
|
||||
SINGLE_THREAD_P
|
||||
(p6) br.cond.spnt.few HIDDEN_JUMPTARGET (__fork);;
|
||||
alloc r2=ar.pfs,0,0,2,0
|
||||
mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD
|
||||
mov out1=0 /* Standard sp value. */
|
||||
;;
|
||||
DO_CALL (SYS_ify (clone))
|
||||
cmp.eq p6,p0=-1,r10
|
||||
;;
|
||||
(p6) br.cond.spnt.few __syscall_error
|
||||
ret
|
||||
PSEUDO_END(__vfork)
|
||||
libc_hidden_def (__vfork)
|
||||
|
||||
weak_alias (__vfork, vfork)
|
||||
@@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
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.
|
||||
|
||||
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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sysdep-cancel.h>
|
||||
|
||||
.text
|
||||
ENTRY(__vfork)
|
||||
ld [%g6 + MULTIPLE_THREADS_OFFSET], %o0
|
||||
cmp %o0, 0
|
||||
bne HIDDEN_JUMPTARGET(__fork)
|
||||
mov __NR_vfork, %g1
|
||||
ta 0x10;
|
||||
bcs __syscall_error_handler
|
||||
nop
|
||||
sub %o1, 1, %o1
|
||||
retl
|
||||
and %o0, %o1, %o0
|
||||
SYSCALL_ERROR_HANDLER
|
||||
PSEUDO_END (__vfork)
|
||||
libc_hidden_def (__vfork)
|
||||
weak_alias (__vfork, vfork)
|
||||
@@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
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.
|
||||
|
||||
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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sysdep-cancel.h>
|
||||
|
||||
.text
|
||||
ENTRY(__vfork)
|
||||
ld [%g6 + MULTIPLE_THREADS_OFFSET], %o0
|
||||
bne HIDDEN_JUMPTARGET (__fork)
|
||||
mov __NR_vfork, %g1
|
||||
ta 0x6d
|
||||
bcs,pn %xcc, __syscall_error_handler
|
||||
nop
|
||||
sub %o1, 1, %o1
|
||||
retl
|
||||
and %o0, %o1, %o0
|
||||
SYSCALL_ERROR_HANDLER
|
||||
PSEUDO_END (__vfork)
|
||||
libc_hidden_def (__vfork)
|
||||
weak_alias (__vfork, vfork)
|
||||
@@ -0,0 +1,54 @@
|
||||
/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
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.
|
||||
|
||||
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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sysdep-cancel.h>
|
||||
#define _ERRNO_H 1
|
||||
#include <bits/errno.h>
|
||||
|
||||
/* 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)
|
||||
|
||||
SINGLE_THREAD_P
|
||||
jne HIDDEN_JUMPTARGET (__fork)
|
||||
|
||||
/* Pop the return PC value into RDI. We need a register that
|
||||
is preserved by the syscall and that we're allowed to destroy. */
|
||||
popq %rdi
|
||||
|
||||
/* Stuff the syscall number in RAX and enter into the kernel. */
|
||||
movl $SYS_ify (vfork), %eax
|
||||
syscall
|
||||
|
||||
/* Push back the return PC. */
|
||||
pushq %rdi
|
||||
|
||||
cmpl $-4095, %eax
|
||||
jae SYSCALL_ERROR_LABEL /* Branch forward if it failed. */
|
||||
|
||||
/* Normal return. */
|
||||
.Lpseudo_end:
|
||||
ret
|
||||
|
||||
PSEUDO_END (__vfork)
|
||||
libc_hidden_def (__vfork)
|
||||
|
||||
weak_alias (__vfork, vfork)
|
||||
Reference in New Issue
Block a user