]> git.ipfire.org Git - thirdparty/glibc.git/blame - nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
Replace FSF snail mail address with URLs.
[thirdparty/glibc.git] / nptl / sysdeps / unix / sysv / linux / powerpc / powerpc32 / sysdep-cancel.h
CommitLineData
f3c13160 1/* Cancellable system call stubs. Linux/PowerPC version.
0470fa46 2 Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
f3c13160
RM
3 This file is part of the GNU C Library.
4 Contributed by Franz Sirl <Franz.Sirl-kernel@lauterbach.com>, 2003.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
f3c13160
RM
19
20#include <sysdep.h>
21#include <tls.h>
22#ifndef __ASSEMBLER__
23# include <nptl/pthreadP.h>
24#endif
25
7a114794 26#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
f3c13160
RM
27
28# undef PSEUDO
29# define PSEUDO(name, syscall_name, args) \
30 .section ".text"; \
31 ENTRY (name) \
32 SINGLE_THREAD_P; \
33 bne- .Lpseudo_cancel; \
5777d565
UD
34 .type __##syscall_name##_nocancel,@function; \
35 .globl __##syscall_name##_nocancel; \
36 __##syscall_name##_nocancel: \
f3c13160
RM
37 DO_CALL (SYS_ify (syscall_name)); \
38 PSEUDO_RET; \
5777d565 39 .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
f3c13160
RM
40 .Lpseudo_cancel: \
41 stwu 1,-48(1); \
6080ecdf 42 cfi_adjust_cfa_offset (48); \
f3c13160
RM
43 mflr 9; \
44 stw 9,52(1); \
6080ecdf 45 cfi_offset (lr, 4); \
f3c13160
RM
46 DOCARGS_##args; /* save syscall args around CENABLE. */ \
47 CENABLE; \
48 stw 3,16(1); /* store CENABLE return value (MASK). */ \
49 UNDOCARGS_##args; /* restore syscall args. */ \
50 DO_CALL (SYS_ify (syscall_name)); \
51 mfcr 0; /* save CR/R3 around CDISABLE. */ \
52 stw 3,8(1); \
53 stw 0,12(1); \
54 lwz 3,16(1); /* pass MASK to CDISABLE. */ \
55 CDISABLE; \
56 lwz 4,52(1); \
57 lwz 0,12(1); /* restore CR/R3. */ \
58 lwz 3,8(1); \
59 mtlr 4; \
60 mtcr 0; \
9759bbf1 61 addi 1,1,48;
f3c13160
RM
62
63# define DOCARGS_0
64# define UNDOCARGS_0
65
66# define DOCARGS_1 stw 3,20(1); DOCARGS_0
67# define UNDOCARGS_1 lwz 3,20(1); UNDOCARGS_0
68
69# define DOCARGS_2 stw 4,24(1); DOCARGS_1
70# define UNDOCARGS_2 lwz 4,24(1); UNDOCARGS_1
71
72# define DOCARGS_3 stw 5,28(1); DOCARGS_2
73# define UNDOCARGS_3 lwz 5,28(1); UNDOCARGS_2
74
75# define DOCARGS_4 stw 6,32(1); DOCARGS_3
76# define UNDOCARGS_4 lwz 6,32(1); UNDOCARGS_3
77
78# define DOCARGS_5 stw 7,36(1); DOCARGS_4
79# define UNDOCARGS_5 lwz 7,36(1); UNDOCARGS_4
80
81# define DOCARGS_6 stw 8,40(1); DOCARGS_5
82# define UNDOCARGS_6 lwz 8,40(1); UNDOCARGS_5
83
84# ifdef IS_IN_libpthread
b0e196a4
UD
85# define CENABLE bl __pthread_enable_asynccancel@local
86# define CDISABLE bl __pthread_disable_asynccancel@local
bbde8527 87# elif !defined NOT_IN_libc
b0e196a4
UD
88# define CENABLE bl __libc_enable_asynccancel@local
89# define CDISABLE bl __libc_disable_asynccancel@local
bbde8527 90# elif defined IS_IN_librt
0470fa46
JJ
91# define CENABLE bl __librt_enable_asynccancel@local
92# define CDISABLE bl __librt_disable_asynccancel@local
bbde8527
UD
93# else
94# error Unsupported library
f3c13160
RM
95# endif
96
97# ifndef __ASSEMBLER__
98# define SINGLE_THREAD_P \
468777e1
UD
99 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
100 header.multiple_threads) == 0, 1)
f3c13160
RM
101# else
102# define SINGLE_THREAD_P \
103 lwz 10,MULTIPLE_THREADS_OFFSET(2); \
104 cmpwi 10,0
105# endif
106
107#elif !defined __ASSEMBLER__
108
6e627806 109# define SINGLE_THREAD_P (1)
ce6e047f 110# define NO_CANCELLATION 1
f3c13160
RM
111
112#endif
6e627806
UD
113
114#ifndef __ASSEMBLER__
115# define RTLD_SINGLE_THREAD_P \
116 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
117 header.multiple_threads) == 0, 1)
118#endif