]>
Commit | Line | Data |
---|---|---|
c0a777e8 | 1 | /* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. |
a88c9263 UD |
2 | This file is part of the GNU C Library. |
3 | Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. | |
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 | |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
a88c9263 UD |
18 | |
19 | #include <sysdep.h> | |
20 | #include <tls.h> | |
21 | #ifndef __ASSEMBLER__ | |
22 | # include <nptl/pthreadP.h> | |
23 | #endif | |
24 | ||
7a114794 | 25 | #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt |
a88c9263 UD |
26 | |
27 | # undef PSEUDO | |
28 | # define PSEUDO(name, syscall_name, args) \ | |
29 | .text; \ | |
30 | L(pseudo_cancel): \ | |
6080ecdf | 31 | cfi_startproc; \ |
a88c9263 UD |
32 | STM_##args \ |
33 | stm %r12,%r15,48(%r15); \ | |
6080ecdf UD |
34 | cfi_offset (%r15, -36); \ |
35 | cfi_offset (%r14, -40); \ | |
36 | cfi_offset (%r13, -44); \ | |
37 | cfi_offset (%r12, -48); \ | |
a88c9263 UD |
38 | lr %r14,%r15; \ |
39 | ahi %r15,-96; \ | |
6080ecdf | 40 | cfi_adjust_cfa_offset (96); \ |
a88c9263 UD |
41 | st %r14,0(%r15); \ |
42 | basr %r13,0; \ | |
43 | 0: l %r1,1f-0b(%r13); \ | |
44 | bas %r14,0(%r1,%r13); \ | |
45 | lr %r0,%r2; \ | |
46 | LM_##args \ | |
11bf311e UD |
47 | .if SYS_ify (syscall_name) < 256; \ |
48 | svc SYS_ify (syscall_name); \ | |
49 | .else; \ | |
50 | lhi %r1,SYS_ify (syscall_name); \ | |
51 | svc 0; \ | |
52 | .endif; \ | |
53 | LR7_##args \ | |
a88c9263 UD |
54 | l %r1,2f-0b(%r13); \ |
55 | lr %r12,%r2; \ | |
56 | lr %r2,%r0; \ | |
57 | bas %r14,0(%r1,%r13); \ | |
58 | lr %r2,%r12; \ | |
59 | lm %r12,%r15,48+96(%r15); \ | |
6080ecdf | 60 | cfi_endproc; \ |
a88c9263 UD |
61 | j L(pseudo_check); \ |
62 | 1: .long CENABLE-0b; \ | |
63 | 2: .long CDISABLE-0b; \ | |
64 | ENTRY(name) \ | |
65 | SINGLE_THREAD_P(%r1) \ | |
66 | jne L(pseudo_cancel); \ | |
5777d565 UD |
67 | .type __##syscall_name##_nocancel,@function; \ |
68 | .globl __##syscall_name##_nocancel; \ | |
69 | __##syscall_name##_nocancel: \ | |
a88c9263 UD |
70 | DO_CALL(syscall_name, args); \ |
71 | L(pseudo_check): \ | |
72 | lhi %r4,-4095; \ | |
73 | clr %r2,%r4; \ | |
74 | jnl SYSCALL_ERROR_LABEL; \ | |
5777d565 | 75 | .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \ |
a88c9263 UD |
76 | L(pseudo_end): |
77 | ||
78 | # ifdef IS_IN_libpthread | |
79 | # define CENABLE __pthread_enable_asynccancel | |
80 | # define CDISABLE __pthread_disable_asynccancel | |
bbde8527 | 81 | # elif !defined NOT_IN_libc |
a88c9263 UD |
82 | # define CENABLE __libc_enable_asynccancel |
83 | # define CDISABLE __libc_disable_asynccancel | |
bbde8527 UD |
84 | # elif defined IS_IN_librt |
85 | # define CENABLE __librt_enable_asynccancel | |
86 | # define CDISABLE __librt_disable_asynccancel | |
87 | # else | |
88 | # error Unsupported library | |
a88c9263 UD |
89 | # endif |
90 | ||
91 | #define STM_0 /* Nothing */ | |
92 | #define STM_1 st %r2,8(%r15); | |
93 | #define STM_2 stm %r2,%r3,8(%r15); | |
94 | #define STM_3 stm %r2,%r4,8(%r15); | |
95 | #define STM_4 stm %r2,%r5,8(%r15); | |
96 | #define STM_5 stm %r2,%r5,8(%r15); | |
11bf311e | 97 | #define STM_6 stm %r2,%r7,8(%r15); |
a88c9263 UD |
98 | |
99 | #define LM_0 /* Nothing */ | |
100 | #define LM_1 l %r2,8+96(%r15); | |
101 | #define LM_2 lm %r2,%r3,8+96(%r15); | |
102 | #define LM_3 lm %r2,%r4,8+96(%r15); | |
103 | #define LM_4 lm %r2,%r5,8+96(%r15); | |
104 | #define LM_5 lm %r2,%r5,8+96(%r15); | |
11bf311e UD |
105 | #define LM_6 lm %r2,%r5,8+96(%r15); \ |
106 | cfi_offset (%r7, -68); \ | |
107 | l %r7,96+96(%r15); | |
108 | ||
109 | #define LR7_0 /* Nothing */ | |
110 | #define LR7_1 /* Nothing */ | |
111 | #define LR7_2 /* Nothing */ | |
112 | #define LR7_3 /* Nothing */ | |
113 | #define LR7_4 /* Nothing */ | |
114 | #define LR7_5 /* Nothing */ | |
115 | #define LR7_6 l %r7,28+96(%r15); \ | |
116 | cfi_restore (%r7); | |
a88c9263 UD |
117 | |
118 | # ifndef __ASSEMBLER__ | |
119 | # define SINGLE_THREAD_P \ | |
120 | __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ | |
1419a958 | 121 | header.multiple_threads) == 0, 1) |
a88c9263 UD |
122 | # else |
123 | # define SINGLE_THREAD_P(reg) \ | |
124 | ear reg,%a0; \ | |
125 | icm reg,15,MULTIPLE_THREADS_OFFSET(reg); | |
126 | # endif | |
127 | ||
128 | #elif !defined __ASSEMBLER__ | |
129 | ||
6e627806 | 130 | # define SINGLE_THREAD_P (1) |
ce6e047f | 131 | # define NO_CANCELLATION 1 |
a88c9263 UD |
132 | |
133 | #endif | |
6e627806 UD |
134 | |
135 | #ifndef __ASSEMBLER__ | |
136 | # define RTLD_SINGLE_THREAD_P \ | |
137 | __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ | |
138 | header.multiple_threads) == 0, 1) | |
139 | #endif |