summaryrefslogtreecommitdiff
path: root/arch/powerpc/include/asm/vdso/getrandom.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/vdso/getrandom.h')
-rw-r--r--arch/powerpc/include/asm/vdso/getrandom.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/vdso/getrandom.h b/arch/powerpc/include/asm/vdso/getrandom.h
index 501d6bb14e8a..80ce0709725e 100644
--- a/arch/powerpc/include/asm/vdso/getrandom.h
+++ b/arch/powerpc/include/asm/vdso/getrandom.h
@@ -7,6 +7,8 @@
#ifndef __ASSEMBLY__
+#include <asm/vdso_datapage.h>
+
static __always_inline int do_syscall_3(const unsigned long _r0, const unsigned long _r3,
const unsigned long _r4, const unsigned long _r5)
{
@@ -43,11 +45,21 @@ static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsig
static __always_inline struct vdso_rng_data *__arch_get_vdso_rng_data(void)
{
- return NULL;
+ struct vdso_arch_data *data;
+
+ asm (
+ " bcl 20, 31, .+4 ;"
+ "0: mflr %0 ;"
+ " addis %0, %0, (_vdso_datapage - 0b)@ha ;"
+ " addi %0, %0, (_vdso_datapage - 0b)@l ;"
+ : "=r" (data) : : "lr"
+ );
+
+ return &data->rng_data;
}
ssize_t __c_kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state,
- size_t opaque_len, const struct vdso_rng_data *vd);
+ size_t opaque_len);
#endif /* !__ASSEMBLY__ */