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(...) do { \
  4. __asm__ __volatile__ ( "svc 0" \
  5. : "=r"(x0) : __VA_ARGS__ : "memory", "cc"); \
  6. return x0; \
  7. } while (0)
  8. static inline long __syscall0(long n)
  9. {
  10. register long x8 __asm__("x8") = n;
  11. register long x0 __asm__("x0");
  12. __asm_syscall("r"(x8));
  13. }
  14. static inline long __syscall1(long n, long a)
  15. {
  16. register long x8 __asm__("x8") = n;
  17. register long x0 __asm__("x0") = a;
  18. __asm_syscall("r"(x8), "0"(x0));
  19. }
  20. static inline long __syscall2(long n, long a, long b)
  21. {
  22. register long x8 __asm__("x8") = n;
  23. register long x0 __asm__("x0") = a;
  24. register long x1 __asm__("x1") = b;
  25. __asm_syscall("r"(x8), "0"(x0), "r"(x1));
  26. }
  27. static inline long __syscall3(long n, long a, long b, long c)
  28. {
  29. register long x8 __asm__("x8") = n;
  30. register long x0 __asm__("x0") = a;
  31. register long x1 __asm__("x1") = b;
  32. register long x2 __asm__("x2") = c;
  33. __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2));
  34. }
  35. static inline long __syscall4(long n, long a, long b, long c, long d)
  36. {
  37. register long x8 __asm__("x8") = n;
  38. register long x0 __asm__("x0") = a;
  39. register long x1 __asm__("x1") = b;
  40. register long x2 __asm__("x2") = c;
  41. register long x3 __asm__("x3") = d;
  42. __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3));
  43. }
  44. static inline long __syscall5(long n, long a, long b, long c, long d, long e)
  45. {
  46. register long x8 __asm__("x8") = n;
  47. register long x0 __asm__("x0") = a;
  48. register long x1 __asm__("x1") = b;
  49. register long x2 __asm__("x2") = c;
  50. register long x3 __asm__("x3") = d;
  51. register long x4 __asm__("x4") = e;
  52. __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4));
  53. }
  54. static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
  55. {
  56. register long x8 __asm__("x8") = n;
  57. register long x0 __asm__("x0") = a;
  58. register long x1 __asm__("x1") = b;
  59. register long x2 __asm__("x2") = c;
  60. register long x3 __asm__("x3") = d;
  61. register long x4 __asm__("x4") = e;
  62. register long x5 __asm__("x5") = f;
  63. __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5));
  64. }
  65. #define VDSO_USEFUL
  66. #define VDSO_CGT_SYM "__kernel_clock_gettime"
  67. #define VDSO_CGT_VER "LINUX_2.6.39"
  68. #define IPC_64 0