[PATCH 2/2] aarch64: Set the syscall register right before doing the syscall.
Szabolcs Nagy
szabolcs.nagy@arm.com
Tue Apr 11 15:43:53 GMT 2023
The 04/11/2023 11:15, Adhemerval Zanella Netto via Libc-alpha wrote:
> On 11/04/23 10:50, Florian Weimer via Libc-alpha wrote:
> > * 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.
>
> Is this required because compiler is free to reorganize the argument
> list? I think it should me it clear on the commit message.
>
> Using a single assembler would require two inline asm, something like:
i don't like the use of __builtin_constant_name_p here.
if we want different behaviour for INTERNAL_SYSCALL_NCS
and other inlined syscall things then we should do the
dispatch there.
and yes it has to be one asm block since the compiler
is free to add random nops (or equivalent) anywhere.
i'm not entirely sure why this change is needed, a bit
more background would be useful.
More information about the Libc-alpha
mailing list