1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2024 Xi Ruoyao <xry111@xry111.site>. All Rights Reserved.
5 #ifndef __ASM_VDSO_GETRANDOM_H
6 #define __ASM_VDSO_GETRANDOM_H
10 #include <asm/unistd.h>
11 #include <asm/vdso/vdso.h>
13 static __always_inline ssize_t
getrandom_syscall(void *_buffer
, size_t _len
, unsigned int _flags
)
15 register long ret
asm("a0");
16 register long nr
asm("a7") = __NR_getrandom
;
17 register void *buffer
asm("a0") = _buffer
;
18 register size_t len
asm("a1") = _len
;
19 register unsigned int flags
asm("a2") = _flags
;
24 : "r" (nr
), "r" (buffer
), "r" (len
), "r" (flags
)
25 : "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", "$t8",
31 static __always_inline
const struct vdso_rng_data
*__arch_get_vdso_rng_data(void)
33 return &_loongarch_data
.rng_data
;
36 #endif /* !__ASSEMBLY__ */
38 #endif /* __ASM_VDSO_GETRANDOM_H */