syscalls.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. ({ \
  9. long __res; \
  10. __asm__ __volatile__ ( \
  11. "excpt 0;\n\t" \
  12. : "=q0" (__res) \
  13. : "qA" (name) ASMFMT_##nr(args) \
  14. : "memory","CC"); \
  15. __res; \
  16. })
  17. #define ASMFMT_0()
  18. #define ASMFMT_1(arg1) \
  19. , "q0" ((long)(arg1))
  20. #define ASMFMT_2(arg1, arg2) \
  21. ASMFMT_1(arg1) \
  22. , "q1" ((long)(arg2))
  23. #define ASMFMT_3(arg1, arg2, arg3) \
  24. ASMFMT_2(arg1, arg2) \
  25. , "q2" ((long)(arg3))
  26. #define ASMFMT_4(arg1, arg2, arg3, arg4) \
  27. ASMFMT_3(arg1, arg2, arg3) \
  28. , "q3" ((long)(arg4))
  29. #define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
  30. ASMFMT_4(arg1, arg2, arg3, arg4) \
  31. , "q4" ((long)(arg5))
  32. #define ASMFMT_6(arg1, arg2, arg3, arg4, arg5, arg6) \
  33. ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
  34. , "q5" ((long)(arg6))
  35. #endif /* __ASSEMBLER__ */
  36. #endif /* _BITS_SYSCALLS_H */