syscalls.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _BITS_SYSCALLS_H
  2. #define _BITS_SYSCALLS_H
  3. #ifndef _SYSCALL_H
  4. # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
  5. #endif
  6. #ifndef __ASSEMBLER__
  7. #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
  8. (__extension__ \
  9. ({ \
  10. long __res; \
  11. __asm__ __volatile__ ( \
  12. "excpt 0;\n\t" \
  13. : "=q0" (__res) \
  14. : "qA" (name) ASMFMT_##nr(args) \
  15. : "memory","CC"); \
  16. __res; \
  17. }) \
  18. )
  19. #define ASMFMT_0()
  20. #define ASMFMT_1(arg1) \
  21. , "q0" ((long)(arg1))
  22. #define ASMFMT_2(arg1, arg2) \
  23. ASMFMT_1(arg1) \
  24. , "q1" ((long)(arg2))
  25. #define ASMFMT_3(arg1, arg2, arg3) \
  26. ASMFMT_2(arg1, arg2) \
  27. , "q2" ((long)(arg3))
  28. #define ASMFMT_4(arg1, arg2, arg3, arg4) \
  29. ASMFMT_3(arg1, arg2, arg3) \
  30. , "q3" ((long)(arg4))
  31. #define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
  32. ASMFMT_4(arg1, arg2, arg3, arg4) \
  33. , "q4" ((long)(arg5))
  34. #define ASMFMT_6(arg1, arg2, arg3, arg4, arg5, arg6) \
  35. ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
  36. , "q5" ((long)(arg6))
  37. #endif /* __ASSEMBLER__ */
  38. #endif /* _BITS_SYSCALLS_H */