Message ID | 20230325140815.4170296-6-xry111@xry111.site |
---|---|
State | New |
Headers | show |
Series | linux: Avoid va_list for generic syscall wrappers if possible | expand |
On 25/03/23 11:08, Xi Ruoyao wrote: > AAPCS treats the variable arguments same as named ones, and when each > argument is an integer not wider than 8 bytes, the ith argument is in > register xi (0 <= i < 8), or the stack slot at (sp + 8 * (i - 8)) > (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. This triggered a build failure on i686 patchwork buildbot [1]. [1] https://www.delorie.com/trybots/32bit/18431/ > --- > sysdeps/unix/sysv/linux/aarch64/kernel-features.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel-features.h b/sysdeps/unix/sysv/linux/aarch64/kernel-features.h > index 3546f6de96..c39ff39da2 100644 > --- a/sysdeps/unix/sysv/linux/aarch64/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/aarch64/kernel-features.h > @@ -21,3 +21,12 @@ > > #undef __ASSUME_CLONE_DEFAULT > #define __ASSUME_CLONE_BACKWARDS 1 > + > +/* 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
On Mon, 2023-03-27 at 10:06 -0300, Adhemerval Zanella Netto wrote: > > > On 25/03/23 11:08, Xi Ruoyao wrote: > > AAPCS treats the variable arguments same as named ones, and when > > each > > argument is an integer not wider than 8 bytes, the ith argument is > > in > > register xi (0 <= i < 8), or the stack slot at (sp + 8 * (i - 8)) > > (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. > > This triggered a build failure on i686 patchwork buildbot [1]. Ouch, misused #if as #ifdef. Will fix and submit v3. > > [1] https://www.delorie.com/trybots/32bit/18431/ > > > --- > > sysdeps/unix/sysv/linux/aarch64/kernel-features.h | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel-features.h > > b/sysdeps/unix/sysv/linux/aarch64/kernel-features.h > > index 3546f6de96..c39ff39da2 100644 > > --- a/sysdeps/unix/sysv/linux/aarch64/kernel-features.h > > +++ b/sysdeps/unix/sysv/linux/aarch64/kernel-features.h > > @@ -21,3 +21,12 @@ > > > > #undef __ASSUME_CLONE_DEFAULT > > #define __ASSUME_CLONE_BACKWARDS 1 > > + > > +/* 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
diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel-features.h b/sysdeps/unix/sysv/linux/aarch64/kernel-features.h index 3546f6de96..c39ff39da2 100644 --- a/sysdeps/unix/sysv/linux/aarch64/kernel-features.h +++ b/sysdeps/unix/sysv/linux/aarch64/kernel-features.h @@ -21,3 +21,12 @@ #undef __ASSUME_CLONE_DEFAULT #define __ASSUME_CLONE_BACKWARDS 1 + +/* 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