[v2,4/5] x86_64: Define __ASSUME_SYSCALL_NAMED_WORKS for Linux
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
x86_64 calling convention treats the variable arguments same as named
ones (it sets %al to the number of floating-point variable arguments but
it's simply ignored because our syscall wrappers don't take
floating-point arguments), and when each argument is an integer
not wider than 8 bytes, the ith argument is in registers %rdi, %rsi,
%rdx, %rcx, %r8, and %r9 (0 <= i < 6), or the stack slot at
(%rsp + 8 * (i - 6)) (i >= 8) no matter how many arguments are passed.
So we can define __ASSUME_SYSCALL_NAMED_WORKS to avoid unnecessary stack
stores in the syscall wrappers caused by va_start.
---
sysdeps/unix/sysv/linux/x86_64/kernel-features.h | 9 +++++++++
1 file changed, 9 insertions(+)
@@ -23,4 +23,13 @@
# define __ASSUME_WORDSIZE64_ILP32 1
#endif
+/* Define this if the calling convention for passing x named arguments and y
+ variable arguments is same as passing (x + y) named arguments, while each
+ argument is either an integer of which the width is less than or equal to
+ "long", or a pointer; and an argument can be fetched from the same register
+ or the same offset from the stack pointer no matter how many (maybe zero)
+ arguments are passed after it. It avoids useless stack stores caused by
+ usage of va_start. */
+#define __ASSUME_SYSCALL_NAMED_WORKS 1
+
#include_next <kernel-features.h>