*** empty log message ***
[glibc.git] / linuxthreads / sysdeps / unix / sysv / linux / m68k / sysdep-cancel.h
blobfb6e92c37a2b44655dae9e70faeec5c2cf65520c
1 /* Copyright (C) 2002 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
18 02111-1307 USA. */
20 #include <sysdep.h>
21 #ifndef ASSEMBLER
22 # include <linuxthreads/internals.h>
23 #endif
25 #if !defined NOT_IN_libc || defined IS_IN_libpthread
27 # undef PSEUDO
28 # define PSEUDO(name, syscall_name, args) \
29 .text; \
30 ENTRY (name) \
31 SINGLE_THREAD_P; \
32 jne .Lpseudo_cancel; \
33 DO_CALL (syscall_name, args); \
34 cmp.l &-4095, %d0; \
35 jcc SYSCALL_ERROR_LABEL; \
36 rts; \
37 .Lpseudo_cancel: \
38 CENABLE; \
39 DOCARGS_##args \
40 move.l %d0, -(%sp); \
41 move.l &SYS_ify (syscall_name), %d0; \
42 trap &0; \
43 move.l %d0, %d2; \
44 CDISABLE; \
45 addq.l &4, %sp; \
46 move.l %d2, %d0; \
47 UNDOCARGS_##args \
48 cmp.l &-4095, %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; \
61 _DOCARGS_1 (n)
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; \
66 _DOCARGS_2 (n)
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; \
71 _DOCARGS_3 (n)
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; \
76 _DOCARGS_4 (n)
77 # define UNDOCARGS_5 UNDOCARGS_4; move.l (%sp)+, %d5;
79 # ifdef IS_IN_libpthread
80 # define CENABLE jbsr __pthread_enable_asynccancel
81 # define CDISABLE jbsr __pthread_disable_asynccancel
82 # else
83 # define CENABLE jbsr __libc_enable_asynccancel
84 # define CDISABLE jbsr __libc_disable_asynccancel
85 # endif
87 # if !defined NOT_IN_libc
88 # define __local_multiple_threads __libc_multiple_threads
89 # else
90 # define __local_multiple_threads __pthread_multiple_threads
91 # endif
93 # ifndef ASSEMBLER
94 extern int __local_multiple_threads attribute_hidden;
95 # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
96 # else
97 # if !defined PIC
98 # define SINGLE_THREAD_P tst.l __local_multiple_threads
99 # else
100 # if !defined HAVE_HIDDEN || !USE___THREAD
101 # define SINGLE_THREAD_P \
102 tst.l (__local_multiple_threads@GOTPC, %pc)
103 # else
104 # define SINGLE_THREAD_P \
105 tst.l (__local_multiple_threads@GOTPC, %pc)
106 # endif
107 # endif
108 # endif
110 #elif !defined ASSEMBLER
112 /* This code should never be used but we define it anyhow. */
113 # define SINGLE_THREAD_P (1)
115 #endif