summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2017-07-20 20:30:28 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2017-07-28 18:56:40 +0200
commitc876d8a2cd0e7e1ac585abfbe0067a26cd7ea932 (patch)
treeadc420c827ef33b0e88fa6c5666c3cd639d0e0e8
parentdcbff4072b6b3e79d768e50c2d58ccc8e307b1bd (diff)
nptl: remove asm from sysdep-cancel.h
Similar to a changeset planned in GNU C library remove any assembly code from sysdep-cancel.h. This allows to port to new architectures in a simpler way.
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h87
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h131
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h96
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h212
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h121
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h111
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h120
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h156
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nds32/sysdep-cancel.h235
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h106
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/or1k/sysdep-cancel.h84
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h84
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h134
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h78
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h63
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/sysdep-cancel.h125
16 files changed, 52 insertions, 1891 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h
index 0942e819e..a6c98b6f8 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h
@@ -22,102 +22,23 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .section ".text"; \
-ENTRY (__##syscall_name##_nocancel); \
-.Lpseudo_nocancel: \
- DO_CALL (syscall_name, args); \
-.Lpseudo_finish: \
- cmn x0, 4095; \
- b.cs .Lsyscall_error; \
- .subsection 2; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
-ENTRY (name); \
- SINGLE_THREAD_P(16); \
- cbz w16, .Lpseudo_nocancel; \
- /* 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; /* save mask around syscall. */ \
- UNDOCARGS_##args; /* restore syscall args. */ \
- DO_CALL (syscall_name, args); \
- str x0, [sp, 8]; /* save result around CDISABLE. */ \
- mov x0, x16; /* restore mask for CDISABLE. */ \
- CDISABLE; \
- /* 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; \
- .size name, .-name; \
- .previous
-
-# undef PSEUDO_END
-# define PSEUDO_END(name) \
- SYSCALL_ERROR_HANDLER; \
- cfi_endproc
-
-# 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 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]
-
# if defined IS_IN_libpthread
-# define CENABLE bl __pthread_enable_asynccancel
-# define CDISABLE bl __pthread_disable_asynccancel
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE bl __libc_enable_asynccancel
-# define CDISABLE bl __libc_disable_asynccancel
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE bl __librt_enable_asynccancel
-# define CDISABLE bl __librt_disable_asynccancel
-# else
-# error Unsupported library
# endif
# if defined IS_IN_libpthread || !defined NOT_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(R) \
- adrp x##R, __local_multiple_threads; \
- ldr w##R, [x##R, :lo12:__local_multiple_threads]
-# endif
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
# else
/* There is no __local_multiple_threads for librt, so use the TCB. */
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P(R) \
- mrs x##R, tpidr_el0; \
- sub x##R, x##R, PTHREAD_SIZEOF; \
- ldr w##R, [x##R, PTHREAD_MULTIPLE_THREADS_OFFSET]
-# endif
# endif
-#elif !defined __ASSEMBLER__
+#else
/* For rtld, et cetera. */
# define SINGLE_THREAD_P 1
@@ -125,8 +46,6 @@ 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
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
index 51f1bd42a..4f60558bf 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h
@@ -23,143 +23,20 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# ifdef PROF
-# define PSEUDO_PROF \
- .set noat; \
- lda AT, _mcount; \
- jsr AT, (AT), _mcount; \
- .set at
-# else
-# define PSEUDO_PROF
-# endif
-
-/* ??? Assumes that nothing comes between PSEUDO and PSEUDO_END
- besides "ret". */
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .globl name; \
- .align 4; \
- .type name, @function; \
- .usepv name, std; \
- cfi_startproc; \
-__LABEL(name) \
- ldgp gp, 0(pv); \
- PSEUDO_PROF; \
- PSEUDO_PREPARE_ARGS \
- SINGLE_THREAD_P(t0); \
- bne t0, $pseudo_cancel; \
- lda v0, SYS_ify(syscall_name); \
- call_pal PAL_callsys; \
- bne a3, SYSCALL_ERROR_LABEL; \
-__LABEL($pseudo_ret) \
- .subsection 2; \
- cfi_startproc; \
-__LABEL($pseudo_cancel) \
- subq sp, 64, sp; \
- cfi_def_cfa_offset(64); \
- stq ra, 0(sp); \
- cfi_offset(ra, -64); \
- SAVE_ARGS_##args; \
- CENABLE; \
- LOAD_ARGS_##args; \
- /* Save the CENABLE return value in RA. That register \
- is preserved across syscall and the real return \
- address is saved on the stack. */ \
- mov v0, ra; \
- lda v0, SYS_ify(syscall_name); \
- call_pal PAL_callsys; \
- stq v0, 8(sp); \
- mov ra, a0; \
- bne a3, $multi_error; \
- CDISABLE; \
- ldq ra, 0(sp); \
- ldq v0, 8(sp); \
- addq sp, 64, sp; \
- cfi_remember_state; \
- cfi_restore(ra); \
- cfi_def_cfa_offset(0); \
- ret; \
- cfi_restore_state; \
-__LABEL($multi_error) \
- CDISABLE; \
- ldq ra, 0(sp); \
- ldq v0, 8(sp); \
- addq sp, 64, sp; \
- cfi_restore(ra); \
- cfi_def_cfa_offset(0); \
-__LABEL($syscall_error) \
- SYSCALL_ERROR_HANDLER; \
- cfi_endproc; \
- .previous
-
-# undef PSEUDO_END
-# define PSEUDO_END(sym) \
- cfi_endproc; \
- .subsection 2; \
- .size sym, .-sym
-
-# define SAVE_ARGS_0 /* Nothing. */
-# define SAVE_ARGS_1 SAVE_ARGS_0; stq a0, 8(sp)
-# define SAVE_ARGS_2 SAVE_ARGS_1; stq a1, 16(sp)
-# define SAVE_ARGS_3 SAVE_ARGS_2; stq a2, 24(sp)
-# define SAVE_ARGS_4 SAVE_ARGS_3; stq a3, 32(sp)
-# define SAVE_ARGS_5 SAVE_ARGS_4; stq a4, 40(sp)
-# define SAVE_ARGS_6 SAVE_ARGS_5; stq a5, 48(sp)
-
-# define LOAD_ARGS_0 /* Nothing. */
-# define LOAD_ARGS_1 LOAD_ARGS_0; ldq a0, 8(sp)
-# define LOAD_ARGS_2 LOAD_ARGS_1; ldq a1, 16(sp)
-# define LOAD_ARGS_3 LOAD_ARGS_2; ldq a2, 24(sp)
-# define LOAD_ARGS_4 LOAD_ARGS_3; ldq a3, 32(sp)
-# define LOAD_ARGS_5 LOAD_ARGS_4; ldq a4, 40(sp)
-# define LOAD_ARGS_6 LOAD_ARGS_5; ldq a5, 48(sp)
-
# ifdef IS_IN_libpthread
-# define __local_enable_asynccancel __pthread_enable_asynccancel
-# define __local_disable_asynccancel __pthread_disable_asynccancel
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define __local_enable_asynccancel __libc_enable_asynccancel
-# define __local_disable_asynccancel __libc_disable_asynccancel
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define __local_enable_asynccancel __librt_enable_asynccancel
-# define __local_disable_asynccancel __librt_disable_asynccancel
-# else
-# error Unsupported library
-# endif
-
-# ifdef __PIC__
-# define CENABLE bsr ra, __local_enable_asynccancel !samegp
-# define CDISABLE bsr ra, __local_disable_asynccancel !samegp
-# else
-# define CENABLE jsr ra, __local_enable_asynccancel; ldgp ra, 0(gp)
-# define CDISABLE jsr ra, __local_disable_asynccancel; ldgp ra, 0(gp)
# endif
# if defined IS_IN_libpthread || !defined NOT_IN_libc
-# ifndef __ASSEMBLER__
extern int __local_multiple_threads attribute_hidden;
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (__local_multiple_threads == 0, 1)
-# elif defined(__PIC__)
-# define SINGLE_THREAD_P(reg) ldl reg, __local_multiple_threads(gp) !gprel
-# else
-# define SINGLE_THREAD_P(reg) \
- ldah reg, __local_multiple_threads(gp) !gprelhigh; \
- ldl reg, __local_multiple_threads(reg) !gprellow
-# endif
# else
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P(reg) \
- call_pal PAL_rduniq; \
- ldl reg, MULTIPLE_THREADS_OFFSET($0)
-# endif
# endif
#else
@@ -169,8 +46,6 @@ extern int __local_multiple_threads attribute_hidden;
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h
index 01fd844d1..cfe55751f 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h
@@ -12,107 +12,13 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-#ifdef __ASSEMBLER__
-
-#undef ret
-#define ret
-
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, nargs) \
- /* vanilla version */ ` \
- ENTRY(name##_nocancel) ` \
- DO_CALL (__NR_##syscall_name) ` \
- jls [blink] ` \
- b __syscall_error@plt ` \
- END(name##_nocancel) ` \
- /* thread cancellation variant */ ` \
- ENTRY(name) ` \
- SINGLE_THREAD_P ` \
- bz name##_nocancel ` \
- DOCARGS_##nargs /* stash syscall args */ ` \
- CENABLE /* call enable_asynccancel */ ` \
- mov r9, r0 /* Safe-keep mask */ ` \
- UNDOCARGS_##nargs /* restore syscall args */ ` \
- DO_CALL (__NR_##syscall_name) ` \
- push r0 /* save syscall return value */ ` \
- mov r0, r9 /* prep mask for disable_asynccancel */ ` \
- CDISABLE ` \
- pop r0 /* get syscall ret value back */ ` \
- pop blink /* UNDOCARGS above left blink on stack */ ` \
- cmp r0, -1024 ` \
- jls [blink] ` \
- b __syscall_error@plt ` \
- END(name)
-
-#undef PSEUDO_END
-#define PSEUDO_END(name) \
-
# ifdef IS_IN_libpthread
-# define CENABLE bl __pthread_enable_asynccancel
-# define CDISABLE bl __pthread_disable_asynccancel
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE bl __libc_enable_asynccancel
-# define CDISABLE bl __libc_disable_asynccancel
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE bl __librt_enable_asynccancel
-# define CDISABLE bl __librt_disable_asynccancel
-# else
-# error Unsupported library
# endif
-#define DO_CALL(num) \
- mov r8, num ` \
- ARC_TRAP_INSN ` \
- cmp r0, -1024
-
-.macro push reg
- st.a \reg, [sp, -4]
-.endm
-
-.macro pop reg
- ld.ab \reg, [sp, 4]
-.endm
-
-#define DOCARGS_0 push blink
-
-/* don't pop blink at this point */
-#define UNDOCARGS_0 ld blink, [sp]
-
-#define DOCARGS_1 DOCARGS_0` push r0
-#define UNDOCARGS_1 pop r0` UNDOCARGS_0
-
-#define DOCARGS_2 DOCARGS_1` push r1
-#define UNDOCARGS_2 pop r1` UNDOCARGS_1
-
-#define DOCARGS_3 DOCARGS_2` push r2
-#define UNDOCARGS_3 pop r2` UNDOCARGS_2
-
-#define DOCARGS_4 DOCARGS_3` push r3
-#define UNDOCARGS_4 pop r3` UNDOCARGS_3
-
-#define DOCARGS_5 DOCARGS_4` push r4
-#define UNDOCARGS_5 pop r4` UNDOCARGS_4
-
-#define DOCARGS_6 DOCARGS_5` push r5
-#define UNDOCARGS_6 pop r5` UNDOCARGS_5
-
-#define DOCARGS_7 DOCARGS_6` push r6
-#define UNDOCARGS_7 pop r6` UNDOCARGS_6
-
-# define SINGLE_THREAD_P \
- THREAD_SELF r9 ` \
- ld r10, [r9, MULTIPLE_THREADS_OFFSET]` \
- cmp r10, 0
-
-/* ld r2, [r1, -TLS_PRE_TCB_SIZE + MULTIPLE_THREADS_OFFSET] */
-#else /* !__ASSEMBLER__ */
-
-/* TBD: Can use @__local_multiple_threads for libc/libpthread like ARM */
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
likely(THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0)
-#endif /* __ASSEMBLER__ */
-
#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
index 6f683ab72..ab2a2de52 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -23,222 +22,23 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined 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) \
- .section ".text"; \
- PSEUDO_PROLOGUE; \
- .type __##syscall_name##_nocancel,%function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- cfi_sections(.debug_frame); \
- cfi_startproc; \
- DO_CALL (syscall_name, args); \
- PSEUDO_RET; \
- cfi_endproc; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- ENTRY (name); \
- SINGLE_THREAD_P; \
- DOARGS_##args; \
- bne .Lpseudo_cancel; \
- cfi_remember_state; \
- DO_CALL (syscall_name, 0); \
- UNDOARGS_##args; \
- cmn r0, $4096; \
- PSEUDO_RET; \
- cfi_restore_state; \
- .Lpseudo_cancel: \
- .fnstart; \
- 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. */ \
- .fnend; /* Past here we can't easily unwind. */ \
- 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 four bytes on the stack for five arguments, eight bytes for
- six arguments, and nothing for fewer. In order to preserve doubleword
- alignment, sometimes we must save an extra register. */
-
-# define RESTART_UNWIND \
- .fnend; \
- .fnstart; \
- .save {r7, lr}
-
-# define DOCARGS_0 \
- stmfd sp!, {r7, lr}; \
- cfi_adjust_cfa_offset (8); \
- cfi_rel_offset (r7, 0); \
- cfi_rel_offset (lr, 4); \
- .save {r7, lr}
-# define UNDOCARGS_0
-# define RESTORE_LR_0 \
- ldmfd sp!, {r7, lr}; \
- cfi_adjust_cfa_offset (-8); \
- cfi_restore (r7); \
- cfi_restore (lr)
-
-# define DOCARGS_1 \
- stmfd sp!, {r0, r1, r7, lr}; \
- cfi_adjust_cfa_offset (16); \
- cfi_rel_offset (r7, 8); \
- cfi_rel_offset (lr, 12); \
- .save {r7, 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 \
- stmfd sp!, {r0, r1, r7, lr}; \
- cfi_adjust_cfa_offset (16); \
- cfi_rel_offset (r7, 8); \
- cfi_rel_offset (lr, 12); \
- .save {r7, lr}; \
- .pad #8
-# define UNDOCARGS_2 \
- ldmfd sp!, {r0, r1}; \
- cfi_adjust_cfa_offset (-8); \
- RESTART_UNWIND
-# define RESTORE_LR_2 \
- RESTORE_LR_0
-
-# define DOCARGS_3 \
- stmfd sp!, {r0, r1, r2, r3, r7, lr}; \
- cfi_adjust_cfa_offset (24); \
- cfi_rel_offset (r7, 16); \
- cfi_rel_offset (lr, 20); \
- .save {r7, lr}; \
- .pad #16
-# define UNDOCARGS_3 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- RESTART_UNWIND
-# define RESTORE_LR_3 \
- RESTORE_LR_0
-
-# define DOCARGS_4 \
- stmfd sp!, {r0, r1, r2, r3, r7, lr}; \
- cfi_adjust_cfa_offset (24); \
- cfi_rel_offset (r7, 16); \
- cfi_rel_offset (lr, 20); \
- .save {r7, lr}; \
- .pad #16
-# define UNDOCARGS_4 \
- ldmfd sp!, {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}; \
- stmfd sp!, {r0, r1, r2, r3, r4, r7, lr}; \
- cfi_adjust_cfa_offset (28); \
- cfi_rel_offset (r7, 20); \
- cfi_rel_offset (lr, 24); \
- .save {r7, lr}; \
- .pad #20
-# define UNDOCARGS_5 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- .fnend; \
- .fnstart; \
- .save {r4}; \
- .save {r7, lr}; \
- .pad #4
-# define RESTORE_LR_5 \
- ldmfd sp!, {r4, r7, lr}; \
- cfi_adjust_cfa_offset (-12); \
- /* r4 will be marked as restored later. */ \
- cfi_restore (r7); \
- cfi_restore (lr)
-
-# define DOCARGS_6 \
- .save {r4, r5}; \
- stmfd sp!, {r0, r1, r2, r3, r7, lr}; \
- cfi_adjust_cfa_offset (24); \
- cfi_rel_offset (r7, 16); \
- cfi_rel_offset (lr, 20); \
- .save {r7, lr}; \
- .pad #16
-# define UNDOCARGS_6 \
- ldmfd sp!, {r0, r1, r2, r3}; \
- cfi_adjust_cfa_offset (-16); \
- .fnend; \
- .fnstart; \
- .save {r4, r5}; \
- .save {r7, lr}
-# define RESTORE_LR_6 \
- RESTORE_LR_0
-
# ifdef 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 !defined NOT_IN_libc
-# define CENABLE bl PLTJMP(__libc_enable_asynccancel)
-# define CDISABLE bl PLTJMP(__libc_disable_asynccancel)
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE bl PLTJMP(__librt_enable_asynccancel)
-# define CDISABLE bl PLTJMP(__librt_disable_asynccancel)
-# else
-# error Unsupported library
# endif
# if defined IS_IN_libpthread || !defined NOT_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 \
- ldr ip, 1b; \
-2: \
- ldr ip, [pc, ip]; \
- teq ip, #0;
-# define PSEUDO_PROLOGUE \
- 1: .word __local_multiple_threads - 2f - 8;
-# endif
+# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
# else
/* There is no __local_multiple_threads for librt, so use the TCB. */
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define PSEUDO_PROLOGUE
-# define SINGLE_THREAD_P \
- stmfd sp!, {r0, lr}; \
- cfi_adjust_cfa_offset (8); \
- cfi_rel_offset (lr, 4); \
- bl __aeabi_read_tp; \
- ldr ip, [r0, #MULTIPLE_THREADS_OFFSET]; \
- ldmfd sp!, {r0, lr}; \
- cfi_adjust_cfa_offset (-8); \
- cfi_restore (lr); \
- teq ip, #0
-# define SINGLE_THREAD_P_PIC(x) SINGLE_THREAD_P
-# endif
# endif
-#elif !defined __ASSEMBLER__
+#else
/* For rtld, et cetera. */
# define SINGLE_THREAD_P 1
@@ -246,8 +46,6 @@ extern int __local_multiple_threads attribute_hidden;
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
index b0eb02600..ba88c55e2 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
@@ -1,5 +1,4 @@
/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,131 +23,17 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- cmpl $0, %gs:MULTIPLE_THREADS_OFFSET; \
- jne L(pseudo_cancel); \
- .type __##syscall_name##_nocancel,@function; \
- .globl __##syscall_name##_nocancel; \
- __##syscall_name##_nocancel: \
- DO_CALL (syscall_name, args); \
- cmpl $-4095, %eax; \
- jae SYSCALL_ERROR_LABEL; \
- ret; \
- .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
- L(pseudo_cancel): \
- CENABLE \
- SAVE_OLDTYPE_##args \
- PUSHCARGS_##args \
- DOCARGS_##args \
- movl $SYS_ify (syscall_name), %eax; \
- ENTER_KERNEL; \
- POPCARGS_##args; \
- POPSTATE_##args \
- cmpl $-4095, %eax; \
- jae SYSCALL_ERROR_LABEL; \
- L(pseudo_end):
-
-# define SAVE_OLDTYPE_0 movl %eax, %ecx;
-# define SAVE_OLDTYPE_1 SAVE_OLDTYPE_0
-# define SAVE_OLDTYPE_2 pushl %eax; cfi_adjust_cfa_offset (4);
-# define SAVE_OLDTYPE_3 SAVE_OLDTYPE_2
-# define SAVE_OLDTYPE_4 SAVE_OLDTYPE_2
-# define SAVE_OLDTYPE_5 SAVE_OLDTYPE_2
-# define SAVE_OLDTYPE_6 SAVE_OLDTYPE_2
-
-# define PUSHCARGS_0 /* No arguments to push. */
-# define DOCARGS_0 /* No arguments to frob. */
-# define POPCARGS_0 /* No arguments to pop. */
-# define _PUSHCARGS_0 /* No arguments to push. */
-# define _POPCARGS_0 /* No arguments to pop. */
-
-# define PUSHCARGS_1 movl %ebx, %edx; cfi_register (ebx, edx); PUSHCARGS_0
-# define DOCARGS_1 _DOARGS_1 (4)
-# define POPCARGS_1 POPCARGS_0; movl %edx, %ebx; cfi_restore (ebx);
-# define _PUSHCARGS_1 pushl %ebx; cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (ebx, 0); _PUSHCARGS_0
-# define _POPCARGS_1 _POPCARGS_0; popl %ebx; \
- cfi_adjust_cfa_offset (-4); cfi_restore (ebx);
-
-# define PUSHCARGS_2 PUSHCARGS_1
-# define DOCARGS_2 _DOARGS_2 (12)
-# define POPCARGS_2 POPCARGS_1
-# define _PUSHCARGS_2 _PUSHCARGS_1
-# define _POPCARGS_2 _POPCARGS_1
-
-# define PUSHCARGS_3 _PUSHCARGS_2
-# define DOCARGS_3 _DOARGS_3 (20)
-# define POPCARGS_3 _POPCARGS_3
-# define _PUSHCARGS_3 _PUSHCARGS_2
-# define _POPCARGS_3 _POPCARGS_2
-
-# define PUSHCARGS_4 _PUSHCARGS_4
-# define DOCARGS_4 _DOARGS_4 (28)
-# define POPCARGS_4 _POPCARGS_4
-# define _PUSHCARGS_4 pushl %esi; cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (esi, 0); _PUSHCARGS_3
-# define _POPCARGS_4 _POPCARGS_3; popl %esi; \
- cfi_adjust_cfa_offset (-4); cfi_restore (esi);
-
-# define PUSHCARGS_5 _PUSHCARGS_5
-# define DOCARGS_5 _DOARGS_5 (36)
-# define POPCARGS_5 _POPCARGS_5
-# define _PUSHCARGS_5 pushl %edi; cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (edi, 0); _PUSHCARGS_4
-# define _POPCARGS_5 _POPCARGS_4; popl %edi; \
- cfi_adjust_cfa_offset (-4); cfi_restore (edi);
-
-# define PUSHCARGS_6 _PUSHCARGS_6
-# define DOCARGS_6 _DOARGS_6 (44)
-# define POPCARGS_6 _POPCARGS_6
-# define _PUSHCARGS_6 pushl %ebp; cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (ebp, 0); _PUSHCARGS_5
-# define _POPCARGS_6 _POPCARGS_5; popl %ebp; \
- cfi_adjust_cfa_offset (-4); cfi_restore (ebp);
-
-# ifdef IS_IN_libpthread
-# define CENABLE call __pthread_enable_asynccancel;
-# define CDISABLE call __pthread_disable_asynccancel
-# elif !defined NOT_IN_libc
-# define CENABLE call __libc_enable_asynccancel;
-# define CDISABLE call __libc_disable_asynccancel
-# elif defined IS_IN_librt
-# define CENABLE call __librt_enable_asynccancel;
-# define CDISABLE call __librt_disable_asynccancel
-# else
-# error Unsupported library
-# endif
-# define POPSTATE_0 \
- pushl %eax; cfi_adjust_cfa_offset (4); movl %ecx, %eax; \
- CDISABLE; popl %eax; cfi_adjust_cfa_offset (-4);
-# define POPSTATE_1 POPSTATE_0
-# define POPSTATE_2 xchgl (%esp), %eax; CDISABLE; popl %eax; \
- cfi_adjust_cfa_offset (-4);
-# define POPSTATE_3 POPSTATE_2
-# define POPSTATE_4 POPSTATE_3
-# define POPSTATE_5 POPSTATE_4
-# define POPSTATE_6 POPSTATE_5
-
-# ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-# else
-# define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
-# endif
-#elif !defined __ASSEMBLER__
+#else
# define SINGLE_THREAD_P (1)
# define NO_CANCELLATION 1
#endif
-#ifndef __ASSEMBLER__
-# define RTLD_SINGLE_THREAD_P \
+#define RTLD_SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h
index c44b1039d..72823c0f2 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/sysdep-cancel.h
@@ -1,5 +1,4 @@
/* Copyright (C) 2003, 2004, 2005, 2009 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
@@ -23,120 +22,16 @@
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined 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. */
-
-#ifdef __ASSEMBLER__
-#undef ret
-#define ret \
- CMP D0Re0, #-4095; \
- MOVLO PC, D1RtP; \
- MOV D1Ar1, D0Re0; \
- B SYSCALL_ERROR;
-#endif /* __ASSEMBLER__ */
-
-# 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); \
- MOV PC, D1RtP; \
- cfi_endproc; \
- .size ___##syscall_name##_nocancel,.-___##syscall_name##_nocancel; \
- .globl _##name; \
- .type _##name, @function; \
-name##: \
-_##name##: \
- DOCARGS_##args; \
- SINGLE_THREAD_P; \
- UNDOCARGS_##args; \
- BNE .Lpseudo_cancel; \
- cfi_remember_state; \
- DO_CALL (syscall_name, 0); \
- ret \
- cfi_restore_state; \
- .Lpseudo_cancel: \
- MSETL [A0StP++], D0FrT, D0.5; \
- DOCARGS_##args; /* save syscall args etc. around CENABLE. */ \
- CENABLE; \
- MOV D0FrT, D0Re0; /* put mask in safe place. */ \
- UNDOCARGS_##args; /* restore syscall args. */ \
- DO_CALL(syscall_name, 0); /* do the call. */ \
- MOV D0.5, D0Re0; /* save syscall return value. */ \
- MOV D1Ar1, D0FrT; /* get mask back. */ \
- CDISABLE; \
- MOV D0Re0, D0.5; /* retrieve return value. */ \
- GETL D0.5, D1.5, [--A0StP]; \
- GETL D0FrT, D1RtP, [--A0StP];
-
-# define DOCARGS_0
-# define UNDOCARGS_0
-
-# define DOCARGS_1 \
- SETL [A0StP++], D1Ar1, D0Ar2
-# define UNDOCARGS_1 \
- GETL D1Ar1, D0Ar2, [--A0StP]
-
-# define DOCARGS_2 DOCARGS_1
-
-# define UNDOCARGS_2 UNDOCARGS_2
-
-# define DOCARGS_3 \
- MSETL [A0StP++], D1Ar1, D1Ar3
-
-# define UNDOCARGS_3 \
- GETL D1Ar1, D0Ar2, [--A0StP]; \
- GETL D1Ar3, D0Ar4, [--A0StP]
-
-# define DOCARGS_4 DOCARGS_3
-# define UNDOCARGS_4 UNDOCARGS_3
-
-# define DOCARGS_5 \
- MSETL [A0StP++], D1Ar1, D1Ar3, D1Ar5
-# define UNDOCARGS_5 \
- GETL D1Ar1, D0Ar2, [--A0StP]; \
- GETL D1Ar3, D0Ar4, [--A0StP]; \
- GETL D1Ar5, D0Ar6, [--A0StP]
-
-# define DOCARGS_6 DOCARGS_5
-# define UNDOCARGS_6 UNDOCARGS_5
-
# ifdef IS_IN_libpthread
-# define CENABLE CALLR D1RtP, ___pthread_enable_asynccancel@PLT
-# define CDISABLE CALLR D1RtP, ___pthread_disable_asynccancel@PLT
# define __local_multiple_threads __pthread_multiple_threads
# elif !defined NOT_IN_libc
-# define CENABLE CALLR D1RtP, ___libc_enable_asynccancel@PLT
-# define CDISABLE CALLR D1RtP, ___libc_disable_asynccancel@PLT
# define __local_multiple_threads __libc_multiple_threads
-# elif defined IS_IN_librt
-# define CENABLE CALLR D1RtP, ___librt_enable_asynccancel@PLT
-# define CDISABLE CALLR D1RtP, ___librt_disable_asynccancel@PLT
-# else
-# error Unsupported library
# endif
-#ifndef __ASSEMBLER__
-# define SINGLE_THREAD_P \
+#define SINGLE_THREAD_P \
likely(THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0)
#else
-# define SINGLE_THREAD_P \
- SETL [A0StP++], D0FrT, D1RtP; \
- CALLR D1RtP, ___metag_load_tp@PLT; \
- SUB D0Re0, D0Re0, #TLS_PRE_TCB_SIZE; \
- GETD D0Re0, [D0Re0 + #MULTIPLE_THREADS_OFFSET]; \
- CMP D0Re0, #0; \
- GETL D0FrT, D1RtP, [--A0StP]
-#endif
-