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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 # include <linuxthreads/internals.h>
26 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
28 # if !defined NOT_IN_libc || defined IS_IN_libpthread
30 # define PSEUDO_CANCEL(name, syscall_name, args) \
33 stm %r12,%r15,48(%r15); \
38 0: l %r1,1f-0b(%r13); \
39 bas %r14,0(%r1,%r13); \
42 DO_CALL(syscall_name, args); \
46 bas %r14,0(%r1,%r13); \
48 lm %r12,%r15,48+96(%r15); \
50 1: .long CENABLE-0b; \
53 # else /* !libc.so && !libpthread.so */
55 # define PSEUDO_CANCEL(name, syscall_name, args) \
58 stm %r11,%r15,44(%r15); \
63 0: l %r12,3f-0b(%r13); \
65 la %r12,0(%r12,%r13); \
66 bas %r14,0(%r1,%r13); \
69 DO_CALL(syscall_name, args); \
73 bas %r14,0(%r1,%r13); \
75 lm %r11,%r15,44+96(%r15); \
77 1: .long CENABLE@PLT-0b; \
78 2: .long CDISABLE@PLT-0b; \
79 3: .long _GLOBAL_OFFSET_TABLE_-0b;
84 # define PSEUDO(name, syscall_name, args) \
86 PSEUDO_CANCEL(name, syscall_name, args) \
88 SINGLE_THREAD_P(%r1) \
89 jne L(pseudo_cancel); \
90 DO_CALL(syscall_name, args); \
94 jnl SYSCALL_ERROR_LABEL; \
97 # ifdef IS_IN_libpthread
98 # define CENABLE __pthread_enable_asynccancel
99 # define CDISABLE __pthread_disable_asynccancel
100 # elif !defined NOT_IN_libc
101 # define CENABLE __libc_enable_asynccancel
102 # define CDISABLE __libc_disable_asynccancel
104 # define CENABLE __librt_enable_asynccancel
105 # define CDISABLE __librt_disable_asynccancel
108 #define STM_0 /* Nothing */
109 #define STM_1 st %r2,8(%r15);
110 #define STM_2 stm %r2,%r3,8(%r15);
111 #define STM_3 stm %r2,%r4,8(%r15);
112 #define STM_4 stm %r2,%r5,8(%r15);
113 #define STM_5 stm %r2,%r5,8(%r15);
115 #define LM_0 /* Nothing */
116 #define LM_1 l %r2,8+96(%r15);
117 #define LM_2 lm %r2,%r3,8+96(%r15);
118 #define LM_3 lm %r2,%r4,8+96(%r15);
119 #define LM_4 lm %r2,%r5,8+96(%r15);
120 #define LM_5 lm %r2,%r5,8+96(%r15);
122 # ifndef __ASSEMBLER__
123 # define SINGLE_THREAD_P \
124 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
125 p_header.data.multiple_threads) == 0, 1)
127 # define SINGLE_THREAD_P(reg) \
129 icm reg,15,MULTIPLE_THREADS_OFFSET(reg);
132 #elif !defined __ASSEMBLER__
134 /* This code should never be used but we define it anyhow. */
135 # define SINGLE_THREAD_P (1)