1570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 2570af302Sopenharmony_ci#include "syscall_hooks.h" 3570af302Sopenharmony_ci#endif 4570af302Sopenharmony_ci 5570af302Sopenharmony_ci#define __SYSCALL_LL_E(x) (x) 6570af302Sopenharmony_ci#define __SYSCALL_LL_O(x) (x) 7570af302Sopenharmony_ci 8570af302Sopenharmony_ci#define __asm_syscall(...) do { \ 9570af302Sopenharmony_ci __asm__ __volatile__ ( "svc 0" \ 10570af302Sopenharmony_ci : "=r"(x0) : __VA_ARGS__ : "memory", "cc"); \ 11570af302Sopenharmony_ci return x0; \ 12570af302Sopenharmony_ci } while (0) 13570af302Sopenharmony_ci 14570af302Sopenharmony_cistatic inline long __syscall0(long n) 15570af302Sopenharmony_ci{ 16570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 17570af302Sopenharmony_ci if (is_syscall_hooked(n)) { 18570af302Sopenharmony_ci return __syscall_hooks_entry0(n); 19570af302Sopenharmony_ci } 20570af302Sopenharmony_ci#endif 21570af302Sopenharmony_ci register long x8 __asm__("x8") = n; 22570af302Sopenharmony_ci register long x0 __asm__("x0"); 23570af302Sopenharmony_ci __asm_syscall("r"(x8)); 24570af302Sopenharmony_ci} 25570af302Sopenharmony_ci 26570af302Sopenharmony_cistatic inline long __syscall1(long n, long a) 27570af302Sopenharmony_ci{ 28570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 29570af302Sopenharmony_ci if (is_syscall_hooked(n)) { 30570af302Sopenharmony_ci return __syscall_hooks_entry1(n, a); 31570af302Sopenharmony_ci } 32570af302Sopenharmony_ci#endif 33570af302Sopenharmony_ci register long x8 __asm__("x8") = n; 34570af302Sopenharmony_ci register long x0 __asm__("x0") = a; 35570af302Sopenharmony_ci __asm_syscall("r"(x8), "0"(x0)); 36570af302Sopenharmony_ci} 37570af302Sopenharmony_ci 38570af302Sopenharmony_cistatic inline long __syscall2(long n, long a, long b) 39570af302Sopenharmony_ci{ 40570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 41570af302Sopenharmony_ci if (is_syscall_hooked(n)) { 42570af302Sopenharmony_ci return __syscall_hooks_entry2(n, a, b); 43570af302Sopenharmony_ci } 44570af302Sopenharmony_ci#endif 45570af302Sopenharmony_ci register long x8 __asm__("x8") = n; 46570af302Sopenharmony_ci register long x0 __asm__("x0") = a; 47570af302Sopenharmony_ci register long x1 __asm__("x1") = b; 48570af302Sopenharmony_ci __asm_syscall("r"(x8), "0"(x0), "r"(x1)); 49570af302Sopenharmony_ci} 50570af302Sopenharmony_ci 51570af302Sopenharmony_cistatic inline long __syscall3(long n, long a, long b, long c) 52570af302Sopenharmony_ci{ 53570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 54570af302Sopenharmony_ci if (is_syscall_hooked(n)) { 55570af302Sopenharmony_ci return __syscall_hooks_entry3(n, a, b, c); 56570af302Sopenharmony_ci } 57570af302Sopenharmony_ci#endif 58570af302Sopenharmony_ci register long x8 __asm__("x8") = n; 59570af302Sopenharmony_ci register long x0 __asm__("x0") = a; 60570af302Sopenharmony_ci register long x1 __asm__("x1") = b; 61570af302Sopenharmony_ci register long x2 __asm__("x2") = c; 62570af302Sopenharmony_ci __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2)); 63570af302Sopenharmony_ci} 64570af302Sopenharmony_ci 65570af302Sopenharmony_cistatic inline long __syscall4(long n, long a, long b, long c, long d) 66570af302Sopenharmony_ci{ 67570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 68570af302Sopenharmony_ci if (is_syscall_hooked(n)) { 69570af302Sopenharmony_ci return __syscall_hooks_entry4(n, a, b, c, d); 70570af302Sopenharmony_ci } 71570af302Sopenharmony_ci#endif 72570af302Sopenharmony_ci register long x8 __asm__("x8") = n; 73570af302Sopenharmony_ci register long x0 __asm__("x0") = a; 74570af302Sopenharmony_ci register long x1 __asm__("x1") = b; 75570af302Sopenharmony_ci register long x2 __asm__("x2") = c; 76570af302Sopenharmony_ci register long x3 __asm__("x3") = d; 77570af302Sopenharmony_ci __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3)); 78570af302Sopenharmony_ci} 79570af302Sopenharmony_ci 80570af302Sopenharmony_cistatic inline long __syscall5(long n, long a, long b, long c, long d, long e) 81570af302Sopenharmony_ci{ 82570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 83570af302Sopenharmony_ci if (is_syscall_hooked(n)) { 84570af302Sopenharmony_ci return __syscall_hooks_entry5(n, a, b, c, d, e); 85570af302Sopenharmony_ci } 86570af302Sopenharmony_ci#endif 87570af302Sopenharmony_ci register long x8 __asm__("x8") = n; 88570af302Sopenharmony_ci register long x0 __asm__("x0") = a; 89570af302Sopenharmony_ci register long x1 __asm__("x1") = b; 90570af302Sopenharmony_ci register long x2 __asm__("x2") = c; 91570af302Sopenharmony_ci register long x3 __asm__("x3") = d; 92570af302Sopenharmony_ci register long x4 __asm__("x4") = e; 93570af302Sopenharmony_ci __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4)); 94570af302Sopenharmony_ci} 95570af302Sopenharmony_ci 96570af302Sopenharmony_cistatic inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) 97570af302Sopenharmony_ci{ 98570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 99570af302Sopenharmony_ci if (is_syscall_hooked(n)) { 100570af302Sopenharmony_ci return __syscall_hooks_entry6(n, a, b, c, d, e, f); 101570af302Sopenharmony_ci } 102570af302Sopenharmony_ci#endif 103570af302Sopenharmony_ci register long x8 __asm__("x8") = n; 104570af302Sopenharmony_ci register long x0 __asm__("x0") = a; 105570af302Sopenharmony_ci register long x1 __asm__("x1") = b; 106570af302Sopenharmony_ci register long x2 __asm__("x2") = c; 107570af302Sopenharmony_ci register long x3 __asm__("x3") = d; 108570af302Sopenharmony_ci register long x4 __asm__("x4") = e; 109570af302Sopenharmony_ci register long x5 __asm__("x5") = f; 110570af302Sopenharmony_ci __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5)); 111570af302Sopenharmony_ci} 112570af302Sopenharmony_ci 113570af302Sopenharmony_ci#define VDSO_USEFUL 114570af302Sopenharmony_ci#define VDSO_CGT_SYM "__kernel_clock_gettime" 115570af302Sopenharmony_ci#define VDSO_CGT_VER "LINUX_2.6.39" 116570af302Sopenharmony_ci#if !defined(__LITEOS__) && !defined(__HISPARK_LINUX__) 117570af302Sopenharmony_ci#define VDSO_CGR_SYM "__kernel_clock_getres" 118570af302Sopenharmony_ci#define VDSO_CGR_VER "LINUX_2.6.39" 119570af302Sopenharmony_ci#define VDSO_GTD_SYM "__kernel_gettimeofday" 120570af302Sopenharmony_ci#define VDSO_GTD_VER "LINUX_2.6.39" 121570af302Sopenharmony_ci#endif 122570af302Sopenharmony_ci 123570af302Sopenharmony_ci#define IPC_64 0 124