syscall_arch.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #define __SYSCALL_LL_E(x) (x)
  2. #define __SYSCALL_LL_O(x) (x)
  3. #define __scc(X) sizeof(1?(X):0ULL) < 8 ? (unsigned long) (X) : (long long) (X)
  4. typedef long long syscall_arg_t;
  5. static __inline long __syscall0(long long n)
  6. {
  7. unsigned long ret;
  8. __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n) : "rcx", "r11", "memory");
  9. return ret;
  10. }
  11. static __inline long __syscall1(long long n, long long a1)
  12. {
  13. unsigned long ret;
  14. __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", "r11", "memory");
  15. return ret;
  16. }
  17. static __inline long __syscall2(long long n, long long a1, long long a2)
  18. {
  19. unsigned long ret;
  20. __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2)
  21. : "rcx", "r11", "memory");
  22. return ret;
  23. }
  24. static __inline long __syscall3(long long n, long long a1, long long a2, long long a3)
  25. {
  26. unsigned long ret;
  27. __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
  28. "d"(a3) : "rcx", "r11", "memory");
  29. return ret;
  30. }
  31. static __inline long __syscall4(long long n, long long a1, long long a2, long long a3,
  32. long long a4_)
  33. {
  34. unsigned long ret;
  35. register long long a4 __asm__("r10") = a4_;
  36. __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
  37. "d"(a3), "r"(a4): "rcx", "r11", "memory");
  38. return ret;
  39. }
  40. static __inline long __syscall5(long long n, long long a1, long long a2, long long a3,
  41. long long a4_, long long a5_)
  42. {
  43. unsigned long ret;
  44. register long long a4 __asm__("r10") = a4_;
  45. register long long a5 __asm__("r8") = a5_;
  46. __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
  47. "d"(a3), "r"(a4), "r"(a5) : "rcx", "r11", "memory");
  48. return ret;
  49. }
  50. static __inline long __syscall6(long long n, long long a1, long long a2, long long a3,
  51. long long a4_, long long a5_, long long a6_)
  52. {
  53. unsigned long ret;
  54. register long long a4 __asm__("r10") = a4_;
  55. register long long a5 __asm__("r8") = a5_;
  56. register long long a6 __asm__("r9") = a6_;
  57. __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
  58. "d"(a3), "r"(a4), "r"(a5), "r"(a6) : "rcx", "r11", "memory");
  59. return ret;
  60. }
  61. #undef SYS_futimesat
  62. #define SYS_clock_gettime64 SYS_clock_gettime
  63. #define SYS_clock_settime64 SYS_clock_settime
  64. #define SYS_clock_adjtime64 SYS_clock_adjtime
  65. #define SYS_clock_nanosleep_time64 SYS_clock_nanosleep
  66. #define SYS_timer_gettime64 SYS_timer_gettime
  67. #define SYS_timer_settime64 SYS_timer_settime
  68. #define SYS_timerfd_gettime64 SYS_timerfd_gettime
  69. #define SYS_timerfd_settime64 SYS_timerfd_settime
  70. #define SYS_utimensat_time64 SYS_utimensat
  71. #define SYS_pselect6_time64 SYS_pselect6
  72. #define SYS_ppoll_time64 SYS_ppoll
  73. #define SYS_recvmmsg_time64 SYS_recvmmsg
  74. #define SYS_mq_timedsend_time64 SYS_mq_timedsend
  75. #define SYS_mq_timedreceive_time64 SYS_mq_timedreceive
  76. #define SYS_semtimedop_time64 SYS_semtimedop
  77. #define SYS_rt_sigtimedwait_time64 SYS_rt_sigtimedwait
  78. #define SYS_futex_time64 SYS_futex
  79. #define SYS_sched_rr_get_interval_time64 SYS_sched_rr_get_interval
  80. #define SYS_getrusage_time64 SYS_getrusage
  81. #define SYS_wait4_time64 SYS_wait4
  82. #define IPC_64 0