]>
Commit | Line | Data |
---|---|---|
f8ea3acb | 1 | /* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
847b055c AJ |
2 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
3 | This file is part of the GNU C Library. | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
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. | |
847b055c AJ |
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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
847b055c | 14 | |
41bdb6e2 AJ |
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. */ | |
847b055c AJ |
19 | |
20 | #include <sysdep.h> | |
f8ea3acb | 21 | #include <tls.h> |
847b055c | 22 | |
847b055c AJ |
23 | /* The following code is only used in the shared library when we |
24 | compile the reentrant version. Otherwise each system call defines | |
25 | each own version. */ | |
26 | ||
27 | /* The syscall stubs jump here when they detect an error. */ | |
28 | ||
29 | #undef CALL_MCOUNT | |
30 | #define CALL_MCOUNT | |
31 | ||
32 | .text | |
33 | ENTRY(__syscall_error) | |
34 | #ifndef PIC | |
e6ebd2e4 UD |
35 | # if USE___THREAD |
36 | # ifndef NOT_IN_libc | |
37 | # define SYSCALL_ERROR_ERRNO __libc_errno | |
38 | # else | |
39 | # define SYSCALL_ERROR_ERRNO errno | |
40 | # endif | |
41 | basr %r1,0 | |
42 | 0: l %r1,1f-0b(%r1) | |
43 | ear %r3,%a0 | |
44 | lcr %r2,%r2 | |
45 | st %r2,0(%r1,%r3) | |
46 | lhi %r2,-1 | |
47 | br %r14 | |
48 | 1: .long SYSCALL_ERROR_ERRNO@ntpoff | |
49 | # elif !defined _LIBC_REENTRANT | |
50 | basr %r1,0 | |
51 | 0: l %r1,1f-0b(%r1) | |
52 | lcr %r2,%r2 | |
53 | st %r2,0(%r1) | |
54 | lhi %r2,-1 | |
55 | br %r14 | |
56 | 1: .long errno | |
57 | # else | |
58 | stm %r13,%r15,52(%r15) | |
844a34a2 UD |
59 | cfi_offset (%r15, -36) |
60 | cfi_offset (%r14, -40) | |
61 | cfi_offset (%r13, -44) | |
e6ebd2e4 UD |
62 | lr %r0,%r15 |
63 | ahi %r15,-96 | |
844a34a2 | 64 | cfi_adjust_cfa_offset (96) |
e6ebd2e4 UD |
65 | lcr %r13,%r2 |
66 | st %r0,0(%r15) | |
67 | basr %r1,0 | |
68 | 0: l %r1,1f-0b(%r1) | |
69 | basr %r14,%r1 | |
70 | st %r13,0(%r2) | |
71 | lm %r13,%r15,148(%r15) | |
844a34a2 | 72 | cfi_adjust_cfa_offset (-96) |
e6ebd2e4 UD |
73 | lhi %r2,-1 |
74 | br %r14 | |
75 | 1: .long __errno_location | |
847b055c AJ |
76 | #endif |
77 | #else | |
e6ebd2e4 UD |
78 | # if RTLD_PRIVATE_ERRNO |
79 | basr %r1,0 | |
80 | 0: al %r1,1f-0b(%r1) | |
81 | lcr %r2,%r2 | |
82 | st %r2,0(%r1) | |
83 | lhi %r2,-1 | |
84 | br %r14 | |
85 | 1: .long errno - 0b | |
86 | # elif USE___THREAD | |
87 | # ifndef NOT_IN_libc | |
88 | # define SYSCALL_ERROR_ERRNO __libc_errno | |
89 | # else | |
90 | # define SYSCALL_ERROR_ERRNO errno | |
91 | # endif | |
92 | basr %r1,0 | |
93 | 0: al %r1,1f-0b(%r1) | |
94 | ear %r3,%a0 | |
95 | l %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1) | |
96 | lcr %r2,%r2 | |
97 | st %r2,0(%r1,%r3) | |
98 | lhi %r2,-1 | |
99 | br %r14 | |
100 | 1: .long _GLOBAL_OFFSET_TABLE_-0b | |
101 | # elif !defined _LIBC_REENTRANT | |
102 | basr %r1,0 | |
103 | 0: al %r1,1f-0b(%r1) | |
104 | l %r1,errno@GOT(%r1) | |
105 | lcr %r2,%r2 | |
106 | st %r2,0(0,%r1) | |
107 | lhi %r2,-1 | |
108 | br %r14 | |
109 | 1: .long _GLOBAL_OFFSET_TABLE_-0b | |
110 | # else | |
111 | stm %r11,%r15,44(%r15) | |
844a34a2 UD |
112 | cfi_offset (%r15, -36) |
113 | cfi_offset (%r14, -40) | |
114 | cfi_offset (%r13, -44) | |
115 | cfi_offset (%r12, -48) | |
116 | cfi_offset (%r11, -52) | |
e6ebd2e4 UD |
117 | lr %r0,%r15 |
118 | ahi %r15,-96 | |
844a34a2 | 119 | cfi_adjust_cfa_offset (96) |
e6ebd2e4 UD |
120 | lcr %r11,%r2 |
121 | st %r0,0(%r15) | |
122 | basr %r13,0 | |
123 | 0: l %r12,1f-0b(%r13) | |
124 | l %r1,2f-0b(%r13) | |
125 | la %r12,0(%r12,%r13) | |
126 | bas %r14,0(%r1,%r13) | |
127 | st %r11,0(%r2) | |
128 | lm %r11,%r15,140(%r15) | |
844a34a2 | 129 | cfi_adjust_cfa_offset (-96) |
e6ebd2e4 UD |
130 | lhi %r2,-1 |
131 | br %r14 | |
132 | 1: .long _GLOBAL_OFFSET_TABLE_-0b | |
133 | 2: .long __errno_location@PLT-0b | |
134 | # endif | |
847b055c AJ |
135 | #endif |
136 | ||
137 | END (__syscall_error) |