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, see
17 <http://www.gnu.org/licenses/>. */
22 # include <nptl/pthreadP.h>
25 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
28 # define PSEUDO(name, syscall_name, args) \
33 stmg %r13,%r15,104(%r15); \
34 cfi_offset (%r15,-40); \
35 cfi_offset (%r14,-48); \
36 cfi_offset (%r13,-56); \
39 cfi_adjust_cfa_offset (160); \
44 .if SYS_ify (syscall_name) < 256; \
45 svc SYS_ify (syscall_name); \
47 lghi %r1,SYS_ify (syscall_name); \
53 brasl %r14,CDISABLE; \
55 lmg %r13,%r15,104+160(%r15); \
60 jne L(pseudo_cancel); \
61 .type __##syscall_name##_nocancel,@function; \
62 .globl __##syscall_name##_nocancel; \
63 __##syscall_name##_nocancel: \
64 DO_CALL(syscall_name, args); \
68 jgnl SYSCALL_ERROR_LABEL; \
69 .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
72 # ifdef IS_IN_libpthread
73 # define CENABLE __pthread_enable_asynccancel
74 # define CDISABLE __pthread_disable_asynccancel
75 # define __local_multiple_threads __pthread_multiple_threads
76 # elif !defined NOT_IN_libc
77 # define CENABLE __libc_enable_asynccancel
78 # define CDISABLE __libc_disable_asynccancel
79 # define __local_multiple_threads __libc_multiple_threads
80 # elif defined IS_IN_librt
81 # define CENABLE __librt_enable_asynccancel
82 # define CDISABLE __librt_disable_asynccancel
84 # error Unsupported library
87 #define STM_0 /* Nothing */
88 #define STM_1 stg %r2,16(%r15);
89 #define STM_2 stmg %r2,%r3,16(%r15);
90 #define STM_3 stmg %r2,%r4,16(%r15);
91 #define STM_4 stmg %r2,%r5,16(%r15);
92 #define STM_5 stmg %r2,%r5,16(%r15);
93 #define STM_6 stmg %r2,%r7,16(%r15);
95 #define LM_0 /* Nothing */
96 #define LM_1 lg %r2,16+160(%r15);
97 #define LM_2 lmg %r2,%r3,16+160(%r15);
98 #define LM_3 lmg %r2,%r4,16+160(%r15);
99 #define LM_4 lmg %r2,%r5,16+160(%r15);
100 #define LM_5 lmg %r2,%r5,16+160(%r15);
101 #define LM_6 lmg %r2,%r5,16+160(%r15); \
102 cfi_offset (%r7, -104); \
103 lg %r7,160+160(%r15);
105 #define LR7_0 /* Nothing */
106 #define LR7_1 /* Nothing */
107 #define LR7_2 /* Nothing */
108 #define LR7_3 /* Nothing */
109 #define LR7_4 /* Nothing */
110 #define LR7_5 /* Nothing */
111 #define LR7_6 lg %r7,56+160(%r15); \
114 # if defined IS_IN_libpthread || !defined NOT_IN_libc
115 # ifndef __ASSEMBLER__
116 extern int __local_multiple_threads attribute_hidden
;
117 # define SINGLE_THREAD_P \
118 __builtin_expect (__local_multiple_threads == 0, 1)
120 # define SINGLE_THREAD_P \
121 larl %r1,__local_multiple_threads; \
127 # ifndef __ASSEMBLER__
128 # define SINGLE_THREAD_P \
129 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
130 header.multiple_threads) == 0, 1)
132 # define SINGLE_THREAD_P \
136 icm %r1,15,MULTIPLE_THREADS_OFFSET(%r1);
141 #elif !defined __ASSEMBLER__
143 # define SINGLE_THREAD_P (1)
144 # define NO_CANCELLATION 1
148 #ifndef __ASSEMBLER__
149 # define RTLD_SINGLE_THREAD_P \
150 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
151 header.multiple_threads) == 0, 1)