aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh/unistd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sh/unistd.h')
-rw-r--r--include/asm-sh/unistd.h124
1 files changed, 4 insertions, 120 deletions
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index f1a0cbc966be..f982073dc6c6 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -324,130 +324,14 @@
324#define __NR_sync_file_range 314 324#define __NR_sync_file_range 314
325#define __NR_tee 315 325#define __NR_tee 315
326#define __NR_vmsplice 316 326#define __NR_vmsplice 316
327#define __NR_move_pages 317
328#define __NR_getcpu 318
329#define __NR_epoll_pwait 319
327 330
328#define NR_syscalls 317 331#define NR_syscalls 320
329 332
330#ifdef __KERNEL__ 333#ifdef __KERNEL__
331 334
332#include <linux/err.h>
333
334/* user-visible error numbers are in the range -1 - -MAX_ERRNO:
335 * see <asm-sh/errno.h> */
336
337#define __syscall_return(type, res) \
338do { \
339 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
340 /* Avoid using "res" which is declared to be in register r0; \
341 errno might expand to a function call and clobber it. */ \
342 int __err = -(res); \
343 errno = __err; \
344 res = -1; \
345 } \
346 return (type) (res); \
347} while (0)
348
349/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
350#define _syscall0(type,name) \
351type name(void) \
352{ \
353register long __sc0 __asm__ ("r3") = __NR_##name; \
354__asm__ __volatile__ ("trapa #0x10" \
355 : "=z" (__sc0) \
356 : "0" (__sc0) \
357 : "memory" ); \
358__syscall_return(type,__sc0); \
359}
360
361#define _syscall1(type,name,type1,arg1) \
362type name(type1 arg1) \
363{ \
364register long __sc0 __asm__ ("r3") = __NR_##name; \
365register long __sc4 __asm__ ("r4") = (long) arg1; \
366__asm__ __volatile__ ("trapa #0x11" \
367 : "=z" (__sc0) \
368 : "0" (__sc0), "r" (__sc4) \
369 : "memory"); \
370__syscall_return(type,__sc0); \
371}
372
373#define _syscall2(type,name,type1,arg1,type2,arg2) \
374type name(type1 arg1,type2 arg2) \
375{ \
376register long __sc0 __asm__ ("r3") = __NR_##name; \
377register long __sc4 __asm__ ("r4") = (long) arg1; \
378register long __sc5 __asm__ ("r5") = (long) arg2; \
379__asm__ __volatile__ ("trapa #0x12" \
380 : "=z" (__sc0) \
381 : "0" (__sc0), "r" (__sc4), "r" (__sc5) \
382 : "memory"); \
383__syscall_return(type,__sc0); \
384}
385
386#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
387type name(type1 arg1,type2 arg2,type3 arg3) \
388{ \
389register long __sc0 __asm__ ("r3") = __NR_##name; \
390register long __sc4 __asm__ ("r4") = (long) arg1; \
391register long __sc5 __asm__ ("r5") = (long) arg2; \
392register long __sc6 __asm__ ("r6") = (long) arg3; \
393__asm__ __volatile__ ("trapa #0x13" \
394 : "=z" (__sc0) \
395 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \
396 : "memory"); \
397__syscall_return(type,__sc0); \
398}
399
400#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
401type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
402{ \
403register long __sc0 __asm__ ("r3") = __NR_##name; \
404register long __sc4 __asm__ ("r4") = (long) arg1; \
405register long __sc5 __asm__ ("r5") = (long) arg2; \
406register long __sc6 __asm__ ("r6") = (long) arg3; \
407register long __sc7 __asm__ ("r7") = (long) arg4; \
408__asm__ __volatile__ ("trapa #0x14" \
409 : "=z" (__sc0) \
410 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \
411 "r" (__sc7) \
412 : "memory" ); \
413__syscall_return(type,__sc0); \
414}
415
416#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
417type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
418{ \
419register long __sc3 __asm__ ("r3") = __NR_##name; \
420register long __sc4 __asm__ ("r4") = (long) arg1; \
421register long __sc5 __asm__ ("r5") = (long) arg2; \
422register long __sc6 __asm__ ("r6") = (long) arg3; \
423register long __sc7 __asm__ ("r7") = (long) arg4; \
424register long __sc0 __asm__ ("r0") = (long) arg5; \
425__asm__ __volatile__ ("trapa #0x15" \
426 : "=z" (__sc0) \
427 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
428 "r" (__sc3) \
429 : "memory" ); \
430__syscall_return(type,__sc0); \
431}
432
433#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
434type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
435{ \
436register long __sc3 __asm__ ("r3") = __NR_##name; \
437register long __sc4 __asm__ ("r4") = (long) arg1; \
438register long __sc5 __asm__ ("r5") = (long) arg2; \
439register long __sc6 __asm__ ("r6") = (long) arg3; \
440register long __sc7 __asm__ ("r7") = (long) arg4; \
441register long __sc0 __asm__ ("r0") = (long) arg5; \
442register long __sc1 __asm__ ("r1") = (long) arg6; \
443__asm__ __volatile__ ("trapa #0x16" \
444 : "=z" (__sc0) \
445 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
446 "r" (__sc3), "r" (__sc1) \
447 : "memory" ); \
448__syscall_return(type,__sc0); \
449}
450
451#define __ARCH_WANT_IPC_PARSE_VERSION 335#define __ARCH_WANT_IPC_PARSE_VERSION
452#define __ARCH_WANT_OLD_READDIR 336#define __ARCH_WANT_OLD_READDIR
453#define __ARCH_WANT_OLD_STAT 337#define __ARCH_WANT_OLD_STAT