1 /* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
20 #include <pt-machine.h>
22 # include <linuxthreads/internals.h>
25 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
31 # define PSEUDO(name, syscall_name, args) \
36 DO_CALL (syscall_name, args); \
53 DO_CALL(syscall_name, args); \
67 SYSCALL_ERROR_HANDLER; \
71 # define PSEUDO_END(sym) \
74 # define SAVE_ARGS_0 /* Nothing. */
75 # define SAVE_ARGS_1 SAVE_ARGS_0; mov.l r4,@(0,r15)
76 # define SAVE_ARGS_2 SAVE_ARGS_1; mov.l r5,@(4,r15)
77 # define SAVE_ARGS_3 SAVE_ARGS_2; mov.l r6,@(8,r15)
78 # define SAVE_ARGS_4 SAVE_ARGS_3; mov.l r7,@(12,r15)
79 # define SAVE_ARGS_5 SAVE_ARGS_4
80 # define SAVE_ARGS_6 SAVE_ARGS_5
82 # define LOAD_ARGS_0 /* Nothing. */
83 # define LOAD_ARGS_1 LOAD_ARGS_0; mov.l @(0,r15),r4
84 # define LOAD_ARGS_2 LOAD_ARGS_1; mov.l @(4,r15),r5
85 # define LOAD_ARGS_3 LOAD_ARGS_2; mov.l @(8,r15),r6
86 # define LOAD_ARGS_4 LOAD_ARGS_3; mov.l @(12,r15),r7
87 # define LOAD_ARGS_5 LOAD_ARGS_4
88 # define LOAD_ARGS_6 LOAD_ARGS_5
90 # ifdef IS_IN_libpthread
91 # define __local_enable_asynccancel __pthread_enable_asynccancel
92 # define __local_disable_asynccancel __pthread_disable_asynccancel
93 # define __local_multiple_threads __pthread_multiple_threads
94 # elif !defined NOT_IN_libc
95 # define __local_enable_asynccancel __libc_enable_asynccancel
96 # define __local_disable_asynccancel __libc_disable_asynccancel
97 # define __local_multiple_threads __libc_multiple_threads
99 # define __local_enable_asynccancel __librt_enable_asynccancel
100 # define __local_disable_asynccancel __librt_disable_asynccancel
101 # define __local_multiple_threads __librt_multiple_threads
104 # if defined IS_IN_librt && defined __PIC__
116 1: .long _GLOBAL_OFFSET_TABLE_; \
117 2: .long __local_enable_asynccancel@PLT - (0b-.); \
131 1: .long _GLOBAL_OFFSET_TABLE_; \
132 2: .long __local_disable_asynccancel@PLT - (0b-.); \
142 1: .long __local_enable_asynccancel - 0b; \
152 1: .long __local_disable_asynccancel - 0b; \
156 # ifndef __ASSEMBLER__
157 # if defined FLOATING_STACKS && defined __UCLIBC_HAS_TLS__ && defined __PIC__
158 # define SINGLE_THREAD_P \
159 __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
161 extern int __local_multiple_threads attribute_hidden;
162 # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
165 # if !defined __PIC__
166 # define SINGLE_THREAD_P \
172 1: .long __local_multiple_threads; \
174 # elif defined FLOATING_STACKS && defined __UCLIBC_HAS_TLS__
175 # define SINGLE_THREAD_P \
179 mov.l @(MULTIPLE_THREADS_OFFSET,r0),r0; \
182 0: .word TLS_PRE_TCB_SIZE; \
186 # if !defined NOT_IN_libc || defined IS_IN_libpthread
187 # define SINGLE_THREAD_P \
193 mov.l @(r0,r12),r0; \
198 0: .long _GLOBAL_OFFSET_TABLE_; \
199 1: .long __local_multiple_threads@GOTOFF; \
202 # define SINGLE_THREAD_P \
208 mov.l @(r0,r12),r0; \
214 0: .long _GLOBAL_OFFSET_TABLE_; \
215 1: .long __local_multiple_threads@GOT; \
221 #elif !defined __ASSEMBLER__
223 /* This code should never be used but we define it anyhow. */
224 # define SINGLE_THREAD_P (1)