* elf/dl-lookup.c (_dl_debug_bindings): Remove unised symbol_scope
[glibc.git] / nptl / sysdeps / unix / sysv / linux / s390 / s390-32 / sysdep-cancel.h
blobeb3b14a3116e4536d6f1d9f5b16eaaf963072861
1 /* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #include <sysdep.h>
21 #include <tls.h>
22 #ifndef __ASSEMBLER__
23 # include <nptl/pthreadP.h>
24 #endif
26 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
28 # undef PSEUDO
29 # define PSEUDO(name, syscall_name, args) \
30 .text; \
31 L(pseudo_cancel): \
32 cfi_startproc; \
33 STM_##args \
34 stm %r12,%r15,48(%r15); \
35 cfi_offset (%r15, -36); \
36 cfi_offset (%r14, -40); \
37 cfi_offset (%r13, -44); \
38 cfi_offset (%r12, -48); \
39 lr %r14,%r15; \
40 ahi %r15,-96; \
41 cfi_adjust_cfa_offset (96); \
42 st %r14,0(%r15); \
43 basr %r13,0; \
44 0: l %r1,1f-0b(%r13); \
45 bas %r14,0(%r1,%r13); \
46 lr %r0,%r2; \
47 LM_##args \
48 DO_CALL(syscall_name, args); \
49 l %r1,2f-0b(%r13); \
50 lr %r12,%r2; \
51 lr %r2,%r0; \
52 bas %r14,0(%r1,%r13); \
53 lr %r2,%r12; \
54 lm %r12,%r15,48+96(%r15); \
55 cfi_endproc; \
56 j L(pseudo_check); \
57 1: .long CENABLE-0b; \
58 2: .long CDISABLE-0b; \
59 ENTRY(name) \
60 SINGLE_THREAD_P(%r1) \
61 jne L(pseudo_cancel); \
62 .type __##syscall_name##_nocancel,@function; \
63 .globl __##syscall_name##_nocancel; \
64 __##syscall_name##_nocancel: \
65 DO_CALL(syscall_name, args); \
66 L(pseudo_check): \
67 lhi %r4,-4095; \
68 clr %r2,%r4; \
69 jnl SYSCALL_ERROR_LABEL; \
70 .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
71 L(pseudo_end):
73 # ifdef IS_IN_libpthread
74 # define CENABLE __pthread_enable_asynccancel
75 # define CDISABLE __pthread_disable_asynccancel
76 # elif !defined NOT_IN_libc
77 # define CENABLE __libc_enable_asynccancel
78 # define CDISABLE __libc_disable_asynccancel
79 # elif defined IS_IN_librt
80 # define CENABLE __librt_enable_asynccancel
81 # define CDISABLE __librt_disable_asynccancel
82 # else
83 # error Unsupported library
84 # endif
86 #define STM_0 /* Nothing */
87 #define STM_1 st %r2,8(%r15);
88 #define STM_2 stm %r2,%r3,8(%r15);
89 #define STM_3 stm %r2,%r4,8(%r15);
90 #define STM_4 stm %r2,%r5,8(%r15);
91 #define STM_5 stm %r2,%r5,8(%r15);
93 #define LM_0 /* Nothing */
94 #define LM_1 l %r2,8+96(%r15);
95 #define LM_2 lm %r2,%r3,8+96(%r15);
96 #define LM_3 lm %r2,%r4,8+96(%r15);
97 #define LM_4 lm %r2,%r5,8+96(%r15);
98 #define LM_5 lm %r2,%r5,8+96(%r15);
100 # ifndef __ASSEMBLER__
101 # define SINGLE_THREAD_P \
102 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
103 header.multiple_threads) == 0, 1)
104 # else
105 # define SINGLE_THREAD_P(reg) \
106 ear reg,%a0; \
107 icm reg,15,MULTIPLE_THREADS_OFFSET(reg);
108 # endif
110 #elif !defined __ASSEMBLER__
112 # ifdef IS_IN_rtld
113 # define SINGLE_THREAD_P \
114 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
115 header.multiple_threads) == 0, 1)
116 # else
117 # define SINGLE_THREAD_P (1)
118 # endif
119 # define NO_CANCELLATION 1
121 #endif