This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch rth/aa-opt created. glibc-2.19-482-g4898288


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, rth/aa-opt has been created
        at  48982885f327ae22cdcf381908b8048f38301fa1 (commit)

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=48982885f327ae22cdcf381908b8048f38301fa1

commit 48982885f327ae22cdcf381908b8048f38301fa1
Author: Richard Henderson <rth@redhat.com>
Date:   Fri May 23 16:23:32 2014 -0400

    aarch64: Consolidate NPTL/non versions of vfork
    
    At the same time, incorporate the 0 -> 0x80000000 mapping
    of the pid expected by raise.c.

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/pt-vfork.S b/sysdeps/unix/sysv/linux/aarch64/nptl/pt-vfork.S
deleted file mode 100644
index 2108347..0000000
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/pt-vfork.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2009-2014 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <tcb-offsets.h>
-
-/* Save the PID value.  */
-#define SAVE_PID							\
-	mrs	x2, tpidr_el0;						\
-	sub	x2, x2, #PTHREAD_SIZEOF;				\
-	ldr	w3, [x2, #PTHREAD_PID_OFFSET];				\
-	neg	w0, w3;							\
-	str	w0, [x2, #PTHREAD_PID_OFFSET]
-
-/* Restore the old PID value in the parent.  */
-#define RESTORE_PID                                                     \
-	cbz	x0, 1f;							\
-	str	w3, [x2, #PTHREAD_PID_OFFSET];				\
-1:
-
-#include "../vfork.S"
diff --git a/sysdeps/unix/sysv/linux/aarch64/pt-vfork.c b/sysdeps/unix/sysv/linux/aarch64/pt-vfork.c
new file mode 100644
index 0000000..5dd23bf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/pt-vfork.c
@@ -0,0 +1,54 @@
+/* vfork ABI-compatibility entry points for libpthread.
+   Copyright (C) 2014 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <shlib-compat.h>
+
+/* libpthread used to have its own vfork implementation that differed
+   from libc's only in having a pointless micro-optimization.  There
+   is no longer any use to having a separate copy in libpthread, but
+   the historical ABI requires it.  For static linking, there is no
+   need to provide anything here--the libc version will be linked in.
+   For shared library ABI compatibility, there must be __vfork and
+   vfork symbols in libpthread.so.  */
+
+#if HAVE_IFUNC
+# include <nptl/pt-vfork.c>
+#elif (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) \
+       || SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20))
+
+/* Thankfully, on AArch64 we can rely on the compiler generating
+   a tail call here.  */
+
+extern void __libc_vfork (void);
+
+void
+vfork_compat (void)
+{
+  __libc_vfork ();
+}
+
+# if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20)
+compat_symbol (libpthread, vfork_compat, vfork, GLIBC_2_0);
+# endif
+
+# if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)
+strong_alias (vfork_compat, vfork_compat2)
+compat_symbol (libpthread, vfork_compat2, __vfork, GLIBC_2_1_2);
+# endif
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/vfork.S b/sysdeps/unix/sysv/linux/aarch64/vfork.S
index d9f2c70..316cb65 100644
--- a/sysdeps/unix/sysv/linux/aarch64/vfork.S
+++ b/sysdeps/unix/sysv/linux/aarch64/vfork.S
@@ -28,22 +28,33 @@
 
 ENTRY (__vfork)
 
-#ifdef SAVE_PID
-	SAVE_PID
-#endif
+	/* Save the TCB-cached PID away in w3, and then negate the TCB
+           field.  But if it's zero, set it to 0x80000000 instead.  See
+           raise.c for the logic that relies on this value.  */
+	mrs	x2, tpidr_el0
+	sub	x2, x2, #PTHREAD_SIZEOF
+	ldr	w3, [x2, #PTHREAD_PID_OFFSET]
+	mov	w1, #0x80000000
+	negs	w0, w3
+	csel	w0, w1, w0, eq
+	str	w0, [x2, #PTHREAD_PID_OFFSET]
+
 	mov	x0, #0x4111	/* CLONE_VM | CLONE_VFORK | SIGCHLD */
 	mov	x1, sp
 	DO_CALL (clone, 2)
-#ifdef RESTORE_PID
-	RESTORE_PID
-#endif
+
+	/* Restore the original value of the TCB cache of the PID, if we're
+	   the parent.  But in the child (syscall return value equals zero),
+	   leave things as they are.  */
+	cbz	x0, 1f
+	str	w3, [x2, #PTHREAD_PID_OFFSET]
+1:
 	cmn	x0, #4095
-	b.cs    1f
+	b.cs    .Lsyscall_error
 	RET
-1:
-	b	SYSCALL_ERROR
 
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 
 weak_alias (__vfork, vfork)
+strong_alias (__vfork, __libc_vfork)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9aeca2d5db8efe89c1d9fb12f3bd563759d3aee7

commit 9aeca2d5db8efe89c1d9fb12f3bd563759d3aee7
Author: Richard Henderson <rth@redhat.com>
Date:   Fri May 23 15:44:23 2014 -0400

    aarch64: Consolidate NPTL/non versions of clone
    
    At the same time, rely on non-clobbered registers across syscall
    so that we eliminate the stack frame that we previously ignored
    in the unwind info.

diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S
index f2964f4..a2b5a2b 100644
--- a/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -39,47 +39,42 @@
  */
         .text
 ENTRY(__clone)
+	/* Save args for the child.  */
+	mov	x10, x0
+	mov	x11, x2
+	mov	x12, x3
+
 	/* Sanity check args.  */
-	cbz	x0, 1f
-	cbz	x1, 1f
-	/* Insert the args onto the new stack.  */
-	stp	x0, x3, [x1, #-16]!	/* Fn, arg.  */
+	mov	x0, #-EINVAL
+	cbz	x10, .Lsyscall_error
+	cbz	x1, .Lsyscall_error
 
 	/* Do the system call.  */
+	/* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid.  */
 	mov	x0, x2                  /* flags  */
-
 	/* New sp is already in x1.  */
 	mov	x2, x4			/* ptid  */
 	mov	x3, x5			/* tls  */
 	mov	x4, x6			/* ctid  */
-
-#ifdef RESET_PID
-	/* We rely on the kernel preserving the argument regsiters across a
-	   each system call so that we can inspect the flags against after
-	   the clone call.  */
-	mov	x5, x0
-#endif
-
 	mov	x8, #SYS_ify(clone)
-	/* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid.  */
 	svc	0x0
-	cfi_endproc
+
 	cmp	x0, #0
-	beq	2f
-	blt	3f
+	beq	thread_start
+	blt	.Lsyscall_error
 	RET
-1:	mov	x0, #-EINVAL
-3:
-	b	syscall_error
+PSEUDO_END (__clone)
 
-2:
+	.align 4
+	.type thread_start, %function
+thread_start:
 	cfi_startproc
 	cfi_undefined (x30)
 	mov	x29, 0
-#ifdef RESET_PID
-	tbnz	x5, #CLONE_THREAD_BIT, 3f
+
+	tbnz	x11, #CLONE_THREAD_BIT, 3f
 	mov	x0, #-1
-	tbnz	x5, #CLONE_VM_BIT, 2f
+	tbnz	x11, #CLONE_VM_BIT, 2f
 	mov	x8, #SYS_ify(getpid)
 	svc	0x0
 2:
@@ -87,18 +82,15 @@ ENTRY(__clone)
 	sub	x1, x1, #PTHREAD_SIZEOF
 	str	w0, [x1, #PTHREAD_PID_OFFSET]
 	str	w0, [x1, #PTHREAD_TID_OFFSET]
-
 3:
-#endif
-	/* Pick the function arg and call address from the stack and
-	   execute.  */
-	ldp	x1, x0, [sp], #16
-	blr	x1
+
+	/* Pick the function arg and execute.  */
+	mov	x0, x12
+	blr	x10
 
 	/* We are done, pass the return value through x0.  */
 	b	HIDDEN_JUMPTARGET(_exit)
 	cfi_endproc
-	cfi_startproc
-PSEUDO_END (__clone)
+	.size thread_start, .-thread_start
 
 weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/clone.S b/sysdeps/unix/sysv/linux/aarch64/nptl/clone.S
deleted file mode 100644
index 281be3b..0000000
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/clone.S
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 2009-2014 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define RESET_PID
-#include <tcb-offsets.h>
-#include "../clone.S"

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=877a6f86418e01d571968a4fac5c8f68f12c1e13

commit 877a6f86418e01d571968a4fac5c8f68f12c1e13
Author: Richard Henderson <rth@redhat.com>
Date:   Thu May 22 16:57:20 2014 -0400

    aarch64: Rely on syscalls preserving registers
    
    In several cases we've had asm routines rely on syscalls not clobbering
    call-clobbered registers, and that's now deemed ABI.  So take advantage
    of this in the INLINE_SYSCALL path as well.
    
    Shrinks libc.so by about 1k.

diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 8cce986..4686599 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -231,7 +231,7 @@
     LOAD_ARGS_##nr (args)					\
     asm volatile ("blr %1"					\
 		  : "=r" (_x0)					\
-		  : "r" (funcptr), ASM_ARGS_##nr		\
+		  : "r" (funcptr) ASM_ARGS_##nr			\
 		  : "x30", "memory");				\
     (long) _x0;							\
   })
@@ -254,17 +254,15 @@
 
 # undef INTERNAL_SYSCALL_RAW
 # define INTERNAL_SYSCALL_RAW(name, err, nr, args...)		\
-  ({ unsigned long _sys_result;					\
+  ({ long _sys_result;						\
      {								\
        LOAD_ARGS_##nr (args)					\
        register long _x8 asm ("x8") = (name);			\
        asm volatile ("svc	0	// syscall " # name     \
-		     : "+r" (_x0), "+r" (_x8)			\
-		     : ASM_ARGS_##nr				\
-		     : "memory", CLOBBER_ARGS_##nr);		\
+		     : "=r" (_x0) : "r"(_x8) ASM_ARGS_##nr : "memory");	\
        _sys_result = _x0;					\
      }								\
-     (long) _sys_result; })
+     _sys_result; })
 
 # undef INTERNAL_SYSCALL
 # define INTERNAL_SYSCALL(name, err, nr, args...)		\
@@ -281,54 +279,44 @@
 # undef INTERNAL_SYSCALL_ERRNO
 # define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
 
-# define CLOBBER_ARGS_0       CLOBBER_ARGS_1
-# define CLOBBER_ARGS_1 "x1", CLOBBER_ARGS_2
-# define CLOBBER_ARGS_2 "x2", CLOBBER_ARGS_3
-# define CLOBBER_ARGS_3 "x3", CLOBBER_ARGS_4
-# define CLOBBER_ARGS_4 "x4", CLOBBER_ARGS_5
-# define CLOBBER_ARGS_5 "x5", CLOBBER_ARGS_6
-# define CLOBBER_ARGS_6 "x6", CLOBBER_ARGS_7
-# define CLOBBER_ARGS_7 \
-  "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18"
-
 # define LOAD_ARGS_0()				\
   register long _x0 asm ("x0");
-
-# define ASM_ARGS_0
 # define LOAD_ARGS_1(x0)			\
   long _x0tmp = (long) (x0);			\
   LOAD_ARGS_0 ()				\
   _x0 = _x0tmp;
-# define ASM_ARGS_1	"r" (_x0)
 # define LOAD_ARGS_2(x0, x1)			\
   long _x1tmp = (long) (x1);			\
   LOAD_ARGS_1 (x0)				\
   register long _x1 asm ("x1") = _x1tmp;
-# define ASM_ARGS_2	ASM_ARGS_1, "r" (_x1)
 # define LOAD_ARGS_3(x0, x1, x2)		\
   long _x2tmp = (long) (x2);			\
   LOAD_ARGS_2 (x0, x1)				\
   register long _x2 asm ("x2") = _x2tmp;
-# define ASM_ARGS_3	ASM_ARGS_2, "r" (_x2)
 # define LOAD_ARGS_4(x0, x1, x2, x3)		\
   long _x3tmp = (long) (x3);			\
   LOAD_ARGS_3 (x0, x1, x2)			\
   register long _x3 asm ("x3") = _x3tmp;
-# define ASM_ARGS_4	ASM_ARGS_3, "r" (_x3)
 # define LOAD_ARGS_5(x0, x1, x2, x3, x4)	\
   long _x4tmp = (long) (x4);			\
   LOAD_ARGS_4 (x0, x1, x2, x3)			\
   register long _x4 asm ("x4") = _x4tmp;
-# define ASM_ARGS_5	ASM_ARGS_4, "r" (_x4)
 # define LOAD_ARGS_6(x0, x1, x2, x3, x4, x5)	\
   long _x5tmp = (long) (x5);			\
   LOAD_ARGS_5 (x0, x1, x2, x3, x4)		\
   register long _x5 asm ("x5") = _x5tmp;
-# define ASM_ARGS_6	ASM_ARGS_5, "r" (_x5)
 # define LOAD_ARGS_7(x0, x1, x2, x3, x4, x5, x6)\
   long _x6tmp = (long) (x6);			\
   LOAD_ARGS_6 (x0, x1, x2, x3, x4, x5)		\
   register long _x6 asm ("x6") = _x6tmp;
+
+# define ASM_ARGS_0
+# define ASM_ARGS_1	, "r" (_x0)
+# define ASM_ARGS_2	ASM_ARGS_1, "r" (_x1)
+# define ASM_ARGS_3	ASM_ARGS_2, "r" (_x2)
+# define ASM_ARGS_4	ASM_ARGS_3, "r" (_x3)
+# define ASM_ARGS_5	ASM_ARGS_4, "r" (_x4)
+# define ASM_ARGS_6	ASM_ARGS_5, "r" (_x5)
 # define ASM_ARGS_7	ASM_ARGS_6, "r" (_x6)
 
 # undef INTERNAL_SYSCALL_NCS

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8125415d5922fe4ee026ff62cb05ec48b5f0df7b

commit 8125415d5922fe4ee026ff62cb05ec48b5f0df7b
Author: Richard Henderson <rth@redhat.com>
Date:   Tue May 20 16:34:59 2014 -0400

    aarch64: Use tpidr_el0 rather than __errno_location in librt

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data b/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data
index 84af95d..dfca9a7 100644
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data
+++ b/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data
@@ -12,4 +12,3 @@ libm.so: matherr
 libm.so: __signbit
 libm.so: __signbitf
 libm.so: __signbitl
-libpthread.so: __errno_location
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 0e91f83..8cce986 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -123,21 +123,12 @@
 
 #   define SYSCALL_ERROR_HANDLER				\
 .Lsyscall_error:						\
-	stp     x29, x30, [sp, -32]!;				\
-	cfi_adjust_cfa_offset (32);				\
-	cfi_rel_offset (x29, 0);				\
-	cfi_rel_offset (x30, 8);				\
-        add     x29, sp, 0;					\
-        str     x19, [sp,16];					\
-	neg	x19, x0;					\
-	bl	C_SYMBOL_NAME(__errno_location);		\
-	str	w19, [x0];					\
+	adrp	x1, :gottprel:errno;				\
+	neg	w2, w0;						\
+	ldr	x1, [x1, :gottprel_lo12:errno];			\
+	mrs	x3, tpidr_el0;					\
 	mov	x0, -1;						\
-        ldr     x19, [sp,16];					\
-        ldp     x29, x30, [sp], 32;				\
-	cfi_adjust_cfa_offset (-32);				\
-	cfi_restore (x29);					\
-	cfi_restore (x30);					\
+	str	w2, [x1, x3];					\
 	RET;
 #  endif
 # else

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c03d528f17586e307292d38dcc1bff7ce1d8d766

commit c03d528f17586e307292d38dcc1bff7ce1d8d766
Author: Richard Henderson <rth@redhat.com>
Date:   Tue May 20 16:17:20 2014 -0400

    aarch64: Use tpidr_el0 rather than __read_tp in librt

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
index fb37618..483d6fe 100644
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -113,17 +113,9 @@ extern int __local_multiple_threads attribute_hidden;
 				   header.multiple_threads) == 0, 1)
 #  else
 #   define SINGLE_THREAD_P(R)						\
-	stp	x0, x30, [sp, -16]!;					\
-	cfi_adjust_cfa_offset (16);					\
-	cfi_rel_offset (x0, 0);						\
-	cfi_rel_offset (x30, 8);					\
-	bl	__read_tp;						\
-	sub	x0, x0, PTHREAD_SIZEOF;					\
-	ldr	w##R, [x0, PTHREAD_MULTIPLE_THREADS_OFFSET];		\
-	ldp	x0, x30, [sp], 16;					\
-	cfi_restore (x0);						\
-	cfi_restore (x30);						\
-	cfi_adjust_cfa_offset (-16)
+	mrs     x##R, tpidr_el0;					\
+	sub	x##R, x##R, PTHREAD_SIZEOF;				\
+	ldr	w##R, [x##R, PTHREAD_MULTIPLE_THREADS_OFFSET]
 #  endif
 # endif
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=00451193f2a6d552b7b11aa5eebabbf943914d36

commit 00451193f2a6d552b7b11aa5eebabbf943914d36
Author: Richard Henderson <rth@redhat.com>
Date:   Sun May 25 14:57:53 2014 -0400

    aarch64: Improve syscall-cancel stack frame
    
    One push instead of N; use stp/ldp to halve the insns.

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
index bdb5c73..fb37618 100644
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -38,20 +38,22 @@ ENTRY (__##syscall_name##_nocancel);					\
 ENTRY (name);								\
 	SINGLE_THREAD_P(16);						\
 	cbz	w16, .Lpseudo_nocancel;					\
-	DOCARGS_##args;	/* save syscall args etc. around CENABLE.  */	\
+	/* Setup common stack frame no matter the number of args.	\
+	   Also save the first arg, since it's basically free.  */	\
+	stp	x30, x0, [sp, -64]!;					\
+	cfi_adjust_cfa_offset (64);					\
+	cfi_rel_offset (x30, 0);					\
+	DOCARGS_##args;		/* save syscall args around CENABLE.  */ \
 	CENABLE;							\
-	mov	x16, x0;	/* put mask in safe place.  */		\
+	mov	x16, x0;	/* save mask around syscall.  */	\
 	UNDOCARGS_##args;	/* restore syscall args.  */		\
-	mov	x8, SYS_ify (syscall_name);	/* do the call.  */	\
-	svc	0;							\
-	str	x0, [sp, -16]!;	/* save syscall return value.  */	\
-	cfi_adjust_cfa_offset (16);					\
-	mov	x0, x16;	 /* get mask back.  */			\
+	DO_CALL (syscall_name, args);					\
+	str	x0, [sp, 8];	/* save result around CDISABLE.  */	\
+	mov	x0, x16;	/* restore mask for CDISABLE.  */	\
 	CDISABLE;							\
-	ldr	x0, [sp], 16;						\
-	cfi_adjust_cfa_offset (-16);					\
-	ldr	x30, [sp], 16;						\
-	cfi_adjust_cfa_offset (-16);					\
+	/* Break down the stack frame, restoring result at once.  */	\
+	ldp	x30, x0, [sp], 64;					\
+	cfi_adjust_cfa_offset (-64);					\
 	cfi_restore (x30);						\
 	b	.Lpseudo_finish;					\
 	cfi_endproc;							\
@@ -63,83 +65,21 @@ ENTRY (name);								\
 	SYSCALL_ERROR_HANDLER;						\
 	cfi_endproc
 
-# define DOCARGS_0							\
-	str x30, [sp, -16]!;						\
-	cfi_adjust_cfa_offset (16);					\
-	cfi_rel_offset (x30, 0)
+# define DOCARGS_0
+# define DOCARGS_1
+# define DOCARGS_2	str x1, [sp, 16]
+# define DOCARGS_3	stp x1, x2, [sp, 16]
+# define DOCARGS_4	DOCARGS_3; str x3, [sp, 32]
+# define DOCARGS_5	DOCARGS_3; stp x3, x4, [sp, 32]
+# define DOCARGS_6	DOCARGS_5; str x5, [sp, 48]
 
 # define UNDOCARGS_0
-
-# define DOCARGS_1							\
-	DOCARGS_0;							\
-	str x0, [sp, -16]!;						\
-	cfi_adjust_cfa_offset (16);					\
-	cfi_rel_offset (x0, 0)
-
-# define UNDOCARGS_1							\
-	ldr x0, [sp], 16;						\
-	cfi_restore (x0);						\
-	cfi_adjust_cfa_offset (-16);					\
-
-# define DOCARGS_2							\
-	DOCARGS_1;							\
-	str x1, [sp, -16]!;						\
-	cfi_adjust_cfa_offset (16);					\
-	cfi_rel_offset (x1, 0)
-
-# define UNDOCARGS_2							\
-	ldr x1, [sp], 16;						\
-	cfi_restore (x1);						\
-	cfi_adjust_cfa_offset (-16);					\
-	UNDOCARGS_1
-
-# define DOCARGS_3							\
-	DOCARGS_2;							\
-	str x2, [sp, -16]!;						\
-	cfi_adjust_cfa_offset (16);					\
-	cfi_rel_offset (x2, 0)
-
-# define UNDOCARGS_3							\
-	ldr x2, [sp], 16;						\
-	cfi_restore (x2);						\
-	cfi_adjust_cfa_offset (-16);					\
-	UNDOCARGS_2
-
-# define DOCARGS_4							\
-	DOCARGS_3;							\
-	str x3, [sp, -16]!;						\
-	cfi_adjust_cfa_offset (16);					\
-	cfi_rel_offset (x3, 0)
-
-# define UNDOCARGS_4							\
-	ldr x3, [sp], 16;						\
-	cfi_restore (x3);						\
-	cfi_adjust_cfa_offset (-16);					\
-	UNDOCARGS_3
-
-# define DOCARGS_5							\
-	DOCARGS_4;							\
-	str x4, [sp, -16]!;						\
-	cfi_adjust_cfa_offset (16);					\
-	cfi_rel_offset (x4, 0)
-
-# define UNDOCARGS_5							\
-	ldr x4, [sp], 16;						\
-	cfi_restore (x4);						\
-	cfi_adjust_cfa_offset (-16);					\
-	UNDOCARGS_4
-
-# define DOCARGS_6							\
-	DOCARGS_5;							\
-	str x5, [sp, -16]!;						\
-	cfi_adjust_cfa_offset (16);					\
-	cfi_rel_offset (x5, 0)
-
-# define UNDOCARGS_6							\
-	ldr x5, [sp], 16;						\
-	cfi_restore (x5);						\
-	cfi_adjust_cfa_offset (-16);					\
-	UNDOCARGS_5
+# define UNDOCARGS_1	ldr x0, [sp], 8
+# define UNDOCARGS_2	ldp x0, x1, [sp, 8]
+# define UNDOCARGS_3	UNDOCARGS_1; ldp x1, x2, [sp, 16]
+# define UNDOCARGS_4	UNDOCARGS_2; ldp x2, x3, [sp, 24]
+# define UNDOCARGS_5	UNDOCARGS_3; ldp x3, x4, [sp, 32]
+# define UNDOCARGS_6	UNDOCARGS_4; ldp x4, x5, [sp, 40]
 
 # ifdef IS_IN_libpthread
 #  define CENABLE	bl __pthread_enable_asynccancel

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c94d42cf215db14a27b3d89502ede228276cdef4

commit c94d42cf215db14a27b3d89502ede228276cdef4
Author: Richard Henderson <rth@redhat.com>
Date:   Sun May 25 14:15:14 2014 -0400

    aarch64: Pass regno parameter to SINGLE_THREAD_P
    
    Use cbz instead of cmp+b.eq.

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
index 41502de..bdb5c73 100644
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -36,8 +36,8 @@ ENTRY (__##syscall_name##_nocancel);					\
 	.subsection 2;							\
 	.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
 ENTRY (name);								\
-	SINGLE_THREAD_P;						\
-	beq .Lpseudo_nocancel;						\
+	SINGLE_THREAD_P(16);						\
+	cbz	w16, .Lpseudo_nocancel;					\
 	DOCARGS_##args;	/* save syscall args etc. around CENABLE.  */	\
 	CENABLE;							\
 	mov	x16, x0;	/* put mask in safe place.  */		\
@@ -161,10 +161,9 @@ ENTRY (name);								\
 extern int __local_multiple_threads attribute_hidden;
 #   define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
 #  else
-#   define SINGLE_THREAD_P						\
-	adrp	x16, __local_multiple_threads;				\
-	ldr	w16, [x16, :lo12:__local_multiple_threads];		\
-	cmp	w16, 0;
+#   define SINGLE_THREAD_P(R)						\
+	adrp	x##R, __local_multiple_threads;				\
+	ldr	w##R, [x##R, :lo12:__local_multiple_threads]
 #  endif
 # else
 /*  There is no __local_multiple_threads for librt, so use the TCB.  */
@@ -173,19 +172,18 @@ extern int __local_multiple_threads attribute_hidden;
   __builtin_expect (THREAD_GETMEM (THREAD_SELF,				\
 				   header.multiple_threads) == 0, 1)
 #  else
-#   define SINGLE_THREAD_P						\
+#   define SINGLE_THREAD_P(R)						\
 	stp	x0, x30, [sp, -16]!;					\
 	cfi_adjust_cfa_offset (16);					\
 	cfi_rel_offset (x0, 0);						\
 	cfi_rel_offset (x30, 8);					\
 	bl	__read_tp;						\
 	sub	x0, x0, PTHREAD_SIZEOF;					\
-	ldr	w16, [x0, PTHREAD_MULTIPLE_THREADS_OFFSET];		\
+	ldr	w##R, [x0, PTHREAD_MULTIPLE_THREADS_OFFSET];		\
 	ldp	x0, x30, [sp], 16;					\
 	cfi_restore (x0);						\
 	cfi_restore (x30);						\
-	cfi_adjust_cfa_offset (-16);					\
-	cmp	w16, 0;
+	cfi_adjust_cfa_offset (-16)
 #  endif
 # endif
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5591f178e7d20f10c3250f2ce49986d2d7d5dfb3

commit 5591f178e7d20f10c3250f2ce49986d2d7d5dfb3
Author: Richard Henderson <rth@redhat.com>
Date:   Sun May 25 14:07:17 2014 -0400

    aarch64: Share code in syscall-cancel.h
    
    Fold nocancel and error handling paths.

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
index 26d4c0e..41502de 100644
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -27,24 +27,17 @@
 # undef PSEUDO
 # define PSEUDO(name, syscall_name, args)				\
 	.section ".text";						\
-	.type	__##syscall_name##_nocancel,%function;			\
-	.globl	__##syscall_name##_nocancel;				\
-__##syscall_name##_nocancel:						\
-	cfi_startproc;							\
+ENTRY (__##syscall_name##_nocancel);					\
+.Lpseudo_nocancel:							\
 	DO_CALL (syscall_name, args);					\
+.Lpseudo_finish:							\
 	cmn	x0, 4095;						\
 	b.cs	.Lsyscall_error;					\
-	PSEUDO_RET;							\
-	cfi_endproc;							\
+	.subsection 2;							\
 	.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
 ENTRY (name);								\
 	SINGLE_THREAD_P;						\
-	bne .Lpseudo_cancel;						\
-	DO_CALL (syscall_name, 0);					\
-	cmn x0, 4095;							\
-	b.cs .Lsyscall_error;						\
-	PSEUDO_RET;							\
-.Lpseudo_cancel:							\
+	beq .Lpseudo_nocancel;						\
 	DOCARGS_##args;	/* save syscall args etc. around CENABLE.  */	\
 	CENABLE;							\
 	mov	x16, x0;	/* put mask in safe place.  */		\
@@ -60,8 +53,15 @@ ENTRY (name);								\
 	ldr	x30, [sp], 16;						\
 	cfi_adjust_cfa_offset (-16);					\
 	cfi_restore (x30);						\
-	cmn	x0, 4095;						\
-	b.cs	.Lsyscall_error;
+	b	.Lpseudo_finish;					\
+	cfi_endproc;							\
+	.size	name, .-name;						\
+	.previous
+
+# undef PSEUDO_END
+# define PSEUDO_END(name)						\
+	SYSCALL_ERROR_HANDLER;						\
+	cfi_endproc
 
 # define DOCARGS_0							\
 	str x30, [sp, -16]!;						\

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=df5496b406e163c2c10127a3b75fb72e1abe1fc0

commit df5496b406e163c2c10127a3b75fb72e1abe1fc0
Author: Richard Henderson <rth@redhat.com>
Date:   Sun May 25 13:00:00 2014 -0400

    aarch64: Tabify sysdep-cancel.h

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
index c300b2d..26d4c0e 100644
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -26,42 +26,42 @@
 
 # undef PSEUDO
 # define PSEUDO(name, syscall_name, args)				\
-  .section ".text";							\
-  .type __##syscall_name##_nocancel,%function;				\
-  .globl __##syscall_name##_nocancel;					\
-  __##syscall_name##_nocancel:						\
-    cfi_startproc;							\
-    DO_CALL (syscall_name, args);					\
-    cmn x0, 4095;							\
-    b.cs .Lsyscall_error;						\
-    PSEUDO_RET;								\
-    cfi_endproc;							\
-    .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	\
-  ENTRY (name);								\
-    SINGLE_THREAD_P;							\
-    bne .Lpseudo_cancel;						\
-    DO_CALL (syscall_name, 0);						\
-    cmn x0, 4095;							\
-    b.cs .Lsyscall_error;						\
-    PSEUDO_RET;								\
-  .Lpseudo_cancel:							\
-    DOCARGS_##args;	/* save syscall args etc. around CENABLE.  */	\
-    CENABLE;								\
-    mov x16, x0;	/* put mask in safe place.  */			\
-    UNDOCARGS_##args;	/* restore syscall args.  */			\
-    mov x8, SYS_ify (syscall_name);	/* do the call.  */		\
-    svc	0;								\
-    str x0, [sp, -16]!;	/* save syscall return value.  */		\
-    cfi_adjust_cfa_offset (16);						\
-    mov x0, x16;	 /* get mask back.  */				\
-    CDISABLE;								\
-    ldr x0, [sp], 16;							\
-    cfi_adjust_cfa_offset (-16);					\
-    ldr x30, [sp], 16;							\
-    cfi_adjust_cfa_offset (-16);					\
-    cfi_restore (x30);							\
-    cmn x0, 4095;							\
-    b.cs .Lsyscall_error;
+	.section ".text";						\
+	.type	__##syscall_name##_nocancel,%function;			\
+	.globl	__##syscall_name##_nocancel;				\
+__##syscall_name##_nocancel:						\
+	cfi_startproc;							\
+	DO_CALL (syscall_name, args);					\
+	cmn	x0, 4095;						\
+	b.cs	.Lsyscall_error;					\
+	PSEUDO_RET;							\
+	cfi_endproc;							\
+	.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
+ENTRY (name);								\
+	SINGLE_THREAD_P;						\
+	bne .Lpseudo_cancel;						\
+	DO_CALL (syscall_name, 0);					\
+	cmn x0, 4095;							\
+	b.cs .Lsyscall_error;						\
+	PSEUDO_RET;							\
+.Lpseudo_cancel:							\
+	DOCARGS_##args;	/* save syscall args etc. around CENABLE.  */	\
+	CENABLE;							\
+	mov	x16, x0;	/* put mask in safe place.  */		\
+	UNDOCARGS_##args;	/* restore syscall args.  */		\
+	mov	x8, SYS_ify (syscall_name);	/* do the call.  */	\
+	svc	0;							\
+	str	x0, [sp, -16]!;	/* save syscall return value.  */	\
+	cfi_adjust_cfa_offset (16);					\
+	mov	x0, x16;	 /* get mask back.  */			\
+	CDISABLE;							\
+	ldr	x0, [sp], 16;						\
+	cfi_adjust_cfa_offset (-16);					\
+	ldr	x30, [sp], 16;						\
+	cfi_adjust_cfa_offset (-16);					\
+	cfi_restore (x30);						\
+	cmn	x0, 4095;						\
+	b.cs	.Lsyscall_error;
 
 # define DOCARGS_0							\
 	str x30, [sp, -16]!;						\
@@ -162,9 +162,9 @@ extern int __local_multiple_threads attribute_hidden;
 #   define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
 #  else
 #   define SINGLE_THREAD_P						\
-  adrp	x16, __local_multiple_threads;					\
-  ldr	w16, [x16, :lo12:__local_multiple_threads];			\
-  cmp	w16, 0;
+	adrp	x16, __local_multiple_threads;				\
+	ldr	w16, [x16, :lo12:__local_multiple_threads];		\
+	cmp	w16, 0;
 #  endif
 # else
 /*  There is no __local_multiple_threads for librt, so use the TCB.  */
@@ -174,18 +174,18 @@ extern int __local_multiple_threads attribute_hidden;
 				   header.multiple_threads) == 0, 1)
 #  else
 #   define SINGLE_THREAD_P						\
-  stp	x0, x30, [sp, -16]!;						\
-  cfi_adjust_cfa_offset (16);						\
-  cfi_rel_offset (x0, 0);						\
-  cfi_rel_offset (x30, 8);						\
-  bl	__read_tp;							\
-  sub	x0, x0, PTHREAD_SIZEOF;						\
-  ldr	w16, [x0, PTHREAD_MULTIPLE_THREADS_OFFSET];			\
-  ldp	x0, x30, [sp], 16;						\
-  cfi_restore (x0);							\
-  cfi_restore (x30);							\
-  cfi_adjust_cfa_offset (-16);						\
-  cmp	w16, 0
+	stp	x0, x30, [sp, -16]!;					\
+	cfi_adjust_cfa_offset (16);					\
+	cfi_rel_offset (x0, 0);						\
+	cfi_rel_offset (x30, 8);					\
+	bl	__read_tp;						\
+	sub	x0, x0, PTHREAD_SIZEOF;					\
+	ldr	w16, [x0, PTHREAD_MULTIPLE_THREADS_OFFSET];		\
+	ldp	x0, x30, [sp], 16;					\
+	cfi_restore (x0);						\
+	cfi_restore (x30);						\
+	cfi_adjust_cfa_offset (-16);					\
+	cmp	w16, 0;
 #  endif
 # endif
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]