[PATCH 2/2] aarch64: Set the syscall register right before doing the syscall.

Florian Weimer fweimer@redhat.com
Tue Apr 11 13:50:04 GMT 2023


* Joe Simmons-Talbott via Libc-alpha:

>    ({ long _sys_result;						\
>       {								\
>         LOAD_ARGS_##nr (args)					\
>         register long _x8 asm ("x8") = (name);			\
> +       if (__builtin_constant_p(name))				\
> +         asm volatile ("mov	x8, " MSTR(name) ";"		\
> +                       : /* no output */ : "i" (name) : "x8");	\
>         asm volatile ("svc	0	// syscall " # name     \
>  		     : "=r" (_x0) : "r"(_x8) ASM_ARGS_##nr : "memory");	\
>         _sys_result = _x0;					\

I think you should do this in a single assembler statement, load the
constant only once.

Thanks,
Florian



More information about the Libc-alpha mailing list