1 /* Copyright (C) 2003, 2004 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 <linuxthreads/internals.h>
25 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
27 # if !defined NOT_IN_libc || defined IS_IN_libpthread
29 # define PSEUDO_CANCEL(name, syscall_name, args) \
32 stm %r12,%r15,48(%r15); \
37 0: l %r1,1f-0b(%r13); \
38 bas %r14,0(%r1,%r13); \
41 DO_CALL(syscall_name, args); \
45 bas %r14,0(%r1,%r13); \
47 lm %r12,%r15,48+96(%r15); \
49 1: .long CENABLE-0b; \
52 # else /* !libc.so && !libpthread.so */
54 # define PSEUDO_CANCEL(name, syscall_name, args) \
57 stm %r11,%r15,44(%r15); \
62 0: l %r12,3f-0b(%r13); \
64 la %r12,0(%r12,%r13); \
65 bas %r14,0(%r1,%r13); \
68 DO_CALL(syscall_name, args); \
72 bas %r14,0(%r1,%r13); \
74 lm %r11,%r15,44+96(%r15); \
76 1: .long CENABLE@PLT-0b; \
77 2: .long CDISABLE@PLT-0b; \
78 3: .long _GLOBAL_OFFSET_TABLE_-0b;
83 # define PSEUDO(name, syscall_name, args) \
85 PSEUDO_CANCEL(name, syscall_name, args) \
87 SINGLE_THREAD_P(%r1) \
88 jne L(pseudo_cancel); \
89 DO_CALL(syscall_name, args); \
93 jnl SYSCALL_ERROR_LABEL; \
96 # ifdef IS_IN_libpthread
97 # define CENABLE __pthread_enable_asynccancel
98 # define CDISABLE __pthread_disable_asynccancel
99 # elif !defined NOT_IN_libc
100 # define CENABLE __libc_enable_asynccancel
101 # define CDISABLE __libc_disable_asynccancel
103 # define CENABLE __librt_enable_asynccancel
104 # define CDISABLE __librt_disable_asynccancel
107 #define STM_0 /* Nothing */
108 #define STM_1 st %r2,8(%r15);
109 #define STM_2 stm %r2,%r3,8(%r15);
110 #define STM_3 stm %r2,%r4,8(%r15);
111 #define STM_4 stm %r2,%r5,8(%r15);
112 #define STM_5 stm %r2,%r5,8(%r15);
114 #define LM_0 /* Nothing */
115 #define LM_1 l %r2,8+96(%r15);
116 #define LM_2 lm %r2,%r3,8+96(%r15);
117 #define LM_3 lm %r2,%r4,8+96(%r15);
118 #define LM_4 lm %r2,%r5,8+96(%r15);
119 #define LM_5 lm %r2,%r5,8+96(%r15);
121 # ifndef __ASSEMBLER__
122 # define SINGLE_THREAD_P \
123 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
124 p_header.data.multiple_threads) == 0, 1)
126 # define SINGLE_THREAD_P(reg) \
128 icm reg,15,MULTIPLE_THREADS_OFFSET(reg);
131 #elif !defined __ASSEMBLER__
133 /* This code should never be used but we define it anyhow. */
134 # define SINGLE_THREAD_P (1)