From ebd6f0076a83bb25a9853773fbfbcff00b4c9a32 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Thu, 12 Nov 2015 14:01:36 -0200 Subject: 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. --- sysdeps/unix/sysv/linux/arm/sysdep-cancel.h | 207 +--------------------------- 1 file changed, 7 insertions(+), 200 deletions(-) (limited to 'sysdeps/unix/sysv/linux/arm') diff --git a/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h b/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h index de12acf046..8930245ff3 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h @@ -17,216 +17,26 @@ #include #include -#ifndef __ASSEMBLER__ -# include -#endif +#include #if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt) -/* NOTE: We do mark syscalls with unwind annotations, for the benefit of - cancellation; but they're really only accurate at the point of the - syscall. The ARM unwind directives are not rich enough without adding - a custom personality function. */ - -# undef PSEUDO -# define PSEUDO(name, syscall_name, args) \ - .text; \ - ENTRY (__##syscall_name##_nocancel); \ - CFI_SECTIONS; \ - DO_CALL (syscall_name, args); \ - cmn r0, $4096; \ - PSEUDO_RET; \ - END (__##syscall_name##_nocancel); \ - ENTRY (name); \ - SINGLE_THREAD_P; \ - DOARGS_##args; \ - bne .Lpseudo_cancel; \ - cfi_remember_state; \ - ldr r7, =SYS_ify (syscall_name); \ - swi 0x0; \ - UNDOARGS_##args; \ - cmn r0, $4096; \ - PSEUDO_RET; \ - cfi_restore_state; \ - .Lpseudo_cancel: \ - .fnstart; /* matched by the .fnend in UNDOARGS below. */ \ - DOCARGS_##args; /* save syscall args etc. around CENABLE. */ \ - CENABLE; \ - mov ip, r0; /* put mask in safe place. */ \ - UNDOCARGS_##args; /* restore syscall args. */ \ - ldr r7, =SYS_ify (syscall_name); \ - swi 0x0; /* do the call. */ \ - mov r7, r0; /* save syscall return value. */ \ - mov r0, ip; /* get mask back. */ \ - CDISABLE; \ - mov r0, r7; /* retrieve return value. */ \ - RESTORE_LR_##args; \ - UNDOARGS_##args; \ - cmn r0, $4096 - -/* DOARGS pushes eight bytes on the stack for five arguments, twelve bytes for - six arguments, and four bytes for fewer. In order to preserve doubleword - alignment, sometimes we must save an extra register. */ - -# define RESTART_UNWIND \ - .fnend; \ - .fnstart; \ - .save {r7}; \ - .save {lr} - -# define DOCARGS_0 \ - .save {r7}; \ - push {lr}; \ - cfi_adjust_cfa_offset (4); \ - cfi_rel_offset (lr, 0); \ - .save {lr} -# define UNDOCARGS_0 -# define RESTORE_LR_0 \ - pop {lr}; \ - cfi_adjust_cfa_offset (-4); \ - cfi_restore (lr) - -# define DOCARGS_1 \ - .save {r7}; \ - push {r0, r1, lr}; \ - cfi_adjust_cfa_offset (12); \ - cfi_rel_offset (lr, 8); \ - .save {lr}; \ - .pad #8 -# define UNDOCARGS_1 \ - ldr r0, [sp], #8; \ - cfi_adjust_cfa_offset (-8); \ - RESTART_UNWIND -# define RESTORE_LR_1 \ - RESTORE_LR_0 - -# define DOCARGS_2 \ - .save {r7}; \ - push {r0, r1, lr}; \ - cfi_adjust_cfa_offset (12); \ - cfi_rel_offset (lr, 8); \ - .save {lr}; \ - .pad #8 -# define UNDOCARGS_2 \ - pop {r0, r1}; \ - cfi_adjust_cfa_offset (-8); \ - RESTART_UNWIND -# define RESTORE_LR_2 \ - RESTORE_LR_0 - -# define DOCARGS_3 \ - .save {r7}; \ - push {r0, r1, r2, r3, lr}; \ - cfi_adjust_cfa_offset (20); \ - cfi_rel_offset (lr, 16); \ - .save {lr}; \ - .pad #16 -# define UNDOCARGS_3 \ - pop {r0, r1, r2, r3}; \ - cfi_adjust_cfa_offset (-16); \ - RESTART_UNWIND -# define RESTORE_LR_3 \ - RESTORE_LR_0 - -# define DOCARGS_4 \ - .save {r7}; \ - push {r0, r1, r2, r3, lr}; \ - cfi_adjust_cfa_offset (20); \ - cfi_rel_offset (lr, 16); \ - .save {lr}; \ - .pad #16 -# define UNDOCARGS_4 \ - pop {r0, r1, r2, r3}; \ - cfi_adjust_cfa_offset (-16); \ - RESTART_UNWIND -# define RESTORE_LR_4 \ - RESTORE_LR_0 - -/* r4 is only stmfd'ed for correct stack alignment. */ -# define DOCARGS_5 \ - .save {r4, r7}; \ - push {r0, r1, r2, r3, r4, lr}; \ - cfi_adjust_cfa_offset (24); \ - cfi_rel_offset (lr, 20); \ - .save {lr}; \ - .pad #20 -# define UNDOCARGS_5 \ - pop {r0, r1, r2, r3}; \ - cfi_adjust_cfa_offset (-16); \ - .fnend; \ - .fnstart; \ - .save {r4, r7}; \ - .save {lr}; \ - .pad #4 -# define RESTORE_LR_5 \ - pop {r4, lr}; \ - cfi_adjust_cfa_offset (-8); \ - /* r4 will be marked as restored later. */ \ - cfi_restore (lr) - -# define DOCARGS_6 \ - .save {r4, r5, r7}; \ - push {r0, r1, r2, r3, lr}; \ - cfi_adjust_cfa_offset (20); \ - cfi_rel_offset (lr, 16); \ - .save {lr}; \ - .pad #16 -# define UNDOCARGS_6 \ - pop {r0, r1, r2, r3}; \ - cfi_adjust_cfa_offset (-16); \ - .fnend; \ - .fnstart; \ - .save {r4, r5, r7}; \ - .save {lr}; -# define RESTORE_LR_6 \ - RESTORE_LR_0 - # if IS_IN (libpthread) -# define CENABLE bl PLTJMP(__pthread_enable_asynccancel) -# define CDISABLE bl PLTJMP(__pthread_disable_asynccancel) # define __local_multiple_threads __pthread_multiple_threads # elif IS_IN (libc) -# define CENABLE bl PLTJMP(__libc_enable_asynccancel) -# define CDISABLE bl PLTJMP(__libc_disable_asynccancel) # define __local_multiple_threads __libc_multiple_threads -# elif IS_IN (librt) -# define CENABLE bl PLTJMP(__librt_enable_asynccancel) -# define CDISABLE bl PLTJMP(__librt_disable_asynccancel) -# else -# error Unsupported library # endif # if IS_IN (libpthread) || IS_IN (libc) -# ifndef __ASSEMBLER__ extern int __local_multiple_threads attribute_hidden; -# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) -# else -# define SINGLE_THREAD_P \ - LDST_PCREL(ldr, ip, ip, __local_multiple_threads); \ - teq ip, #0 -# endif +# define SINGLE_THREAD_P __glibc_likely (__local_multiple_threads == 0) # else /* There is no __local_multiple_threads for librt, so use the TCB. */ -# ifndef __ASSEMBLER__ -# define SINGLE_THREAD_P \ - __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0, 1) -# else -# define SINGLE_THREAD_P \ - push {r0, lr}; \ - cfi_adjust_cfa_offset (8); \ - cfi_rel_offset (lr, 4); \ - GET_TLS (lr); \ - NEGOFF_ADJ_BASE (r0, MULTIPLE_THREADS_OFFSET); \ - ldr ip, NEGOFF_OFF1 (r0, MULTIPLE_THREADS_OFFSET); \ - pop {r0, lr}; \ - cfi_adjust_cfa_offset (-8); \ - cfi_restore (lr); \ - teq ip, #0 -# endif +# define SINGLE_THREAD_P \ + __glibc_likely (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0) # endif -#elif !defined __ASSEMBLER__ +#else /* For rtld, et cetera. */ # define SINGLE_THREAD_P 1 @@ -234,8 +44,5 @@ extern int __local_multiple_threads attribute_hidden; #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) -- cgit 1.4.1