1
0

syscall_arch.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #define __SYSCALL_LL_E(x) \
  2. ((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
  3. ((union { long long ll; long l[2]; }){ .ll = x }).l[1]
  4. #define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x))
  5. static __inline long __syscall0(long n)
  6. {
  7. register unsigned long r12 __asm__("r12") = n;
  8. register unsigned long r3 __asm__("r3");
  9. __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
  10. : "r"(r12)
  11. : "memory", "r4");
  12. return r3;
  13. }
  14. static inline long __syscall1(long n, long a)
  15. {
  16. register unsigned long r12 __asm__("r12") = n;
  17. register unsigned long r3 __asm__("r3");
  18. register unsigned long r5 __asm__("r5") = a;
  19. __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
  20. : "r"(r12), "r"(r5)
  21. : "memory", "r4");
  22. return r3;
  23. }
  24. static inline long __syscall2(long n, long a, long b)
  25. {
  26. register unsigned long r12 __asm__("r12") = n;
  27. register unsigned long r3 __asm__("r3");
  28. register unsigned long r5 __asm__("r5") = a;
  29. register unsigned long r6 __asm__("r6") = b;
  30. __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
  31. : "r"(r12), "r"(r5), "r"(r6)
  32. : "memory", "r4");
  33. return r3;
  34. }
  35. static inline long __syscall3(long n, long a, long b, long c)
  36. {
  37. register unsigned long r12 __asm__("r12") = n;
  38. register unsigned long r3 __asm__("r3");
  39. register unsigned long r5 __asm__("r5") = a;
  40. register unsigned long r6 __asm__("r6") = b;
  41. register unsigned long r7 __asm__("r7") = c;
  42. __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
  43. : "r"(r12), "r"(r5), "r"(r6), "r"(r7)
  44. : "memory", "r4");
  45. return r3;
  46. }
  47. static inline long __syscall4(long n, long a, long b, long c, long d)
  48. {
  49. register unsigned long r12 __asm__("r12") = n;
  50. register unsigned long r3 __asm__("r3");
  51. register unsigned long r5 __asm__("r5") = a;
  52. register unsigned long r6 __asm__("r6") = b;
  53. register unsigned long r7 __asm__("r7") = c;
  54. register unsigned long r8 __asm__("r8") = d;
  55. __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
  56. : "r"(r12), "r"(r5), "r"(r6), "r"(r7), "r"(r8)
  57. : "memory", "r4");
  58. return r3;
  59. }
  60. static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  61. {
  62. register unsigned long r12 __asm__("r12") = n;
  63. register unsigned long r3 __asm__("r3");
  64. register unsigned long r5 __asm__("r5") = a;
  65. register unsigned long r6 __asm__("r6") = b;
  66. register unsigned long r7 __asm__("r7") = c;
  67. register unsigned long r8 __asm__("r8") = d;
  68. register unsigned long r9 __asm__("r9") = e;
  69. __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
  70. : "r"(r12), "r"(r5), "r"(r6), "r"(r7), "r"(r8), "r"(r9)
  71. : "memory", "r4");
  72. return r3;
  73. }
  74. static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  75. {
  76. register unsigned long r12 __asm__("r12") = n;
  77. register unsigned long r3 __asm__("r3");
  78. register unsigned long r5 __asm__("r5") = a;
  79. register unsigned long r6 __asm__("r6") = b;
  80. register unsigned long r7 __asm__("r7") = c;
  81. register unsigned long r8 __asm__("r8") = d;
  82. register unsigned long r9 __asm__("r9") = e;
  83. register unsigned long r10 __asm__("r10") = f;
  84. __asm__ __volatile__ ("brki r14, 0x8" : "=r"(r3)
  85. : "r"(r12), "r"(r5), "r"(r6), "r"(r7), "r"(r8), "r"(r9), "r"(r10)
  86. : "memory", "r4");
  87. return r3;
  88. }
  89. #define SYSCALL_IPC_BROKEN_MODE
  90. #undef SYS_socketcall