]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/sparc/sysdep.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / sparc / sysdep.h
CommitLineData
2b778ceb 1/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
4d76a0ec
UD
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
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.
4d76a0ec
UD
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.
4d76a0ec 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
4d76a0ec
UD
18
19#ifndef _LINUX_SPARC_SYSDEP_H
20#define _LINUX_SPARC_SYSDEP_H 1
21
aab39a09 22#include <sysdeps/unix/sysdep.h>
fb1cf108 23#include <sysdeps/unix/sysv/linux/sysdep.h>
aab39a09
DM
24#include <sysdeps/sparc/sysdep.h>
25
26#ifdef __ASSEMBLER__
27
28#define ret retl; nop
29#define ret_NOERRNO retl; nop
30#define ret_ERRVAL retl; nop
31#define r0 %o0
32#define r1 %o1
33#define MOVE(x,y) mov x, y
34
35#else /* __ASSEMBLER__ */
36
b8386c28
AZ
37# define VDSO_NAME "LINUX_2.6"
38# define VDSO_HASH 61765110
39
94a3a27f 40/* List of system calls which are supported as vsyscalls. */
ff500a62
AZ
41# ifdef __arch64__
42# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
43# else
44# define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime"
45# endif
b8a7c7da 46# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
94a3a27f 47
369b849f 48#undef INTERNAL_SYSCALL
bc2eb932
AZ
49#define INTERNAL_SYSCALL(name, nr, args...) \
50 internal_syscall##nr(__SYSCALL_STRING, __NR_##name, args)
bbb5e55c
UD
51
52#undef INTERNAL_SYSCALL_NCS
bc2eb932
AZ
53#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
54 internal_syscall##nr(__SYSCALL_STRING, name, args)
369b849f 55
bc2eb932 56#define internal_syscall0(string,name,dummy...) \
4d76a0ec 57({ \
86c5d2cf 58 register long int __g1 __asm__ ("g1") = (name); \
4d76a0ec 59 register long __o0 __asm__ ("o0"); \
86c5d2cf
AZ
60 __asm __volatile (string : "=r" (__o0) : \
61 "r" (__g1) : \
72d4c33d 62 __SYSCALL_CLOBBERS); \
4d76a0ec
UD
63 __o0; \
64})
65
bc2eb932 66#define internal_syscall1(string,name,arg1) \
4d76a0ec 67({ \
c261718b 68 long int _arg1 = (long int) (arg1); \
86c5d2cf 69 register long int __g1 __asm__("g1") = (name); \
c261718b 70 register long int __o0 __asm__ ("o0") = _arg1; \
86c5d2cf
AZ
71 __asm __volatile (string : "=r" (__o0) : \
72 "r" (__g1), "0" (__o0) : \
72d4c33d 73 __SYSCALL_CLOBBERS); \
4d76a0ec
UD
74 __o0; \
75})
76
bc2eb932 77#define internal_syscall2(string,name,arg1,arg2) \
4d76a0ec 78({ \
c261718b
AZ
79 long int _arg1 = (long int) (arg1); \
80 long int _arg2 = (long int) (arg2); \
86c5d2cf 81 register long int __g1 __asm__("g1") = (name); \
c261718b
AZ
82 register long int __o0 __asm__ ("o0") = _arg1; \
83 register long int __o1 __asm__ ("o1") = _arg2; \
86c5d2cf
AZ
84 __asm __volatile (string : "=r" (__o0) : \
85 "r" (__g1), "0" (__o0), "r" (__o1) : \
72d4c33d 86 __SYSCALL_CLOBBERS); \
4d76a0ec
UD
87 __o0; \
88})
89
bc2eb932 90#define internal_syscall3(string,name,arg1,arg2,arg3) \
4d76a0ec 91({ \
c261718b
AZ
92 long int _arg1 = (long int) (arg1); \
93 long int _arg2 = (long int) (arg2); \
94 long int _arg3 = (long int) (arg3); \
86c5d2cf 95 register long int __g1 __asm__("g1") = (name); \
c261718b
AZ
96 register long int __o0 __asm__ ("o0") = _arg1; \
97 register long int __o1 __asm__ ("o1") = _arg2; \
98 register long int __o2 __asm__ ("o2") = _arg3; \
86c5d2cf
AZ
99 __asm __volatile (string : "=r" (__o0) : \
100 "r" (__g1), "0" (__o0), "r" (__o1), \
72d4c33d
RM
101 "r" (__o2) : \
102 __SYSCALL_CLOBBERS); \
4d76a0ec
UD
103 __o0; \
104})
105
bc2eb932 106#define internal_syscall4(string,name,arg1,arg2,arg3,arg4) \
4d76a0ec 107({ \
c261718b
AZ
108 long int _arg1 = (long int) (arg1); \
109 long int _arg2 = (long int) (arg2); \
110 long int _arg3 = (long int) (arg3); \
111 long int _arg4 = (long int) (arg4); \
86c5d2cf 112 register long int __g1 __asm__("g1") = (name); \
c261718b
AZ
113 register long int __o0 __asm__ ("o0") = _arg1; \
114 register long int __o1 __asm__ ("o1") = _arg2; \
115 register long int __o2 __asm__ ("o2") = _arg3; \
116 register long int __o3 __asm__ ("o3") = _arg4; \
86c5d2cf
AZ
117 __asm __volatile (string : "=r" (__o0) : \
118 "r" (__g1), "0" (__o0), "r" (__o1), \
72d4c33d
RM
119 "r" (__o2), "r" (__o3) : \
120 __SYSCALL_CLOBBERS); \
4d76a0ec
UD
121 __o0; \
122})
123
bc2eb932 124#define internal_syscall5(string,name,arg1,arg2,arg3,arg4,arg5) \
4d76a0ec 125({ \
c261718b
AZ
126 long int _arg1 = (long int) (arg1); \
127 long int _arg2 = (long int) (arg2); \
128 long int _arg3 = (long int) (arg3); \
129 long int _arg4 = (long int) (arg4); \
130 long int _arg5 = (long int) (arg5); \
86c5d2cf 131 register long int __g1 __asm__("g1") = (name); \
c261718b
AZ
132 register long int __o0 __asm__ ("o0") = _arg1; \
133 register long int __o1 __asm__ ("o1") = _arg2; \
134 register long int __o2 __asm__ ("o2") = _arg3; \
135 register long int __o3 __asm__ ("o3") = _arg4; \
136 register long int __o4 __asm__ ("o4") = _arg5; \
86c5d2cf
AZ
137 __asm __volatile (string : "=r" (__o0) : \
138 "r" (__g1), "0" (__o0), "r" (__o1), \
72d4c33d
RM
139 "r" (__o2), "r" (__o3), "r" (__o4) : \
140 __SYSCALL_CLOBBERS); \
4d76a0ec
UD
141 __o0; \
142})
143
bc2eb932 144#define internal_syscall6(string,name,arg1,arg2,arg3,arg4,arg5,arg6) \
4d76a0ec 145({ \
c261718b
AZ
146 long int _arg1 = (long int) (arg1); \
147 long int _arg2 = (long int) (arg2); \
148 long int _arg3 = (long int) (arg3); \
149 long int _arg4 = (long int) (arg4); \
150 long int _arg5 = (long int) (arg5); \
151 long int _arg6 = (long int) (arg6); \
86c5d2cf 152 register long int __g1 __asm__("g1") = (name); \
c261718b
AZ
153 register long int __o0 __asm__ ("o0") = _arg1; \
154 register long int __o1 __asm__ ("o1") = _arg2; \
155 register long int __o2 __asm__ ("o2") = _arg3; \
156 register long int __o3 __asm__ ("o3") = _arg4; \
157 register long int __o4 __asm__ ("o4") = _arg5; \
158 register long int __o5 __asm__ ("o5") = _arg6; \
86c5d2cf
AZ
159 __asm __volatile (string : "=r" (__o0) : \
160 "r" (__g1), "0" (__o0), "r" (__o1), \
72d4c33d
RM
161 "r" (__o2), "r" (__o3), "r" (__o4), \
162 "r" (__o5) : \
163 __SYSCALL_CLOBBERS); \
4d76a0ec
UD
164 __o0; \
165})
166
cd2fbe58
UD
167#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \
168({ \
c261718b
AZ
169 long int _arg1 = (long int) (arg1); \
170 long int _arg2 = (long int) (arg2); \
171 long int _arg3 = (long int) (arg3); \
172 long int _arg4 = (long int) (arg4); \
173 long int _arg5 = (long int) (arg5); \
174 register long int __o0 __asm__ ("o0") = _arg1; \
175 register long int __o1 __asm__ ("o1") = _arg2; \
176 register long int __o2 __asm__ ("o2") = _arg3; \
177 register long int __o3 __asm__ ("o3") = _arg4; \
178 register long int __o4 __asm__ ("o4") = _arg5; \
179 register long int __g1 __asm__ ("g1") = __NR_clone; \
3ba57516 180 __asm __volatile (__SYSCALL_STRING : \
86c5d2cf
AZ
181 "=r" (__o0), "=r" (__o1) : \
182 "r" (__g1), "0" (__o0), "1" (__o1), \
cd2fbe58
UD
183 "r" (__o2), "r" (__o3), "r" (__o4) : \
184 __SYSCALL_CLOBBERS); \
86c5d2cf 185 if (__glibc_unlikely ((unsigned long int) (__o0) > -4096UL)) \
3ba57516 186 { \
86c5d2cf 187 __set_errno (-__o0); \
3ba57516
DM
188 __o0 = -1L; \
189 } \
190 else \
191 { \
192 __o0 &= (__o1 - 1); \
193 } \
cd2fbe58
UD
194 __o0; \
195})
196
aab39a09 197#endif /* __ASSEMBLER__ */
cd2fbe58 198
4d76a0ec 199#endif /* _LINUX_SPARC_SYSDEP_H */