(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / linuxthreads / sysdeps / unix / sysv / linux / m68k / sysdep-cancel.h
blobbb798e40d67cf9638c2e56bf07ce6a766053cc9a
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
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 || defined IS_IN_librt
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 # ifdef PIC
81 # define CENABLE jbsr __pthread_enable_asynccancel@PLTPC
82 # define CDISABLE jbsr __pthread_disable_asynccancel@PLTPC
83 # else
84 # define CENABLE jbsr __pthread_enable_asynccancel
85 # define CDISABLE jbsr __pthread_disable_asynccancel
86 # endif
87 # elif !defined NOT_IN_libc
88 # ifdef PIC
89 # define CENABLE jbsr __libc_enable_asynccancel@PLTPC
90 # define CDISABLE jbsr __libc_disable_asynccancel@PLTPC
91 # else
92 # define CENABLE jbsr __libc_enable_asynccancel
93 # define CDISABLE jbsr __libc_disable_asynccancel
94 # endif
95 # else
96 # ifdef PIC
97 # define CENABLE jbsr __librt_enable_asynccancel@PLTPC
98 # define CDISABLE jbsr __librt_disable_asynccancel@PLTPC
99 # else
100 # define CENABLE jbsr __librt_enable_asynccancel
101 # define CDISABLE jbsr __librt_disable_asynccancel
102 # endif
103 # endif
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
109 # else
110 # define __local_multiple_threads __librt_multiple_threads
111 # endif
113 # ifndef __ASSEMBLER__
114 extern int __local_multiple_threads attribute_hidden;
115 # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
116 # else
117 # if !defined PIC
118 # define SINGLE_THREAD_P tst.l __local_multiple_threads
119 # else
120 # define SINGLE_THREAD_P tst.l (__local_multiple_threads, %pc)
121 # endif
122 # endif
124 #elif !defined __ASSEMBLER__
126 /* This code should never be used but we define it anyhow. */
127 # define SINGLE_THREAD_P (1)
129 #endif