1570af302Sopenharmony_ci#define __SYSCALL_LL_E(x) (x) 2570af302Sopenharmony_ci#define __SYSCALL_LL_O(x) (x) 3570af302Sopenharmony_ci 4570af302Sopenharmony_ci#define SYSCALL_RLIM_INFINITY (-1UL/2) 5570af302Sopenharmony_ci 6570af302Sopenharmony_ci#if __mips_isa_rev >= 6 7570af302Sopenharmony_ci#define SYSCALL_CLOBBERLIST \ 8570af302Sopenharmony_ci "$1", "$3", "$10", "$11", "$12", "$13", \ 9570af302Sopenharmony_ci "$14", "$15", "$24", "$25", "memory" 10570af302Sopenharmony_ci#else 11570af302Sopenharmony_ci#define SYSCALL_CLOBBERLIST \ 12570af302Sopenharmony_ci "$1", "$3", "$10", "$11", "$12", "$13", \ 13570af302Sopenharmony_ci "$14", "$15", "$24", "$25", "hi", "lo", "memory" 14570af302Sopenharmony_ci#endif 15570af302Sopenharmony_ci 16570af302Sopenharmony_cistatic inline long __syscall0(long n) 17570af302Sopenharmony_ci{ 18570af302Sopenharmony_ci register long r7 __asm__("$7"); 19570af302Sopenharmony_ci register long r2 __asm__("$2"); 20570af302Sopenharmony_ci __asm__ __volatile__ ( 21570af302Sopenharmony_ci "daddu $2,$0,%2 ; syscall" 22570af302Sopenharmony_ci : "=&r"(r2), "=r"(r7) 23570af302Sopenharmony_ci : "ir"(n), "0"(r2) 24570af302Sopenharmony_ci : SYSCALL_CLOBBERLIST); 25570af302Sopenharmony_ci return r7 && r2>0 ? -r2 : r2; 26570af302Sopenharmony_ci} 27570af302Sopenharmony_ci 28570af302Sopenharmony_cistatic inline long __syscall1(long n, long a) 29570af302Sopenharmony_ci{ 30570af302Sopenharmony_ci register long r4 __asm__("$4") = a; 31570af302Sopenharmony_ci register long r7 __asm__("$7"); 32570af302Sopenharmony_ci register long r2 __asm__("$2"); 33570af302Sopenharmony_ci __asm__ __volatile__ ( 34570af302Sopenharmony_ci "daddu $2,$0,%2 ; syscall" 35570af302Sopenharmony_ci : "=&r"(r2), "=r"(r7) 36570af302Sopenharmony_ci : "ir"(n), "0"(r2), "r"(r4) 37570af302Sopenharmony_ci : SYSCALL_CLOBBERLIST); 38570af302Sopenharmony_ci return r7 && r2>0 ? -r2 : r2; 39570af302Sopenharmony_ci} 40570af302Sopenharmony_ci 41570af302Sopenharmony_cistatic inline long __syscall2(long n, long a, long b) 42570af302Sopenharmony_ci{ 43570af302Sopenharmony_ci register long r4 __asm__("$4") = a; 44570af302Sopenharmony_ci register long r5 __asm__("$5") = b; 45570af302Sopenharmony_ci register long r7 __asm__("$7"); 46570af302Sopenharmony_ci register long r2 __asm__("$2"); 47570af302Sopenharmony_ci 48570af302Sopenharmony_ci __asm__ __volatile__ ( 49570af302Sopenharmony_ci "daddu $2,$0,%2 ; syscall" 50570af302Sopenharmony_ci : "=&r"(r2), "=r"(r7) 51570af302Sopenharmony_ci : "ir"(n), "0"(r2), "r"(r4), "r"(r5) 52570af302Sopenharmony_ci : SYSCALL_CLOBBERLIST); 53570af302Sopenharmony_ci return r7 && r2>0 ? -r2 : r2; 54570af302Sopenharmony_ci} 55570af302Sopenharmony_ci 56570af302Sopenharmony_cistatic inline long __syscall3(long n, long a, long b, long c) 57570af302Sopenharmony_ci{ 58570af302Sopenharmony_ci register long r4 __asm__("$4") = a; 59570af302Sopenharmony_ci register long r5 __asm__("$5") = b; 60570af302Sopenharmony_ci register long r6 __asm__("$6") = c; 61570af302Sopenharmony_ci register long r7 __asm__("$7"); 62570af302Sopenharmony_ci register long r2 __asm__("$2"); 63570af302Sopenharmony_ci 64570af302Sopenharmony_ci __asm__ __volatile__ ( 65570af302Sopenharmony_ci "daddu $2,$0,%2 ; syscall" 66570af302Sopenharmony_ci : "=&r"(r2), "=r"(r7) 67570af302Sopenharmony_ci : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6) 68570af302Sopenharmony_ci : SYSCALL_CLOBBERLIST); 69570af302Sopenharmony_ci return r7 && r2>0 ? -r2 : r2; 70570af302Sopenharmony_ci} 71570af302Sopenharmony_ci 72570af302Sopenharmony_cistatic inline long __syscall4(long n, long a, long b, long c, long d) 73570af302Sopenharmony_ci{ 74570af302Sopenharmony_ci register long r4 __asm__("$4") = a; 75570af302Sopenharmony_ci register long r5 __asm__("$5") = b; 76570af302Sopenharmony_ci register long r6 __asm__("$6") = c; 77570af302Sopenharmony_ci register long r7 __asm__("$7") = d; 78570af302Sopenharmony_ci register long r2 __asm__("$2"); 79570af302Sopenharmony_ci 80570af302Sopenharmony_ci __asm__ __volatile__ ( 81570af302Sopenharmony_ci "daddu $2,$0,%2 ; syscall" 82570af302Sopenharmony_ci : "=&r"(r2), "+r"(r7) 83570af302Sopenharmony_ci : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6) 84570af302Sopenharmony_ci : SYSCALL_CLOBBERLIST); 85570af302Sopenharmony_ci return r7 && r2>0 ? -r2 : r2; 86570af302Sopenharmony_ci} 87570af302Sopenharmony_ci 88570af302Sopenharmony_cistatic inline long __syscall5(long n, long a, long b, long c, long d, long e) 89570af302Sopenharmony_ci{ 90570af302Sopenharmony_ci register long r4 __asm__("$4") = a; 91570af302Sopenharmony_ci register long r5 __asm__("$5") = b; 92570af302Sopenharmony_ci register long r6 __asm__("$6") = c; 93570af302Sopenharmony_ci register long r7 __asm__("$7") = d; 94570af302Sopenharmony_ci register long r8 __asm__("$8") = e; 95570af302Sopenharmony_ci register long r2 __asm__("$2"); 96570af302Sopenharmony_ci 97570af302Sopenharmony_ci __asm__ __volatile__ ( 98570af302Sopenharmony_ci "daddu $2,$0,%2 ; syscall" 99570af302Sopenharmony_ci : "=&r"(r2), "+r"(r7) 100570af302Sopenharmony_ci : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8) 101570af302Sopenharmony_ci : SYSCALL_CLOBBERLIST); 102570af302Sopenharmony_ci return r7 && r2>0 ? -r2 : r2; 103570af302Sopenharmony_ci} 104570af302Sopenharmony_ci 105570af302Sopenharmony_cistatic inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) 106570af302Sopenharmony_ci{ 107570af302Sopenharmony_ci register long r4 __asm__("$4") = a; 108570af302Sopenharmony_ci register long r5 __asm__("$5") = b; 109570af302Sopenharmony_ci register long r6 __asm__("$6") = c; 110570af302Sopenharmony_ci register long r7 __asm__("$7") = d; 111570af302Sopenharmony_ci register long r8 __asm__("$8") = e; 112570af302Sopenharmony_ci register long r9 __asm__("$9") = f; 113570af302Sopenharmony_ci register long r2 __asm__("$2"); 114570af302Sopenharmony_ci 115570af302Sopenharmony_ci __asm__ __volatile__ ( 116570af302Sopenharmony_ci "daddu $2,$0,%2 ; syscall" 117570af302Sopenharmony_ci : "=&r"(r2), "+r"(r7) 118570af302Sopenharmony_ci : "ir"(n), "0"(r2), "r"(r4), "r"(r5), "r"(r6), "r"(r8), "r"(r9) 119570af302Sopenharmony_ci : SYSCALL_CLOBBERLIST); 120570af302Sopenharmony_ci return r7 && r2>0 ? -r2 : r2; 121570af302Sopenharmony_ci} 122570af302Sopenharmony_ci 123570af302Sopenharmony_ci#define VDSO_USEFUL 124570af302Sopenharmony_ci#define VDSO_CGT_SYM "__vdso_clock_gettime" 125570af302Sopenharmony_ci#define VDSO_CGT_VER "LINUX_2.6" 126570af302Sopenharmony_ci 127570af302Sopenharmony_ci#define SO_SNDTIMEO_OLD 0x1005 128570af302Sopenharmony_ci#define SO_RCVTIMEO_OLD 0x1006 129