]> git.ipfire.org Git - thirdparty/glibc.git/blame - linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h
Test for stack alignment.
[thirdparty/glibc.git] / linuxthreads / sysdeps / unix / sysv / linux / m68k / sysdep-cancel.h
CommitLineData
8ecfaf1a 1/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
97d0db28
AS
2 This file is part of the GNU C Library.
3 Contributed by Andreas Schwab <schwab@suse.de>, 2002.
4
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.
9
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.
14
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. */
19
20#include <sysdep.h>
a4baf360 21#ifndef __ASSEMBLER__
97d0db28
AS
22# include <linuxthreads/internals.h>
23#endif
24
a10d475d 25#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
97d0db28
AS
26
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 \
4f172c25 40 move.l %d0, -(%sp); \
97d0db28
AS
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
50
51# define DOCARGS_0 move.l %d2, -(%sp);
52# define _DOCARGS_0(n)
53# define UNDOCARGS_0 move.l (%sp)+, %d2;
54
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
58
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
63
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;
68
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;
73
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;
78
79# ifdef IS_IN_libpthread
8ecfaf1a
AS
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
a10d475d 87# elif !defined NOT_IN_libc
8ecfaf1a
AS
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
a10d475d
AS
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
97d0db28
AS
103# endif
104
105# if !defined NOT_IN_libc
106# define __local_multiple_threads __libc_multiple_threads
a10d475d 107# elif defined IS_IN_libpthread
97d0db28 108# define __local_multiple_threads __pthread_multiple_threads
a10d475d
AS
109# else
110# define __local_multiple_threads __librt_multiple_threads
97d0db28
AS
111# endif
112
a4baf360 113# ifndef __ASSEMBLER__
97d0db28
AS
114extern 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
8ecfaf1a 120# define SINGLE_THREAD_P tst.l (__local_multiple_threads, %pc)
97d0db28
AS
121# endif
122# endif
123
a4baf360 124#elif !defined __ASSEMBLER__
97d0db28
AS
125
126/* This code should never be used but we define it anyhow. */
127# define SINGLE_THREAD_P (1)
128
129#endif