about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2015-11-12 14:01:36 -0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2017-08-24 14:58:35 -0300
commitebd6f0076a83bb25a9853773fbfbcff00b4c9a32 (patch)
tree07b02599002f24fd7fa37e1ddfa332f6a236ec99 /sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h
parent8aa48656bb00074f3f422d805f15d07d786970ba (diff)
downloadglibc-ebd6f0076a83bb25a9853773fbfbcff00b4c9a32.tar.gz
glibc-ebd6f0076a83bb25a9853773fbfbcff00b4c9a32.tar.xz
glibc-ebd6f0076a83bb25a9853773fbfbcff00b4c9a32.zip
Remove cancellation support for syscall generation
This patch removes the cancellation mark from the auto-generation syscall
script.  Now all the cancellable syscalls are done throught C code using
the SYSCALL_CANCEL macro.  It simplifies the assembly required to each
architecture port, since the SYSCALL_CANCEL uses the already defined
INLINE_SYSCALL macros, and allows a more straigh fix on cancellation
machanism (since no more specific assembly fixes will be required).

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.A
Also with build-many-glibc.py with remaning touched architectures.

	* sysdeps/unix/make-syscalls.sh: Remove cancellable tagging for
	syscall definitions.
	* sysdeps/unix/syscall-template.S (SYSCALL_CANCELLABLE): Remove
	definition.
	* sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (__local_enable_asynccancel): Likewise.
	[IS_IN (libpthread)] (__local_disable_asynccancel): Likewise.
	[IS_IN (libc)] (__local_enable_asynccancel): Likewise.
	[IS_IN (libc)] (__local_enable_asynccancel): Likewise.
	[IS_IN (librt)] (__local_disable_asynccancel): Likewise.
	[IS_IN (librt)] (__local_disable_asynccancel): Likewise.
	(CENABLE): Likewise.
	(CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (PSEUDO): Remove
	defintion.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h (PSEUDO):
	Remove definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	(SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Remove file.
	* sysdeps/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: New file.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Remove file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: New file.
	* sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (PSEUDO): Remove
	definition.
	(PSEUDO_END): Likewise.
	[IS_IN (libpthread)] (CENABLE): Likewise.
	[IS_IN (libpthread)] (CDISABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (libc)] (CENABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[IS_IN (librt)] (CDISABLE): Likewise.
	[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h')
-rw-r--r--sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h117
1 files changed, 6 insertions, 111 deletions
diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h b/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h
index 47b92d99b6..73b623614d 100644
--- a/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h
+++ b/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h
@@ -18,124 +18,19 @@
 
 #include <sysdep.h>
 #include <tls.h>
-#ifndef __ASSEMBLER__
-# include <nptl/pthreadP.h>
-#endif
+#include <nptl/pthreadP.h>
 
 #if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt)
 
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args)				      \
-  .type __##syscall_name##_nocancel, @function;				      \
-  .globl __##syscall_name##_nocancel;					      \
-  __##syscall_name##_nocancel:						      \
-    cfi_startproc;                                                            \
-    DO_CALL (syscall_name, args);                                             \
-    bne r7, zero, SYSCALL_ERROR_LABEL;                                        \
-    ret;                                                                      \
-    cfi_endproc;                                                              \
-  .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	      \
-  ENTRY (name)								      \
-    SINGLE_THREAD_P(r2);						      \
-    bne r2, zero, pseudo_cancel;					      \
-    DO_CALL (syscall_name, args);					      \
-    bne r7, zero, SYSCALL_ERROR_LABEL;                                        \
-    ret;								      \
-  pseudo_cancel:							      \
-    SAVESTK_##args;                 /* save syscall args and adjust stack */  \
-    SAVEREG(ra, 0);                     /* save return address */             \
-    SAVEREG(r22, 4);                    /* save GOT pointer */                \
-    nextpc r22;                                                               \
-1:  movhi r2, %hiadj(_gp_got - 1b);					      \
-    addi r2, r2, %lo(_gp_got - 1b);					      \
-    add r22, r22, r2;                                                         \
-    CENABLE;                                                                  \
-    callr r3;                                                                 \
-    stw r2, 8(sp);                      /* save mask */                       \
-    LOADARGS_##args;                                                          \
-    movi r2, SYS_ify(syscall_name);                                           \
-    trap;                                                                     \
-    stw r2, 12(sp);                     /* save syscall result */             \
-    stw r7, 16(sp);                     /* save syscall error flag */         \
-    ldw r4, 8(sp);                      /* pass mask as argument 1 */         \
-    CDISABLE;                                                                 \
-    callr r3;                                                                 \
-    ldw r7, 16(sp);                     /* restore syscall error flag */      \
-    ldw r2, 12(sp);                     /* restore syscall result */          \
-    ldw ra, 0(sp);                      /* restore return address */          \
-    ldw r22, 4(sp);                     /* restore GOT pointer */             \
-    RESTORESTK_##args;                                                        \
-    bne r7, zero, SYSCALL_ERROR_LABEL;
-
-
-# undef PSEUDO_END
-# define PSEUDO_END(sym) \
-  SYSCALL_ERROR_HANDLER \
-  END (sym)
-
-#define SAVEREG(REG, LOC) stw REG, LOC(sp); cfi_rel_offset (REG, LOC)
-#define SAVESTK(X) subi sp, sp, X; cfi_adjust_cfa_offset(X)
-#define SAVESTK_0 SAVESTK(20)
-#define SAVEARG_1 SAVEREG(r4, 20)
-#define SAVESTK_1 SAVESTK(24); SAVEARG_1
-#define SAVEARG_2 SAVEREG(r5, 24); SAVEARG_1
-#define SAVESTK_2 SAVESTK(28); SAVEARG_2
-#define SAVEARG_3 SAVEREG(r6, 28); SAVEARG_2
-#define SAVESTK_3 SAVESTK(32); SAVEARG_3
-#define SAVEARG_4 SAVEREG(r7, 32); SAVEARG_3
-#define SAVESTK_4 SAVESTK(36); SAVEARG_4
-#define SAVESTK_5 SAVESTK_4
-#define SAVESTK_6 SAVESTK_5
-
-#define LOADARGS_0
-#define LOADARGS_1 ldw r4, 20(sp)
-#define LOADARGS_2 LOADARGS_1; ldw r5, 24(sp)
-#define LOADARGS_3 LOADARGS_2; ldw r6, 28(sp)
-#define LOADARGS_4 LOADARGS_3; ldw r7, 32(sp)
-#define LOADARGS_5 LOADARGS_4; ldw r8, 36(sp)
-#define LOADARGS_6 LOADARGS_5; ldw r9, 40(sp)
+# define SINGLE_THREAD_P						\
+  __glibc_likely (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0)
 
-#define RESTORESTK(X) addi sp, sp, X; cfi_adjust_cfa_offset(-X)
-#define RESTORESTK_0 RESTORESTK(20)
-#define RESTORESTK_1 RESTORESTK(24)
-#define RESTORESTK_2 RESTORESTK(28)
-#define RESTORESTK_3 RESTORESTK(32)
-#define RESTORESTK_4 RESTORESTK(36)
-#define RESTORESTK_5 RESTORESTK(36)
-#define RESTORESTK_6 RESTORESTK(36)
-
-# if IS_IN (libpthread)
-#  define CENABLE	ldw r3, %call(__pthread_enable_asynccancel)(r22)
-#  define CDISABLE	ldw r3, %call(__pthread_disable_asynccancel)(r22)
-# elif IS_IN (librt)
-#  define CENABLE	ldw r3, %call(__librt_enable_asynccancel)(r22)
-#  define CDISABLE	ldw r3, %call(__librt_disable_asynccancel)(r22)
-# elif IS_IN (libc)
-#  define CENABLE	ldw r3, %call(__libc_enable_asynccancel)(r22)
-#  define CDISABLE	ldw r3, %call(__libc_disable_asynccancel)(r22)
-# else
-#  error Unsupported library
-# endif
-
-# ifndef __ASSEMBLER__
-#  define SINGLE_THREAD_P						\
-	__builtin_expect (THREAD_GETMEM (THREAD_SELF,			\
-					 header.multiple_threads)	\
-			  == 0, 1)
-# else
-#  define SINGLE_THREAD_P(reg)						\
-	ldw reg, MULTIPLE_THREADS_OFFSET(r23)
-#endif
-
-#elif !defined __ASSEMBLER__
+#else
 
 # define SINGLE_THREAD_P 1
 # define NO_CANCELLATION 1
 
 #endif
 
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
-  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
-				   header.multiple_threads) == 0, 1)
-#endif
+#define RTLD_SINGLE_THREAD_P \
+  __glibc_likely (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0)