1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Userland implementation of getrandom() for processes
8 #include <asm/processor.h>
9 #include <asm/ppc_asm.h>
11 #include <asm/vdso_datapage.h>
12 #include <asm/asm-offsets.h>
13 #include <asm/unistd.h>
16 * The macro sets two stack frames, one for the caller and one for the callee
17 * because there are no requirement for the caller to set a stack frame when
18 * calling VDSO so it may have omitted to set one, especially on PPC64
21 .macro cvdso_call funct
23 PPC_STLU r1, -PPC_MIN_STKFRM(r1)
24 .cfi_adjust_cfa_offset PPC_MIN_STKFRM
26 PPC_STLU r1, -PPC_MIN_STKFRM(r1)
27 .cfi_adjust_cfa_offset PPC_MIN_STKFRM
28 PPC_STL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1)
29 .cfi_rel_offset lr, PPC_MIN_STKFRM + PPC_LR_STKOFF
31 PPC_STL r2, PPC_MIN_STKFRM + STK_GOT(r1)
32 .cfi_rel_offset r2, PPC_MIN_STKFRM + STK_GOT
34 bl CFUNC(DOTSYM(\funct))
35 PPC_LL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1)
37 PPC_LL r2, PPC_MIN_STKFRM + STK_GOT(r1)
42 addi r1, r1, 2 * PPC_MIN_STKFRM
54 V_FUNCTION_BEGIN(__kernel_getrandom)
55 cvdso_call __c_kernel_getrandom
56 V_FUNCTION_END(__kernel_getrandom)