syscall_arch.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #define __SYSCALL_LL_E(x) (x)
  2. #define __SYSCALL_LL_O(x) (x)
  3. #define __asm_syscall(...) \
  4. __asm__ __volatile__ ("ecall\n\t" \
  5. : "=r"(a0) : __VA_ARGS__ : "memory"); \
  6. return a0; \
  7. static inline long __syscall0(long n)
  8. {
  9. register long a7 __asm__("a7") = n;
  10. register long a0 __asm__("a0");
  11. __asm_syscall("r"(a7))
  12. }
  13. static inline long __syscall1(long n, long a)
  14. {
  15. register long a7 __asm__("a7") = n;
  16. register long a0 __asm__("a0") = a;
  17. __asm_syscall("r"(a7), "0"(a0))
  18. }
  19. static inline long __syscall2(long n, long a, long b)
  20. {
  21. register long a7 __asm__("a7") = n;
  22. register long a0 __asm__("a0") = a;
  23. register long a1 __asm__("a1") = b;
  24. __asm_syscall("r"(a7), "0"(a0), "r"(a1))
  25. }
  26. static inline long __syscall3(long n, long a, long b, long c)
  27. {
  28. register long a7 __asm__("a7") = n;
  29. register long a0 __asm__("a0") = a;
  30. register long a1 __asm__("a1") = b;
  31. register long a2 __asm__("a2") = c;
  32. __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2))
  33. }
  34. static inline long __syscall4(long n, long a, long b, long c, long d)
  35. {
  36. register long a7 __asm__("a7") = n;
  37. register long a0 __asm__("a0") = a;
  38. register long a1 __asm__("a1") = b;
  39. register long a2 __asm__("a2") = c;
  40. register long a3 __asm__("a3") = d;
  41. __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3))
  42. }
  43. static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  44. {
  45. register long a7 __asm__("a7") = n;
  46. register long a0 __asm__("a0") = a;
  47. register long a1 __asm__("a1") = b;
  48. register long a2 __asm__("a2") = c;
  49. register long a3 __asm__("a3") = d;
  50. register long a4 __asm__("a4") = e;
  51. __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4))
  52. }
  53. static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  54. {
  55. register long a7 __asm__("a7") = n;
  56. register long a0 __asm__("a0") = a;
  57. register long a1 __asm__("a1") = b;
  58. register long a2 __asm__("a2") = c;
  59. register long a3 __asm__("a3") = d;
  60. register long a4 __asm__("a4") = e;
  61. register long a5 __asm__("a5") = f;
  62. __asm_syscall("r"(a7), "0"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5))
  63. }
  64. #define VDSO_USEFUL
  65. /* We don't have a clock_gettime function.
  66. #define VDSO_CGT_SYM "__vdso_clock_gettime"
  67. #define VDSO_CGT_VER "LINUX_2.6" */
  68. #define IPC_64 0