1570af302Sopenharmony_ci#define __SYSCALL_LL_E(x) \ 2570af302Sopenharmony_ci((union { long long ll; long l[2]; }){ .ll = x }).l[0], \ 3570af302Sopenharmony_ci((union { long long ll; long l[2]; }){ .ll = x }).l[1] 4570af302Sopenharmony_ci#define __SYSCALL_LL_O(x) __SYSCALL_LL_E((x)) 5570af302Sopenharmony_ci 6570af302Sopenharmony_cistatic __inline long __syscall0(long n) 7570af302Sopenharmony_ci{ 8570af302Sopenharmony_ci register unsigned long d0 __asm__("d0") = n; 9570af302Sopenharmony_ci __asm__ __volatile__ ("trap #0" : "+r"(d0) 10570af302Sopenharmony_ci : 11570af302Sopenharmony_ci : "memory"); 12570af302Sopenharmony_ci return d0; 13570af302Sopenharmony_ci} 14570af302Sopenharmony_ci 15570af302Sopenharmony_cistatic inline long __syscall1(long n, long a) 16570af302Sopenharmony_ci{ 17570af302Sopenharmony_ci register unsigned long d0 __asm__("d0") = n; 18570af302Sopenharmony_ci register unsigned long d1 __asm__("d1") = a; 19570af302Sopenharmony_ci __asm__ __volatile__ ("trap #0" : "+r"(d0) 20570af302Sopenharmony_ci : "r"(d1) 21570af302Sopenharmony_ci : "memory"); 22570af302Sopenharmony_ci return d0; 23570af302Sopenharmony_ci} 24570af302Sopenharmony_ci 25570af302Sopenharmony_cistatic inline long __syscall2(long n, long a, long b) 26570af302Sopenharmony_ci{ 27570af302Sopenharmony_ci register unsigned long d0 __asm__("d0") = n; 28570af302Sopenharmony_ci register unsigned long d1 __asm__("d1") = a; 29570af302Sopenharmony_ci register unsigned long d2 __asm__("d2") = b; 30570af302Sopenharmony_ci __asm__ __volatile__ ("trap #0" : "+r"(d0) 31570af302Sopenharmony_ci : "r"(d1), "r"(d2) 32570af302Sopenharmony_ci : "memory"); 33570af302Sopenharmony_ci return d0; 34570af302Sopenharmony_ci} 35570af302Sopenharmony_ci 36570af302Sopenharmony_cistatic inline long __syscall3(long n, long a, long b, long c) 37570af302Sopenharmony_ci{ 38570af302Sopenharmony_ci register unsigned long d0 __asm__("d0") = n; 39570af302Sopenharmony_ci register unsigned long d1 __asm__("d1") = a; 40570af302Sopenharmony_ci register unsigned long d2 __asm__("d2") = b; 41570af302Sopenharmony_ci register unsigned long d3 __asm__("d3") = c; 42570af302Sopenharmony_ci __asm__ __volatile__ ("trap #0" : "+r"(d0) 43570af302Sopenharmony_ci : "r"(d1), "r"(d2), "r"(d3) 44570af302Sopenharmony_ci : "memory"); 45570af302Sopenharmony_ci return d0; 46570af302Sopenharmony_ci} 47570af302Sopenharmony_ci 48570af302Sopenharmony_cistatic inline long __syscall4(long n, long a, long b, long c, long d) 49570af302Sopenharmony_ci{ 50570af302Sopenharmony_ci register unsigned long d0 __asm__("d0") = n; 51570af302Sopenharmony_ci register unsigned long d1 __asm__("d1") = a; 52570af302Sopenharmony_ci register unsigned long d2 __asm__("d2") = b; 53570af302Sopenharmony_ci register unsigned long d3 __asm__("d3") = c; 54570af302Sopenharmony_ci register unsigned long d4 __asm__("d4") = d; 55570af302Sopenharmony_ci __asm__ __volatile__ ("trap #0" : "+r"(d0) 56570af302Sopenharmony_ci : "r"(d1), "r"(d2), "r"(d3), "r"(d4) 57570af302Sopenharmony_ci : "memory"); 58570af302Sopenharmony_ci return d0; 59570af302Sopenharmony_ci} 60570af302Sopenharmony_ci 61570af302Sopenharmony_cistatic inline long __syscall5(long n, long a, long b, long c, long d, long e) 62570af302Sopenharmony_ci{ 63570af302Sopenharmony_ci register unsigned long d0 __asm__("d0") = n; 64570af302Sopenharmony_ci register unsigned long d1 __asm__("d1") = a; 65570af302Sopenharmony_ci register unsigned long d2 __asm__("d2") = b; 66570af302Sopenharmony_ci register unsigned long d3 __asm__("d3") = c; 67570af302Sopenharmony_ci register unsigned long d4 __asm__("d4") = d; 68570af302Sopenharmony_ci register unsigned long d5 __asm__("d5") = e; 69570af302Sopenharmony_ci __asm__ __volatile__ ("trap #0" : "+r"(d0) 70570af302Sopenharmony_ci : "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5) 71570af302Sopenharmony_ci : "memory"); 72570af302Sopenharmony_ci return d0; 73570af302Sopenharmony_ci} 74570af302Sopenharmony_ci 75570af302Sopenharmony_cistatic inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) 76570af302Sopenharmony_ci{ 77570af302Sopenharmony_ci register unsigned long d0 __asm__("d0") = n; 78570af302Sopenharmony_ci register unsigned long d1 __asm__("d1") = a; 79570af302Sopenharmony_ci register unsigned long d2 __asm__("d2") = b; 80570af302Sopenharmony_ci register unsigned long d3 __asm__("d3") = c; 81570af302Sopenharmony_ci register unsigned long d4 __asm__("d4") = d; 82570af302Sopenharmony_ci register unsigned long d5 __asm__("d5") = e; 83570af302Sopenharmony_ci register unsigned long a0 __asm__("a0") = f; 84570af302Sopenharmony_ci __asm__ __volatile__ ("trap #0" : "+r"(d0) 85570af302Sopenharmony_ci : "r"(d1), "r"(d2), "r"(d3), "r"(d4), "r"(d5), "r"(a0) 86570af302Sopenharmony_ci : "memory"); 87570af302Sopenharmony_ci return d0; 88570af302Sopenharmony_ci} 89570af302Sopenharmony_ci 90570af302Sopenharmony_ci#define SYSCALL_IPC_BROKEN_MODE 91