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	brasl	%r14,__s390_vdso_\func
28	lg	%r14,STACK_FRAME_OVERHEAD(%r15)
29	aghi	%r15,WRAPPER_FRAME_SIZE
30	CFI_DEF_CFA_OFFSET STACK_FRAME_OVERHEAD
31	CFI_RESTORE 15
32	br	%r14
33	CFI_ENDPROC
34	.size	__kernel_\func,.-__kernel_\func
35.endm
36
37vdso_func gettimeofday
38vdso_func clock_getres
39vdso_func clock_gettime
40vdso_func getcpu
41
42.macro vdso_syscall func,syscall
43	.globl __kernel_\func
44	.type  __kernel_\func,@function
45	__ALIGN
46__kernel_\func:
47	CFI_STARTPROC
48	svc	\syscall
49	/* Make sure we notice when a syscall returns, which shouldn't happen */
50	.word	0
51	CFI_ENDPROC
52	.size	__kernel_\func,.-__kernel_\func
53.endm
54
55vdso_syscall restart_syscall,__NR_restart_syscall
56vdso_syscall sigreturn,__NR_sigreturn
57vdso_syscall rt_sigreturn,__NR_rt_sigreturn
58