]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/unix/sysv/linux/x86_64/clone.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / x86_64 / clone.S
index 9695e1eaf877cae5705ff2df7ad36b1ff87a9c59..34bebe0c00020e1c7c0e2d46adf5400d31e94e82 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2018 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
@@ -12,9 +12,8 @@
    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.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /* clone() is even more special than fork() as it mucks with stacks
    and invokes a function in the right context after its all over.  */
 #define _ERRNO_H       1
 #include <bits/errno.h>
 #include <asm-syntax.h>
-#include <bp-sym.h>
-#include <bp-asm.h>
-
-#define CLONE_VM       0x00000100
-#define CLONE_THREAD   0x00010000
 
 /* The userland implementation is:
    int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg),
@@ -53,7 +47,7 @@
 
 
         .text
-ENTRY (BP_SYM (__clone))
+ENTRY (__clone)
        /* Sanity check arguments.  */
        movq    $-EINVAL,%rax
        testq   %rdi,%rdi               /* no NULL function pointers */
@@ -73,8 +67,8 @@ ENTRY (BP_SYM (__clone))
        movq    %rdx, %rdi
        movq    %r8, %rdx
        movq    %r9, %r8
-       movq    8(%rsp), %r10
-       movq    $SYS_ify(clone),%rax
+       mov     8(%rsp), %R10_LP
+       movl    $SYS_ify(clone),%eax
 
        /* End FDE now, because in the child the unwind info will be
           wrong.  */
@@ -85,26 +79,15 @@ ENTRY (BP_SYM (__clone))
        jl      SYSCALL_ERROR_LABEL
        jz      L(thread_start)
 
-L(pseudo_end):
        ret
 
 L(thread_start):
+       cfi_startproc;
+       /* Clearing frame pointer is insufficient, use CFI.  */
+       cfi_undefined (rip);
        /* Clear the frame pointer.  The ABI suggests this be done, to mark
           the outermost frame obviously.  */
-       xorq    %rbp, %rbp
-
-#ifdef RESET_PID
-       testq   $CLONE_THREAD, %rdi
-       jne     1f
-       testq   $CLONE_VM, %rdi
-       movl    $-1, %eax
-       jne     2f
-       movq    $SYS_ify(getpid), %rax
-       syscall
-2:     movl    %eax, %fs:PID
-       movl    %eax, %fs:TID
-1:
-#endif
+       xorl    %ebp, %ebp
 
        /* Set up arguments for the function call.  */
        popq    %rax            /* Function to call.  */
@@ -112,9 +95,12 @@ L(thread_start):
        call    *%rax
        /* Call exit with return value from function call. */
        movq    %rax, %rdi
-       call    HIDDEN_JUMPTARGET (_exit)
+       movl    $SYS_ify(exit), %eax
+       syscall
+       cfi_endproc;
 
        cfi_startproc;
-PSEUDO_END (BP_SYM (__clone))
+PSEUDO_END (__clone)
 
-weak_alias (BP_SYM (__clone), BP_SYM (clone))
+libc_hidden_def (__clone)
+weak_alias (__clone, clone)