Re: [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation

Jason A. Donenfeld
2024-08-26T20:55:50Z

On Mon, Aug 26, 2024 at 06:10:40PM +0000, Adhemerval Zanella wrote:
> +static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsigned int flags)
> +{
> + register long int x8 asm ("x8") = __NR_getrandom;
> + register long int x0 asm ("x0") = (long int) buffer;
> + register long int x1 asm ("x1") = (long int) len;
> + register long int x2 asm ("x2") = (long int) flags;
> +
> + asm ("svc 0" : "=r"(x0) : "r"(x8), "0"(x0), "r"(x1), "r"(x2));
> +
> + return x0;
> +}

More generally, it might be best to follow the format used by
arch/arm64/include/asm/vdso/gettimeofday.h.