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
23 # include <nptl/pthreadP.h>
26 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
29 # define PSEUDO(name, syscall_name, args) \
34 stmg %r13,%r15,104(%r15); \
35 cfi_offset (%r15,-40); \
36 cfi_offset (%r14,-48); \
37 cfi_offset (%r13,-56); \
40 cfi_adjust_cfa_offset (160); \
45 DO_CALL(syscall_name, args); \
48 brasl %r14,CDISABLE; \
50 lmg %r13,%r15,104+160(%r15); \
55 jne L(pseudo_cancel); \
56 .type __##syscall_name##_nocancel,@function; \
57 .globl __##syscall_name##_nocancel; \
58 __##syscall_name##_nocancel: \
59 DO_CALL(syscall_name, args); \
63 jgnl SYSCALL_ERROR_LABEL; \
64 .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
67 # ifdef IS_IN_libpthread
68 # define CENABLE __pthread_enable_asynccancel
69 # define CDISABLE __pthread_disable_asynccancel
70 # define __local_multiple_threads __pthread_multiple_threads
71 # elif !defined NOT_IN_libc
72 # define CENABLE __libc_enable_asynccancel
73 # define CDISABLE __libc_disable_asynccancel
74 # define __local_multiple_threads __libc_multiple_threads
75 # elif defined IS_IN_librt
76 # define CENABLE __librt_enable_asynccancel
77 # define CDISABLE __librt_disable_asynccancel
79 # error Unsupported library
82 #define STM_0 /* Nothing */
83 #define STM_1 stg %r2,16(%r15);
84 #define STM_2 stmg %r2,%r3,16(%r15);
85 #define STM_3 stmg %r2,%r4,16(%r15);
86 #define STM_4 stmg %r2,%r5,16(%r15);
87 #define STM_5 stmg %r2,%r5,16(%r15);
89 #define LM_0 /* Nothing */
90 #define LM_1 lg %r2,16+160(%r15);
91 #define LM_2 lmg %r2,%r3,16+160(%r15);
92 #define LM_3 lmg %r2,%r4,16+160(%r15);
93 #define LM_4 lmg %r2,%r5,16+160(%r15);
94 #define LM_5 lmg %r2,%r5,16+160(%r15);
96 # if defined IS_IN_libpthread || !defined NOT_IN_libc
97 # ifndef __ASSEMBLER__
98 extern int __local_multiple_threads attribute_hidden
;
99 # define SINGLE_THREAD_P \
100 __builtin_expect (__local_multiple_threads == 0, 1)
102 # define SINGLE_THREAD_P \
103 larl %r1,__local_multiple_threads; \
109 # ifndef __ASSEMBLER__
110 # define SINGLE_THREAD_P \
111 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
112 header.multiple_threads) == 0, 1)
114 # define SINGLE_THREAD_P \
118 icm %r1,15,MULTIPLE_THREADS_OFFSET(%r1);
123 #elif !defined __ASSEMBLER__
125 # define SINGLE_THREAD_P (1)
126 # define NO_CANCELLATION 1
130 #ifndef __ASSEMBLER__
131 # define RTLD_SINGLE_THREAD_P \
132 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
133 header.multiple_threads) == 0, 1)