syscall_arch.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #define __SYSCALL_LL_E(x) (x)
  2. #define __SYSCALL_LL_O(x) (x)
  3. #define SYSCALL_RLIM_INFINITY (-1UL/2)
  4. #if __mips_isa_rev >= 6
  5. #define SYSCALL_CLOBBERLIST \
  6. "$1", "$3", "$10", "$11", "$12", "$13", \
  7. "$14", "$15", "$24", "$25", "memory"
  8. #else
  9. #define SYSCALL_CLOBBERLIST \
  10. "$1", "$3", "$10", "$11", "$12", "$13", \
  11. "$14", "$15", "$24", "$25", "hi", "lo", "memory"
  12. #endif
  13. static inline long __syscall0(long n)
  14. {
  15. register long r7 __asm__("$7");
  16. register long r2 __asm__("$2");
  17. __asm__ __volatile__ (
  18. "daddu $2,$0,%2 ; syscall"
  19. : "=&r"(r2), "=r"(r7)
  20. : "ir"(n), "0"(r2)
  21. : SYSCALL_CLOBBERLIST);
  22. return r7 && r2>0 ? -r2 : r2;
  23. }
  24. static inline long __syscall1(long n, long a)
  25. {
  26. register long r4 __asm__("$4") = a;
  27. register long r7 __asm__("$7");
  28. register long r2 __asm__("$2");
  29. __asm__ __volatile__ (
  30. "daddu $2,$0,%2 ; syscall"
  31. : "=&r"(r2), "=r"(r7)
  32. : "ir"(n), "0"(r2), "r"(r4)
  33. : SYSCALL_CLOBBERLIST);
  34. return r7 && r2>0 ? -r2 : r2;
  35. }
  36. static inline long __syscall2(long n, long a, long b)
  37. {
  38. register long r4 __asm__("$4") = a;
  39. register long r5 __asm__("$5") = b;
  40. register long r7 __asm__("$7");
  41. register long r2 __asm__("$2");
  42. __asm__ __volatile__ (
  43. "daddu $2,$0,%2 ; syscall"
  44. : "=&r"(r2), "=r"(r7)
  45. : "ir"(n), "0"(r2), "r"(r4), "r"(r5)
  46. : SYSCALL_CLOBBERLIST);
  47. return r7 && r2>0 ? -r2 : r2;
  48. }
  49. static inline long __syscall3(long n, long a, long b, long c)
  50. {
  51. register long r4 __asm__("$4") = a;
  52. register long r5 __asm__("$5") = b;
  53. register long r6 __asm__("$6") = c;
  54. register long r7 __asm__("$7");
  55. register long r2 __asm__("$2");
  56. __asm__ __volatile__ (
  57. "daddu $2,$0,%2 ; syscall"
  58. : "=&r"(r2), "=r"(r7)
  59. : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
  60. : SYSCALL_CLOBBERLIST);
  61. return r7 && r2>0 ? -r2 : r2;
  62. }
  63. static inline long __syscall4(long n, long a, long b, long c, long d)
  64. {
  65. register long r4 __asm__("$4") = a;
  66. register long r5 __asm__("$5") = b;
  67. register long r6 __asm__("$6") = c;
  68. register long r7 __asm__("$7") = d;
  69. register long r2 __asm__("$2");
  70. __asm__ __volatile__ (
  71. "daddu $2,$0,%2 ; syscall"
  72. : "=&r"(r2), "+r"(r7)
  73. : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6)
  74. : SYSCALL_CLOBBERLIST);
  75. return r7 && r2>0 ? -r2 : r2;
  76. }
  77. static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  78. {
  79. register long r4 __asm__("$4") = a;
  80. register long r5 __asm__("$5") = b;
  81. register long r6 __asm__("$6") = c;
  82. register long r7 __asm__("$7") = d;
  83. register long r8 __asm__("$8") = e;
  84. register long r2 __asm__("$2");
  85. __asm__ __volatile__ (
  86. "daddu $2,$0,%2 ; syscall"
  87. : "=&r"(r2), "+r"(r7)
  88. : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8)
  89. : SYSCALL_CLOBBERLIST);
  90. return r7 && r2>0 ? -r2 : r2;
  91. }
  92. static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  93. {
  94. register long r4 __asm__("$4") = a;
  95. register long r5 __asm__("$5") = b;
  96. register long r6 __asm__("$6") = c;
  97. register long r7 __asm__("$7") = d;
  98. register long r8 __asm__("$8") = e;
  99. register long r9 __asm__("$9") = f;
  100. register long r2 __asm__("$2");
  101. __asm__ __volatile__ (
  102. "daddu $2,$0,%2 ; syscall"
  103. : "=&r"(r2), "+r"(r7)
  104. : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9)
  105. : SYSCALL_CLOBBERLIST);
  106. return r7 && r2>0 ? -r2 : r2;
  107. }
  108. #define VDSO_USEFUL
  109. #define VDSO_CGT32_SYM "__vdso_clock_gettime"
  110. #define VDSO_CGT32_VER "LINUX_2.6"
  111. #define VDSO_CGT_SYM "__vdso_clock_gettime64"
  112. #define VDSO_CGT_VER "LINUX_2.6"
  113. #define SO_SNDTIMEO_OLD 0x1005
  114. #define SO_RCVTIMEO_OLD 0x1006