1 /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Andreas Schwab <schwab@suse.de>, 2002.
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
22 # include <linuxthreads/internals.h>
25 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
28 # define PSEUDO(name, syscall_name, args) \
32 jne .Lpseudo_cancel; \
33 DO_CALL (syscall_name, args); \
35 jcc SYSCALL_ERROR_LABEL; \
41 move.l &SYS_ify (syscall_name), %d0; \
49 jcc SYSCALL_ERROR_LABEL
51 # define DOCARGS_0 move.l %d2, -(%sp);
52 # define _DOCARGS_0(n)
53 # define UNDOCARGS_0 move.l (%sp)+, %d2;
55 # define DOCARGS_1 _DOCARGS_1 (4); DOCARGS_0
56 # define _DOCARGS_1(n) move.l n(%sp), %d1; _DOARGS_0 (n)
57 # define UNDOCARGS_1 UNDOCARGS_0
59 # define DOCARGS_2 _DOCARGS_2 (8)
60 # define _DOCARGS_2(n) move.l %d2, -(%sp); move.l n+4(%sp), %d2; \
62 # define UNDOCARGS_2 UNDOCARGS_1
64 # define DOCARGS_3 _DOCARGS_3 (12)
65 # define _DOCARGS_3(n) move.l %d3, -(%sp); move.l n+4(%sp), %d3; \
67 # define UNDOCARGS_3 UNDOCARGS_2; move.l (%sp)+, %d3;
69 # define DOCARGS_4 _DOCARGS_4 (16)
70 # define _DOCARGS_4(n) move.l %d4, -(%sp); move.l n+4(%sp), %d4; \
72 # define UNDOCARGS_4 UNDOCARGS_3; move.l (%sp)+, %d4;
74 # define DOCARGS_5 _DOCARGS_5 (20)
75 # define _DOCARGS_5(n) move.l %d5, -(%sp); move.l n+4(%sp), %d5; \
77 # define UNDOCARGS_5 UNDOCARGS_4; move.l (%sp)+, %d5;
79 # ifdef IS_IN_libpthread
81 # define CENABLE jbsr __pthread_enable_asynccancel@PLTPC
82 # define CDISABLE jbsr __pthread_disable_asynccancel@PLTPC
84 # define CENABLE jbsr __pthread_enable_asynccancel
85 # define CDISABLE jbsr __pthread_disable_asynccancel
87 # elif !defined NOT_IN_libc
89 # define CENABLE jbsr __libc_enable_asynccancel@PLTPC
90 # define CDISABLE jbsr __libc_disable_asynccancel@PLTPC
92 # define CENABLE jbsr __libc_enable_asynccancel
93 # define CDISABLE jbsr __libc_disable_asynccancel
97 # define CENABLE jbsr __librt_enable_asynccancel@PLTPC
98 # define CDISABLE jbsr __librt_disable_asynccancel@PLTPC
100 # define CENABLE jbsr __librt_enable_asynccancel
101 # define CDISABLE jbsr __librt_disable_asynccancel
105 # if !defined NOT_IN_libc
106 # define __local_multiple_threads __libc_multiple_threads
107 # elif defined IS_IN_libpthread
108 # define __local_multiple_threads __pthread_multiple_threads
110 # define __local_multiple_threads __librt_multiple_threads
113 # ifndef __ASSEMBLER__
114 extern int __local_multiple_threads attribute_hidden
;
115 # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
118 # define SINGLE_THREAD_P tst.l __local_multiple_threads
120 # define SINGLE_THREAD_P tst.l (__local_multiple_threads, %pc)
124 #elif !defined __ASSEMBLER__
126 /* This code should never be used but we define it anyhow. */
127 # define SINGLE_THREAD_P (1)