1
0

syscall_arch.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 d0 __asm__("d0") = n;
  8. __asm__ __volatile__ ("trap #0" : "+r"(d0)
  9. :
  10. : "memory");
  11. return d0;
  12. }
  13. static inline long __syscall1(long n, long a)
  14. {
  15. register unsigned long d0 __asm__("d0") = n;
  16. register unsigned long d1 __asm__("d1") = a;
  17. __asm__ __volatile__ ("trap #0" : "+r"(d0)
  18. : "r"(d1)
  19. : "memory");
  20. return d0;
  21. }
  22. static inline long __syscall2(long n, long a, long b)
  23. {
  24. register unsigned long d0 __asm__("d0") = n;
  25. register unsigned long d1 __asm__("d1") = a;
  26. register unsigned long d2 __asm__("d2") = b;
  27. __asm__ __volatile__ ("trap #0" : "+r"(d0)
  28. : "r"(d1), "r"(d2)
  29. : "memory");
  30. return d0;
  31. }
  32. static inline long __syscall3(long n, long a, long b, long c)
  33. {
  34. register unsigned long d0 __asm__("d0") = n;
  35. register unsigned long d1 __asm__("d1") = a;
  36. register unsigned long d2 __asm__("d2") = b;
  37. register unsigned long d3 __asm__("d3") = c;
  38. __asm__ __volatile__ ("trap #0" : "+r"(d0)
  39. : "r"(d1), "r"(d2), "r"(d3)
  40. : "memory");
  41. return d0;
  42. }
  43. static inline long __syscall4(long n, long a, long b, long c, long d)
  44. {
  45. register unsigned long d0 __asm__("d0") = n;
  46. register unsigned long d1 __asm__("d1") = a;
  47. register unsigned long d2 __asm__("d2") = b;
  48. register unsigned long d3 __asm__("d3") = c;
  49. register unsigned long d4 __asm__("d4") = d;
  50. __asm__ __volatile__ ("trap #0" : "+r"(d0)
  51. : "r"(d1), "r"(d2), "r"(d3), "r"(d4)
  52. : "memory");
  53. return d0;
  54. }
  55. static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  56. {
  57. register unsigned long d0 __asm__("d0") = n;
  58. register unsigned long d1 __asm__("d1") = a;
  59. register unsigned long d2 __asm__("d2") = b;
  60. register unsigned long d3 __asm__("d3") = c;
  61. register unsigned long d4 __asm__("d4") = d;
  62. register unsigned long d5 __asm__("d5") = e;
  63. __asm__ __volatile__ ("trap #0" : "+r"(d0)
  64. : "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5)
  65. : "memory");
  66. return d0;
  67. }
  68. static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  69. {
  70. register unsigned long d0 __asm__("d0") = n;
  71. register unsigned long d1 __asm__("d1") = a;
  72. register unsigned long d2 __asm__("d2") = b;
  73. register unsigned long d3 __asm__("d3") = c;
  74. register unsigned long d4 __asm__("d4") = d;
  75. register unsigned long d5 __asm__("d5") = e;
  76. register unsigned long a0 __asm__("a0") = f;
  77. __asm__ __volatile__ ("trap #0" : "+r"(d0)
  78. : "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5), "r"(a0)
  79. : "memory");
  80. return d0;
  81. }
  82. #define SYSCALL_IPC_BROKEN_MODE