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 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); \
41 cfi_adjust_cfa_offset (96); \
44 0: l %r1,1f-0b(%r13); \
45 bas %r14,0(%r1,%r13); \
48 .if SYS_ify (syscall_name) < 256; \
49 svc SYS_ify (syscall_name); \
51 lhi %r1,SYS_ify (syscall_name); \
58 bas %r14,0(%r1,%r13); \
60 lm %r12,%r15,48+96(%r15); \
63 1: .long CENABLE-0b; \
64 2: .long CDISABLE-0b; \
66 SINGLE_THREAD_P(%r1) \
67 jne L(pseudo_cancel); \
68 .type __##syscall_name##_nocancel,@function; \
69 .globl __##syscall_name##_nocancel; \
70 __##syscall_name##_nocancel: \
71 DO_CALL(syscall_name, args); \
75 jnl SYSCALL_ERROR_LABEL; \
76 .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
79 # ifdef IS_IN_libpthread
80 # define CENABLE __pthread_enable_asynccancel
81 # define CDISABLE __pthread_disable_asynccancel
82 # elif !defined NOT_IN_libc
83 # define CENABLE __libc_enable_asynccancel
84 # define CDISABLE __libc_disable_asynccancel
85 # elif defined IS_IN_librt
86 # define CENABLE __librt_enable_asynccancel
87 # define CDISABLE __librt_disable_asynccancel
89 # error Unsupported library
92 #define STM_0 /* Nothing */
93 #define STM_1 st %r2,8(%r15);
94 #define STM_2 stm %r2,%r3,8(%r15);
95 #define STM_3 stm %r2,%r4,8(%r15);
96 #define STM_4 stm %r2,%r5,8(%r15);
97 #define STM_5 stm %r2,%r5,8(%r15);
98 #define STM_6 stm %r2,%r7,8(%r15);
100 #define LM_0 /* Nothing */
101 #define LM_1 l %r2,8+96(%r15);
102 #define LM_2 lm %r2,%r3,8+96(%r15);
103 #define LM_3 lm %r2,%r4,8+96(%r15);
104 #define LM_4 lm %r2,%r5,8+96(%r15);
105 #define LM_5 lm %r2,%r5,8+96(%r15);
106 #define LM_6 lm %r2,%r5,8+96(%r15); \
107 cfi_offset (%r7, -68); \
110 #define LR7_0 /* Nothing */
111 #define LR7_1 /* Nothing */
112 #define LR7_2 /* Nothing */
113 #define LR7_3 /* Nothing */
114 #define LR7_4 /* Nothing */
115 #define LR7_5 /* Nothing */
116 #define LR7_6 l %r7,28+96(%r15); \
119 # ifndef __ASSEMBLER__
120 # define SINGLE_THREAD_P \
121 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
122 header.multiple_threads) == 0, 1)
124 # define SINGLE_THREAD_P(reg) \
126 icm reg,15,MULTIPLE_THREADS_OFFSET(reg);
129 #elif !defined __ASSEMBLER__
131 # define SINGLE_THREAD_P (1)
132 # define NO_CANCELLATION 1
136 #ifndef __ASSEMBLER__
137 # define RTLD_SINGLE_THREAD_P \
138 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
139 header.multiple_threads) == 0, 1)