2
0

syscall_arch.h 2.9 KB

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