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