Warning: That file was not part of the compilation database. It may have many parsing errors.

1/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
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
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, see
17 <http://www.gnu.org/licenses/>. */
18
19#ifndef _LINUX_SPARC_SYSDEP_H
20#define _LINUX_SPARC_SYSDEP_H 1
21
22#include <sysdeps/unix/sysdep.h>
23#include <sysdeps/unix/sysv/linux/sysdep.h>
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
37#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \
38 ({ \
39 long _ret = funcptr (args); \
40 err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \
41 _ret; \
42 })
43
44/* List of system calls which are supported as vsyscalls. */
45# define HAVE_CLOCK_GETTIME_VSYSCALL 1
46# define HAVE_GETTIMEOFDAY_VSYSCALL 1
47
48#undef INLINE_SYSCALL
49#define INLINE_SYSCALL(name, nr, args...) \
50({ INTERNAL_SYSCALL_DECL(err); \
51 unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args);\
52 if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \
53 { \
54 __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \
55 resultvar = (unsigned long) -1; \
56 } \
57 (long) resultvar; \
58})
59
60#undef INTERNAL_SYSCALL_DECL
61#define INTERNAL_SYSCALL_DECL(err) \
62 register long err __asm__("g1");
63
64#undef INTERNAL_SYSCALL
65#define INTERNAL_SYSCALL(name, err, nr, args...) \
66 inline_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args)
67
68#undef INTERNAL_SYSCALL_NCS
69#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
70 inline_syscall##nr(__SYSCALL_STRING, err, name, args)
71
72#undef INTERNAL_SYSCALL_ERROR_P
73#define INTERNAL_SYSCALL_ERROR_P(val, err) \
74 ((void) (val), __builtin_expect((err) != 0, 0))
75
76#undef INTERNAL_SYSCALL_ERRNO
77#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
78
79#define inline_syscall0(string,err,name,dummy...) \
80({ \
81 register long __o0 __asm__ ("o0"); \
82 err = name; \
83 __asm __volatile (string : "=r" (err), "=r" (__o0) : \
84 "0" (err) : \
85 __SYSCALL_CLOBBERS); \
86 __o0; \
87})
88
89#define inline_syscall1(string,err,name,arg1) \
90({ \
91 register long __o0 __asm__ ("o0") = (long)(arg1); \
92 err = name; \
93 __asm __volatile (string : "=r" (err), "=r" (__o0) : \
94 "0" (err), "1" (__o0) : \
95 __SYSCALL_CLOBBERS); \
96 __o0; \
97})
98
99#define inline_syscall2(string,err,name,arg1,arg2) \
100({ \
101 register long __o0 __asm__ ("o0") = (long)(arg1); \
102 register long __o1 __asm__ ("o1") = (long)(arg2); \
103 err = name; \
104 __asm __volatile (string : "=r" (err), "=r" (__o0) : \
105 "0" (err), "1" (__o0), "r" (__o1) : \
106 __SYSCALL_CLOBBERS); \
107 __o0; \
108})
109
110#define inline_syscall3(string,err,name,arg1,arg2,arg3) \
111({ \
112 register long __o0 __asm__ ("o0") = (long)(arg1); \
113 register long __o1 __asm__ ("o1") = (long)(arg2); \
114 register long __o2 __asm__ ("o2") = (long)(arg3); \
115 err = name; \
116 __asm __volatile (string : "=r" (err), "=r" (__o0) : \
117 "0" (err), "1" (__o0), "r" (__o1), \
118 "r" (__o2) : \
119 __SYSCALL_CLOBBERS); \
120 __o0; \
121})
122
123#define inline_syscall4(string,err,name,arg1,arg2,arg3,arg4) \
124({ \
125 register long __o0 __asm__ ("o0") = (long)(arg1); \
126 register long __o1 __asm__ ("o1") = (long)(arg2); \
127 register long __o2 __asm__ ("o2") = (long)(arg3); \
128 register long __o3 __asm__ ("o3") = (long)(arg4); \
129 err = name; \
130 __asm __volatile (string : "=r" (err), "=r" (__o0) : \
131 "0" (err), "1" (__o0), "r" (__o1), \
132 "r" (__o2), "r" (__o3) : \
133 __SYSCALL_CLOBBERS); \
134 __o0; \
135})
136
137#define inline_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5) \
138({ \
139 register long __o0 __asm__ ("o0") = (long)(arg1); \
140 register long __o1 __asm__ ("o1") = (long)(arg2); \
141 register long __o2 __asm__ ("o2") = (long)(arg3); \
142 register long __o3 __asm__ ("o3") = (long)(arg4); \
143 register long __o4 __asm__ ("o4") = (long)(arg5); \
144 err = name; \
145 __asm __volatile (string : "=r" (err), "=r" (__o0) : \
146 "0" (err), "1" (__o0), "r" (__o1), \
147 "r" (__o2), "r" (__o3), "r" (__o4) : \
148 __SYSCALL_CLOBBERS); \
149 __o0; \
150})
151
152#define inline_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6) \
153({ \
154 register long __o0 __asm__ ("o0") = (long)(arg1); \
155 register long __o1 __asm__ ("o1") = (long)(arg2); \
156 register long __o2 __asm__ ("o2") = (long)(arg3); \
157 register long __o3 __asm__ ("o3") = (long)(arg4); \
158 register long __o4 __asm__ ("o4") = (long)(arg5); \
159 register long __o5 __asm__ ("o5") = (long)(arg6); \
160 err = name; \
161 __asm __volatile (string : "=r" (err), "=r" (__o0) : \
162 "0" (err), "1" (__o0), "r" (__o1), \
163 "r" (__o2), "r" (__o3), "r" (__o4), \
164 "r" (__o5) : \
165 __SYSCALL_CLOBBERS); \
166 __o0; \
167})
168
169#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \
170({ \
171 register long __o0 __asm__ ("o0") = (long)(arg1); \
172 register long __o1 __asm__ ("o1") = (long)(arg2); \
173 register long __o2 __asm__ ("o2") = (long)(arg3); \
174 register long __o3 __asm__ ("o3") = (long)(arg4); \
175 register long __o4 __asm__ ("o4") = (long)(arg5); \
176 register long __g1 __asm__ ("g1") = __NR_clone; \
177 __asm __volatile (__SYSCALL_STRING : \
178 "=r" (__g1), "=r" (__o0), "=r" (__o1) : \
179 "0" (__g1), "1" (__o0), "2" (__o1), \
180 "r" (__o2), "r" (__o3), "r" (__o4) : \
181 __SYSCALL_CLOBBERS); \
182 if (INTERNAL_SYSCALL_ERROR_P (__o0, __g1)) \
183 { \
184 __set_errno (INTERNAL_SYSCALL_ERRNO (__o0, __g1)); \
185 __o0 = -1L; \
186 } \
187 else \
188 { \
189 __o0 &= (__o1 - 1); \
190 } \
191 __o0; \
192})
193
194#endif /* __ASSEMBLER__ */
195
196#endif /* _LINUX_SPARC_SYSDEP_H */
197

Warning: That file was not part of the compilation database. It may have many parsing errors.