1
0

syscall_arch.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #define __SYSCALL_LL_E(x) (x)
  2. #define __SYSCALL_LL_O(x) (x)
  3. #define SYSCALL_CLOBBERLIST \
  4. "$t0", "$t1", "$t2", "$t3", \
  5. "$t4", "$t5", "$t6", "$t7", "$t8", "memory"
  6. static inline long __syscall0(long n)
  7. {
  8. register long a7 __asm__("$a7") = n;
  9. register long a0 __asm__("$a0");
  10. __asm__ __volatile__ (
  11. "syscall 0"
  12. : "=r"(a0)
  13. : "r"(a7)
  14. : SYSCALL_CLOBBERLIST);
  15. return a0;
  16. }
  17. static inline long __syscall1(long n, long a)
  18. {
  19. register long a7 __asm__("$a7") = n;
  20. register long a0 __asm__("$a0") = a;
  21. __asm__ __volatile__ (
  22. "syscall 0"
  23. : "+r"(a0)
  24. : "r"(a7)
  25. : SYSCALL_CLOBBERLIST);
  26. return a0;
  27. }
  28. static inline long __syscall2(long n, long a, long b)
  29. {
  30. register long a7 __asm__("$a7") = n;
  31. register long a0 __asm__("$a0") = a;
  32. register long a1 __asm__("$a1") = b;
  33. __asm__ __volatile__ (
  34. "syscall 0"
  35. : "+r"(a0)
  36. : "r"(a7), "r"(a1)
  37. : SYSCALL_CLOBBERLIST);
  38. return a0;
  39. }
  40. static inline long __syscall3(long n, long a, long b, long c)
  41. {
  42. register long a7 __asm__("$a7") = n;
  43. register long a0 __asm__("$a0") = a;
  44. register long a1 __asm__("$a1") = b;
  45. register long a2 __asm__("$a2") = c;
  46. __asm__ __volatile__ (
  47. "syscall 0"
  48. : "+r"(a0)
  49. : "r"(a7), "r"(a1), "r"(a2)
  50. : SYSCALL_CLOBBERLIST);
  51. return a0;
  52. }
  53. static inline long __syscall4(long n, long a, long b, long c, long d)
  54. {
  55. register long a7 __asm__("$a7") = n;
  56. register long a0 __asm__("$a0") = a;
  57. register long a1 __asm__("$a1") = b;
  58. register long a2 __asm__("$a2") = c;
  59. register long a3 __asm__("$a3") = d;
  60. __asm__ __volatile__ (
  61. "syscall 0"
  62. : "+r"(a0)
  63. : "r"(a7), "r"(a1), "r"(a2), "r"(a3)
  64. : SYSCALL_CLOBBERLIST);
  65. return a0;
  66. }
  67. static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  68. {
  69. register long a7 __asm__("$a7") = n;
  70. register long a0 __asm__("$a0") = a;
  71. register long a1 __asm__("$a1") = b;
  72. register long a2 __asm__("$a2") = c;
  73. register long a3 __asm__("$a3") = d;
  74. register long a4 __asm__("$a4") = e;
  75. __asm__ __volatile__ (
  76. "syscall 0"
  77. : "+r"(a0)
  78. : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4)
  79. : SYSCALL_CLOBBERLIST);
  80. return a0;
  81. }
  82. static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  83. {
  84. register long a7 __asm__("$a7") = n;
  85. register long a0 __asm__("$a0") = a;
  86. register long a1 __asm__("$a1") = b;
  87. register long a2 __asm__("$a2") = c;
  88. register long a3 __asm__("$a3") = d;
  89. register long a4 __asm__("$a4") = e;
  90. register long a5 __asm__("$a5") = f;
  91. __asm__ __volatile__ (
  92. "syscall 0"
  93. : "+r"(a0)
  94. : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5)
  95. : SYSCALL_CLOBBERLIST);
  96. return a0;
  97. }
  98. static inline long __syscall7(long n, long a, long b, long c, long d, long e, long f, long g)
  99. {
  100. register long a7 __asm__("$a7") = n;
  101. register long a0 __asm__("$a0") = a;
  102. register long a1 __asm__("$a1") = b;
  103. register long a2 __asm__("$a2") = c;
  104. register long a3 __asm__("$a3") = d;
  105. register long a4 __asm__("$a4") = e;
  106. register long a5 __asm__("$a5") = f;
  107. register long a6 __asm__("$a6") = g;
  108. __asm__ __volatile__ (
  109. "syscall 0"
  110. : "+r"(a0)
  111. : "r"(a7), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(a6)
  112. : SYSCALL_CLOBBERLIST);
  113. return a0;
  114. }
  115. #define VDSO_USEFUL
  116. #define VDSO_CGT_SYM "__vdso_clock_gettime"
  117. #define VDSO_CGT_VER "LINUX_5.10"
  118. #define IPC_64 0