1 /* Copyright (C) 2002, 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>, 2002.
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
23 # include <nptl/pthreadP.h>
26 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
32 # define SYSDEP_CANCEL_ERRNO __libc_errno
34 # define SYSDEP_CANCEL_ERRNO errno
36 # define SYSDEP_CANCEL_ERROR(args) \
37 .section .gnu.linkonce.t.__syscall_error_##args, "ax"; \
39 .proc __syscall_error_##args; \
40 .global __syscall_error_##args; \
41 .hidden __syscall_error_##args; \
42 .size __syscall_error_##args, 64; \
43 __syscall_error_##args: \
45 .regstk args, 5, args, 0; \
49 addl loc4 = @ltoff(@tprel(SYSDEP_CANCEL_ERRNO)), gp;; \
53 add loc4 = loc4, r13;; \
57 # define SYSDEP_CANCEL_ERROR(args) \
58 .section .gnu.linkonce.t.__syscall_error_##args, "ax"; \
60 .proc __syscall_error_##args; \
61 .global __syscall_error_##args; \
62 .hidden __syscall_error_##args; \
63 .size __syscall_error_##args, 64; \
64 __syscall_error_##args: \
66 .regstk args, 5, args, 0; \
71 br.call.sptk.many b0 = __errno_location;; \
79 # ifndef USE_DL_SYSINFO
81 # define PSEUDO(name, syscall_name, args) \
84 adds r14 = MULTIPLE_THREADS_OFFSET, r13;; \
86 mov r15 = SYS_ify(syscall_name);; \
87 cmp4.ne p6, p7 = 0, r14; \
88 (p6) br.cond.spnt .Lpseudo_cancel;; \
89 break __BREAK_SYSCALL;; \
90 cmp.eq p6,p0=-1,r10; \
91 (p6) br.cond.spnt.few __syscall_error; \
96 .hidden __GC_##name; \
100 .regstk args, 5, args, 0; \
101 .save ar.pfs, loc0; \
102 alloc loc0 = ar.pfs, args, 5, args, 0; \
109 mov r15 = SYS_ify(syscall_name); \
110 break __BREAK_SYSCALL;; \
115 cmp.eq p6,p0=-1,loc4; \
116 (p6) br.cond.spnt.few __syscall_error_##args; \
123 SYSDEP_CANCEL_ERROR(args)
125 # else /* USE_DL_SYSINFO */
127 # define PSEUDO(name, syscall_name, args) \
131 adds r2 = SYSINFO_OFFSET, r13; \
132 adds r14 = MULTIPLE_THREADS_OFFSET, r13; \
138 mov r15 = SYS_ify(syscall_name);; \
139 cmp4.ne p6, p7 = 0, r14; \
141 (p6) br.cond.spnt .Lpseudo_cancel; \
142 br.call.sptk.many b6 = b7;; \
144 cmp.eq p6,p0 = -1, r10; \
145 (p6) br.cond.spnt.few __syscall_error; \
149 .globl __GC_##name; \
150 .hidden __GC_##name; \
154 .regstk args, 5, args, 0; \
155 .save ar.pfs, loc0; \
156 alloc loc0 = ar.pfs, args, 5, args, 0; \
157 adds loc4 = SYSINFO_OFFSET, r13; \
166 mov r15 = SYS_ify(syscall_name); \
167 br.call.sptk.many b6 = b7;; \
172 cmp.eq p6,p0=-1,loc4; \
173 (p6) br.cond.spnt.few __syscall_error_##args; \
180 SYSDEP_CANCEL_ERROR(args)
182 # endif /* USE_DL_SYSINFO */
185 # define PSEUDO_END(name) .endp
187 # ifdef IS_IN_libpthread
188 # define CENABLE br.call.sptk.many b0 = __pthread_enable_asynccancel
189 # define CDISABLE br.call.sptk.many b0 = __pthread_disable_asynccancel
190 # elif !defined NOT_IN_libc
191 # define CENABLE br.call.sptk.many b0 = __libc_enable_asynccancel
192 # define CDISABLE br.call.sptk.many b0 = __libc_disable_asynccancel
193 # elif defined IS_IN_librt
194 # define CENABLE br.call.sptk.many b0 = __librt_enable_asynccancel
195 # define CDISABLE br.call.sptk.many b0 = __librt_disable_asynccancel
197 # error Unsupported library
200 # define COPY_ARGS_0 /* Nothing */
201 # define COPY_ARGS_1 COPY_ARGS_0 mov out0 = in0;
202 # define COPY_ARGS_2 COPY_ARGS_1 mov out1 = in1;
203 # define COPY_ARGS_3 COPY_ARGS_2 mov out2 = in2;
204 # define COPY_ARGS_4 COPY_ARGS_3 mov out3 = in3;
205 # define COPY_ARGS_5 COPY_ARGS_4 mov out4 = in4;
206 # define COPY_ARGS_6 COPY_ARGS_5 mov out5 = in5;
207 # define COPY_ARGS_7 COPY_ARGS_6 mov out6 = in6;
209 # ifndef __ASSEMBLER__
210 # define SINGLE_THREAD_P \
211 __builtin_expect (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0, 1)
213 # define SINGLE_THREAD_P \
214 adds r14 = MULTIPLE_THREADS_OFFSET, r13 ;; ld4 r14 = [r14] ;; cmp4.ne p6, p7 = 0, r14
217 #elif !defined __ASSEMBLER__
219 # define SINGLE_THREAD_P (1)
220 # define NO_CANCELLATION 1
224 #ifndef __ASSEMBLER__
225 # define RTLD_SINGLE_THREAD_P \
226 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
227 header.multiple_threads) == 0, 1)