• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
2 #include "syscall_hooks.h"
3 #endif
4 
5 #define __SYSCALL_LL_E(x) (x)
6 #define __SYSCALL_LL_O(x) (x)
7 
8 #define __asm_syscall(...) do { \
9 	__asm__ __volatile__ ( "svc 0" \
10 	: "=r"(x0) : __VA_ARGS__ : "memory", "cc"); \
11 	return x0; \
12 	} while (0)
13 
__syscall0(long n)14 static inline long __syscall0(long n)
15 {
16 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
17 	if (is_syscall_hooked(n)) {
18 		return __syscall_hooks_entry0(n);
19 	}
20 #endif
21 	register long x8 __asm__("x8") = n;
22 	register long x0 __asm__("x0");
23 	__asm_syscall("r"(x8));
24 }
25 
__syscall1(long n,long a)26 static inline long __syscall1(long n, long a)
27 {
28 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
29 	if (is_syscall_hooked(n)) {
30 		return __syscall_hooks_entry1(n, a);
31 	}
32 #endif
33 	register long x8 __asm__("x8") = n;
34 	register long x0 __asm__("x0") = a;
35 	__asm_syscall("r"(x8), "0"(x0));
36 }
37 
__syscall2(long n,long a,long b)38 static inline long __syscall2(long n, long a, long b)
39 {
40 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
41 	if (is_syscall_hooked(n)) {
42 		return __syscall_hooks_entry2(n, a, b);
43 	}
44 #endif
45 	register long x8 __asm__("x8") = n;
46 	register long x0 __asm__("x0") = a;
47 	register long x1 __asm__("x1") = b;
48 	__asm_syscall("r"(x8), "0"(x0), "r"(x1));
49 }
50 
__syscall3(long n,long a,long b,long c)51 static inline long __syscall3(long n, long a, long b, long c)
52 {
53 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
54 	if (is_syscall_hooked(n)) {
55 		return __syscall_hooks_entry3(n, a, b, c);
56 	}
57 #endif
58 	register long x8 __asm__("x8") = n;
59 	register long x0 __asm__("x0") = a;
60 	register long x1 __asm__("x1") = b;
61 	register long x2 __asm__("x2") = c;
62 	__asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2));
63 }
64 
__syscall4(long n,long a,long b,long c,long d)65 static inline long __syscall4(long n, long a, long b, long c, long d)
66 {
67 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
68 	if (is_syscall_hooked(n)) {
69 		return __syscall_hooks_entry4(n, a, b, c, d);
70 	}
71 #endif
72 	register long x8 __asm__("x8") = n;
73 	register long x0 __asm__("x0") = a;
74 	register long x1 __asm__("x1") = b;
75 	register long x2 __asm__("x2") = c;
76 	register long x3 __asm__("x3") = d;
77 	__asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3));
78 }
79 
__syscall5(long n,long a,long b,long c,long d,long e)80 static inline long __syscall5(long n, long a, long b, long c, long d, long e)
81 {
82 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
83 	if (is_syscall_hooked(n)) {
84 		return __syscall_hooks_entry5(n, a, b, c, d, e);
85 	}
86 #endif
87 	register long x8 __asm__("x8") = n;
88 	register long x0 __asm__("x0") = a;
89 	register long x1 __asm__("x1") = b;
90 	register long x2 __asm__("x2") = c;
91 	register long x3 __asm__("x3") = d;
92 	register long x4 __asm__("x4") = e;
93 	__asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4));
94 }
95 
__syscall6(long n,long a,long b,long c,long d,long e,long f)96 static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
97 {
98 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
99 	if (is_syscall_hooked(n)) {
100 		return __syscall_hooks_entry6(n, a, b, c, d, e, f);
101 	}
102 #endif
103 	register long x8 __asm__("x8") = n;
104 	register long x0 __asm__("x0") = a;
105 	register long x1 __asm__("x1") = b;
106 	register long x2 __asm__("x2") = c;
107 	register long x3 __asm__("x3") = d;
108 	register long x4 __asm__("x4") = e;
109 	register long x5 __asm__("x5") = f;
110 	__asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5));
111 }
112 
113 #define VDSO_USEFUL
114 #define VDSO_CGT_SYM "__kernel_clock_gettime"
115 #define VDSO_CGT_VER "LINUX_2.6.39"
116 #if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__)
117 #define VDSO_CGR_SYM "__kernel_clock_getres"
118 #define VDSO_CGR_VER "LINUX_2.6.39"
119 #define VDSO_GTD_SYM "__kernel_gettimeofday"
120 #define VDSO_GTD_VER "LINUX_2.6.39"
121 #endif
122 
123 #define IPC_64 0
124