Support six-argument syscalls from C for 32-bit x86, use generic lowlevellock-futex.h (bug 18138)

Richard Henderson rth@twiddle.net
Mon Mar 23 17:37:00 GMT 2015


On 03/20/2015 05:28 PM, Joseph Myers wrote:
> +#define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3,		\
> +				arg4, arg5, arg6)			\
> +  struct libc_do_syscall_args _xv =					\
> +    {									\
> +      (int) (arg1),							\
> +      (int) (arg5),							\
> +      (int) (arg6)							\
> +    };									\
> +    asm volatile (							\
> +    "movl %1, %%eax\n\t"						\
> +    "call __libc_do_syscall"						\
> +    : "=a" (resultvar)							\
> +    : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
> +    : "memory", "cc")

Is this really so much better than

extern int __attribute__((regcall(3))) attribute_hidden
__libc_do_syscall(int nr_eax, int arg3_edx, int arg2_ecx, int arg1_ebx,
                  int arg4_esi, int arg5_edi, int arg6_ebp);

and performing the call itself in C?  It's only one more register you need to
read from the stack in the function, but it avoids the compiler seeing a leaked
pointer to the caller's stack frame.  The later could well influence
optimization negatively.


r~



More information about the Libc-alpha mailing list