aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-v850/unistd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-v850/unistd.h')
-rw-r--r--include/asm-v850/unistd.h160
1 files changed, 0 insertions, 160 deletions
diff --git a/include/asm-v850/unistd.h b/include/asm-v850/unistd.h
index 737401e7d3ad..2241ed45ecfe 100644
--- a/include/asm-v850/unistd.h
+++ b/include/asm-v850/unistd.h
@@ -204,168 +204,8 @@
204#define __NR_gettid 201 204#define __NR_gettid 201
205#define __NR_tkill 202 205#define __NR_tkill 202
206 206
207
208/* Syscall protocol:
209 Syscall number in r12, args in r6-r9, r13-r14
210 Return value in r10
211 Trap 0 for `short' syscalls, where all the args can fit in function
212 call argument registers, and trap 1 when there are additional args in
213 r13-r14. */
214
215#define SYSCALL_NUM "r12"
216#define SYSCALL_ARG0 "r6"
217#define SYSCALL_ARG1 "r7"
218#define SYSCALL_ARG2 "r8"
219#define SYSCALL_ARG3 "r9"
220#define SYSCALL_ARG4 "r13"
221#define SYSCALL_ARG5 "r14"
222#define SYSCALL_RET "r10"
223
224#define SYSCALL_SHORT_TRAP "0"
225#define SYSCALL_LONG_TRAP "1"
226
227/* Registers clobbered by any syscall. This _doesn't_ include the syscall
228 number (r12) or the `extended arg' registers (r13, r14), even though
229 they are actually clobbered too (this is because gcc's `asm' statement
230 doesn't allow a clobber to be used as an input or output). */
231#define SYSCALL_CLOBBERS "r1", "r5", "r11", "r15", "r16", \
232 "r17", "r18", "r19"
233
234/* Registers clobbered by a `short' syscall. This includes all clobbers
235 except the syscall number (r12). */
236#define SYSCALL_SHORT_CLOBBERS SYSCALL_CLOBBERS, "r13", "r14"
237
238#ifdef __KERNEL__ 207#ifdef __KERNEL__
239 208
240#include <asm/clinkage.h>
241#include <linux/err.h>
242
243#define __syscall_return(type, res) \
244 do { \
245 /* user-visible error numbers are in the range -1 - -MAX_ERRNO: \
246 see <asm-v850/errno.h> */ \
247 if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO), 0)) { \
248 errno = -(res); \
249 res = -1; \
250 } \
251 return (type) (res); \
252 } while (0)
253
254
255#define _syscall0(type, name) \
256type name (void) \
257{ \
258 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
259 register unsigned long __ret __asm__ (SYSCALL_RET); \
260 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
261 : "=r" (__ret), "=r" (__syscall) \
262 : "1" (__syscall) \
263 : SYSCALL_SHORT_CLOBBERS); \
264 __syscall_return (type, __ret); \
265}
266
267#define _syscall1(type, name, atype, a) \
268type name (atype a) \
269{ \
270 register atype __a __asm__ (SYSCALL_ARG0) = a; \
271 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
272 register unsigned long __ret __asm__ (SYSCALL_RET); \
273 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
274 : "=r" (__ret), "=r" (__syscall) \
275 : "1" (__syscall), "r" (__a) \
276 : SYSCALL_SHORT_CLOBBERS); \
277 __syscall_return (type, __ret); \
278}
279
280#define _syscall2(type, name, atype, a, btype, b) \
281type name (atype a, btype b) \
282{ \
283 register atype __a __asm__ (SYSCALL_ARG0) = a; \
284 register btype __b __asm__ (SYSCALL_ARG1) = b; \
285 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
286 register unsigned long __ret __asm__ (SYSCALL_RET); \
287 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
288 : "=r" (__ret), "=r" (__syscall) \
289 : "1" (__syscall), "r" (__a), "r" (__b) \
290 : SYSCALL_SHORT_CLOBBERS); \
291 __syscall_return (type, __ret); \
292}
293
294#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
295type name (atype a, btype b, ctype c) \
296{ \
297 register atype __a __asm__ (SYSCALL_ARG0) = a; \
298 register btype __b __asm__ (SYSCALL_ARG1) = b; \
299 register ctype __c __asm__ (SYSCALL_ARG2) = c; \
300 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
301 register unsigned long __ret __asm__ (SYSCALL_RET); \
302 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
303 : "=r" (__ret), "=r" (__syscall) \
304 : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c) \
305 : SYSCALL_SHORT_CLOBBERS); \
306 __syscall_return (type, __ret); \
307}
308
309#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \
310type name (atype a, btype b, ctype c, dtype d) \
311{ \
312 register atype __a __asm__ (SYSCALL_ARG0) = a; \
313 register btype __b __asm__ (SYSCALL_ARG1) = b; \
314 register ctype __c __asm__ (SYSCALL_ARG2) = c; \
315 register dtype __d __asm__ (SYSCALL_ARG3) = d; \
316 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
317 register unsigned long __ret __asm__ (SYSCALL_RET); \
318 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
319 : "=r" (__ret), "=r" (__syscall) \
320 : "1" (__syscall), \
321 "r" (__a), "r" (__b), "r" (__c), "r" (__d) \
322 : SYSCALL_SHORT_CLOBBERS); \
323 __syscall_return (type, __ret); \
324}
325
326#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype,e)\
327type name (atype a, btype b, ctype c, dtype d, etype e) \
328{ \
329 register atype __a __asm__ (SYSCALL_ARG0) = a; \
330 register btype __b __asm__ (SYSCALL_ARG1) = b; \
331 register ctype __c __asm__ (SYSCALL_ARG2) = c; \
332 register dtype __d __asm__ (SYSCALL_ARG3) = d; \
333 register etype __e __asm__ (SYSCALL_ARG4) = e; \
334 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
335 register unsigned long __ret __asm__ (SYSCALL_RET); \
336 __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
337 : "=r" (__ret), "=r" (__syscall), "=r" (__e) \
338 : "1" (__syscall), \
339 "r" (__a), "r" (__b), "r" (__c), "r" (__d), "2" (__e) \
340 : SYSCALL_CLOBBERS); \
341 __syscall_return (type, __ret); \
342}
343
344#define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f) \
345 __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
346 : "=r" (ret), "=r" (syscall), \
347 "=r" (e), "=r" (f) \
348 : "1" (syscall), \
349 "r" (a), "r" (b), "r" (c), "r" (d), \
350 "2" (e), "3" (f) \
351 : SYSCALL_CLOBBERS);
352
353#define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f) \
354type name (atype a, btype b, ctype c, dtype d, etype e, ftype f) \
355{ \
356 register atype __a __asm__ (SYSCALL_ARG0) = a; \
357 register btype __b __asm__ (SYSCALL_ARG1) = b; \
358 register ctype __c __asm__ (SYSCALL_ARG2) = c; \
359 register dtype __d __asm__ (SYSCALL_ARG3) = d; \
360 register etype __e __asm__ (SYSCALL_ARG4) = e; \
361 register etype __f __asm__ (SYSCALL_ARG5) = f; \
362 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
363 register unsigned long __ret __asm__ (SYSCALL_RET); \
364 __SYSCALL6_TRAP(__syscall, __ret, __a, __b, __c, __d, __e, __f); \
365 __syscall_return (type, __ret); \
366}
367
368
369#define __ARCH_WANT_IPC_PARSE_VERSION 209#define __ARCH_WANT_IPC_PARSE_VERSION
370#define __ARCH_WANT_OLD_READDIR 210#define __ARCH_WANT_OLD_READDIR
371#define __ARCH_WANT_STAT64 211#define __ARCH_WANT_STAT64