1
0

syscall_arch.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #define __SYSCALL_LL_E(x) (x)
  2. #define __SYSCALL_LL_O(x) (x)
  3. static inline long __syscall0(long n)
  4. {
  5. register long r0 __asm__("r0") = n;
  6. register long r3 __asm__("r3");
  7. __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
  8. : "+r"(r0), "=r"(r3)
  9. :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
  10. return r3;
  11. }
  12. static inline long __syscall1(long n, long a)
  13. {
  14. register long r0 __asm__("r0") = n;
  15. register long r3 __asm__("r3") = a;
  16. __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
  17. : "+r"(r0), "+r"(r3)
  18. :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
  19. return r3;
  20. }
  21. static inline long __syscall2(long n, long a, long b)
  22. {
  23. register long r0 __asm__("r0") = n;
  24. register long r3 __asm__("r3") = a;
  25. register long r4 __asm__("r4") = b;
  26. __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
  27. : "+r"(r0), "+r"(r3), "+r"(r4)
  28. :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
  29. return r3;
  30. }
  31. static inline long __syscall3(long n, long a, long b, long c)
  32. {
  33. register long r0 __asm__("r0") = n;
  34. register long r3 __asm__("r3") = a;
  35. register long r4 __asm__("r4") = b;
  36. register long r5 __asm__("r5") = c;
  37. __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
  38. : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)
  39. :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
  40. return r3;
  41. }
  42. static inline long __syscall4(long n, long a, long b, long c, long d)
  43. {
  44. register long r0 __asm__("r0") = n;
  45. register long r3 __asm__("r3") = a;
  46. register long r4 __asm__("r4") = b;
  47. register long r5 __asm__("r5") = c;
  48. register long r6 __asm__("r6") = d;
  49. __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
  50. : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)
  51. :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12");
  52. return r3;
  53. }
  54. static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  55. {
  56. register long r0 __asm__("r0") = n;
  57. register long r3 __asm__("r3") = a;
  58. register long r4 __asm__("r4") = b;
  59. register long r5 __asm__("r5") = c;
  60. register long r6 __asm__("r6") = d;
  61. register long r7 __asm__("r7") = e;
  62. __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
  63. : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)
  64. :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12");
  65. return r3;
  66. }
  67. static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  68. {
  69. register long r0 __asm__("r0") = n;
  70. register long r3 __asm__("r3") = a;
  71. register long r4 __asm__("r4") = b;
  72. register long r5 __asm__("r5") = c;
  73. register long r6 __asm__("r6") = d;
  74. register long r7 __asm__("r7") = e;
  75. register long r8 __asm__("r8") = f;
  76. __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
  77. : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)
  78. :: "memory", "cr0", "r9", "r10", "r11", "r12");
  79. return r3;
  80. }
  81. #define SO_RCVTIMEO_OLD 18
  82. #define SO_SNDTIMEO_OLD 19