Lines Matching +full:num +full:- +full:sources
1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
4 * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
18 * - WARNING! there's always a delayed slot!
19 * - WARNING again, the syntax is different, registers take a '$' and numbers
21 * - registers are 32-bit
22 * - stack is 8-byte aligned
23 * - syscall number is passed in v0 (starts at 0xfa0).
24 * - arguments are in a0, a1, a2, a3, then the stack. The caller needs to
26 * - Many registers are clobbered, in fact only a0..a2 and s0..s8 are
27 * preserved. See: https://www.linux-mips.org/wiki/Syscall as well as
28 * scall32-o32.S in the kernel sources.
29 * - the system call is performed by calling "syscall"
30 * - syscall return comes in v0, and register a3 needs to be checked to know
32 * - the arguments are cast to long and assigned into the target registers
41 #define my_syscall0(num) \ argument
43 register long _num __asm__ ("v0") = (num); \
47 "addiu $sp, $sp, -32\n" \
54 _arg4 ? -_num : _num; \
57 #define my_syscall1(num, arg1) \ argument
59 register long _num __asm__ ("v0") = (num); \
64 "addiu $sp, $sp, -32\n" \
72 _arg4 ? -_num : _num; \
75 #define my_syscall2(num, arg1, arg2) \ argument
77 register long _num __asm__ ("v0") = (num); \
83 "addiu $sp, $sp, -32\n" \
91 _arg4 ? -_num : _num; \
94 #define my_syscall3(num, arg1, arg2, arg3) \ argument
96 register long _num __asm__ ("v0") = (num); \
103 "addiu $sp, $sp, -32\n" \
111 _arg4 ? -_num : _num; \
114 #define my_syscall4(num, arg1, arg2, arg3, arg4) \ argument
116 register long _num __asm__ ("v0") = (num); \
123 "addiu $sp, $sp, -32\n" \
131 _arg4 ? -_num : _num; \
134 #define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ argument
136 register long _num __asm__ ("v0") = (num); \
144 "addiu $sp, $sp, -32\n" \
153 _arg4 ? -_num : _num; \
156 #define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \ argument
158 register long _num __asm__ ("v0") = (num); \
167 "addiu $sp, $sp, -32\n" \
178 _arg4 ? -_num : _num; \
192 "addiu $sp, $sp, -4\n" /* space for .cprestore to store $gp */ in __start()
194 "li $t0, -8\n" in __start()
195 "and $sp, $sp, $t0\n" /* $sp must be 8-byte aligned */ in __start()
196 "addiu $sp, $sp, -16\n" /* the callee expects to save a0..a3 there */ in __start()