24 #error "SF_USER_ERRNO not supported yet"
26 #define __sfsyscall_return(type, res) \
34 #define _sfsyscall0(type, name) \
37 __asm__ volatile("syscall" \
39 : "0"(0x2000000 | __NR_##name)); \
40 __sfsyscall_return(type, __res); \
43 #define _sfsyscall1(type, name, type1, arg1) \
44 type name(type1 arg1) { \
46 __asm__ volatile("mov %2, %%rdi\n\t" \
49 : "0"(0x2000000 | __NR_##name), "g"((long)(arg1))); \
50 __sfsyscall_return(type, __res); \
53 #define _sfsyscall2(type, name, type1, arg1, type2, arg2) \
54 type name(type1 arg1, type2 arg2) { \
56 __asm__ volatile("mov %2, %%rdi\n\t" \
60 : "0"(0x2000000 | __NR_##name), "g"((long)(arg1)), "g"((long)(arg2))); \
61 __sfsyscall_return(type, __res); \
64 #define _sfsyscall3ipi(type, name, type1, arg1, type2, arg2, type3, arg3) \
65 type name(type1 arg1, type2 arg2, type3 arg3) { \
67 __asm__ volatile("mov %4, %%rdx\n\t" \
70 : "0"(0x2000000 | __NR_##name), \
74 __sfsyscall_return(type, __res); \
77 #define _sfsyscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \
78 type name(type1 arg1, type2 arg2, type3 arg3) { \
80 __asm__ volatile("mov %2, %%rdi\n\t" \
85 : "0"(0x2000000 | __NR_##name), "g"((long)(arg1)), "g"((long)(arg2)), \
87 __sfsyscall_return(type, __res); \
90 #define _sfsyscall4(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
91 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
93 __asm__ volatile("mov %2, %%rdi\n\t" \
99 : "0"(0x2000000 | __NR_##name), "g"((long)(arg1)), "c"((long)(arg2)), \
100 "d"((long)(arg3)), "S"((long)(arg4))); \
101 __sfsyscall_return(type, __res); \
104 #define _sfsyscall5(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, \
106 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \
108 __asm__ volatile("mov %2, %%rdi\n\t" \
109 "mov %3, %%rsi\n\t" \
110 "mov %4, %%rdx\n\t" \
111 "mov %5, %%r10\n\t" \
115 : "0"(0x2000000 | __NR_##name), "g"((long)(arg1)), "g"((long)(arg2)), \
116 "g"((long)(arg3)), "g"((long)(arg4)), "g"((long)(arg5))); \
117 __sfsyscall_return(type, __res); \
120 #define _sfsyscall6(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, \
121 type5, arg5, type6, arg6) \
122 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \
124 __asm__ volatile("mov %2, %%rdi\n\t" \
125 "mov %3, %%rsi\n\t" \
126 "mov %4, %%rdx\n\t" \
127 "mov %5, %%r10\n\t" \
132 : "0"(0x2000000 | __NR_##name), "g"((long)(arg1)), "g"((long)(arg2)), \
133 "g"((long)(arg3)), "g"((long)(arg4)), "g"((long)(arg5)), \
134 "g"((long)(arg6))); \
135 __sfsyscall_return(type, __res); \