1/* SPDX-License-Identifier: GPL-2.0 */
2#include <linux/linkage.h>
3#include <asm/vdso.h>
4#include <asm/unistd.h>
5#include <asm/asm-offsets.h>
6#include <asm/dwarf.h>
7#include <asm/ptrace.h>
8
9#define WRAPPER_FRAME_SIZE (STACK_FRAME_OVERHEAD+8)
10
11/*
12 * Older glibc version called vdso without allocating a stackframe. This wrapper
13 * is just used to allocate a stackframe. See
14 * https://sourceware.org/git/?p=glibc.git;a=commit;h=478593e6374f3818da39332260dc453cb19cfa1e
15 * for details.
16 */
17.macro vdso_func func
18	.globl __kernel_\func
19	.type  __kernel_\func,@function
20	__ALIGN
21__kernel_\func:
22	CFI_STARTPROC
23	aghi	%r15,-WRAPPER_FRAME_SIZE
24	CFI_DEF_CFA_OFFSET (STACK_FRAME_OVERHEAD + WRAPPER_FRAME_SIZE)
25	CFI_VAL_OFFSET 15, -STACK_FRAME_OVERHEAD
26	stg	%r14,STACK_FRAME_OVERHEAD(%r15)
27	CFI_REL_OFFSET 14, STACK_FRAME_OVERHEAD
28	brasl	%r14,__s390_vdso_\func
29	lg	%r14,STACK_FRAME_OVERHEAD(%r15)
30	CFI_RESTORE 14
31	aghi	%r15,WRAPPER_FRAME_SIZE
32	CFI_DEF_CFA_OFFSET STACK_FRAME_OVERHEAD
33	CFI_RESTORE 15
34	br	%r14
35	CFI_ENDPROC
36	.size	__kernel_\func,.-__kernel_\func
37.endm
38
39vdso_func gettimeofday
40vdso_func clock_getres
41vdso_func clock_gettime
42vdso_func getcpu
43
44.macro vdso_syscall func,syscall
45	.globl __kernel_\func
46	.type  __kernel_\func,@function
47	__ALIGN
48__kernel_\func:
49	CFI_STARTPROC
50	svc	\syscall
51	/* Make sure we notice when a syscall returns, which shouldn't happen */
52	.word	0
53	CFI_ENDPROC
54	.size	__kernel_\func,.-__kernel_\func
55.endm
56
57vdso_syscall restart_syscall,__NR_restart_syscall
58vdso_syscall sigreturn,__NR_sigreturn
59vdso_syscall rt_sigreturn,__NR_rt_sigreturn
60