xref: /linux/arch/s390/kernel/vdso64/vdso_user_wrapper.S (revision 001821b0e79716c4e17c71d8e053a23599a7a508)
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/*
10 * Older glibc version called vdso without allocating a stackframe. This wrapper
11 * is just used to allocate a stackframe. See
12 * https://sourceware.org/git/?p=glibc.git;a=commit;h=478593e6374f3818da39332260dc453cb19cfa1e
13 * for details.
14 */
15.macro vdso_func func
16	.globl __kernel_\func
17	.type  __kernel_\func,@function
18	__ALIGN
19__kernel_\func:
20	CFI_STARTPROC
21	aghi	%r15,-STACK_FRAME_VDSO_OVERHEAD
22	CFI_DEF_CFA_OFFSET (STACK_FRAME_USER_OVERHEAD + STACK_FRAME_VDSO_OVERHEAD)
23	CFI_VAL_OFFSET 15,-STACK_FRAME_USER_OVERHEAD
24	stg	%r14,__SFVDSO_RETURN_ADDRESS(%r15)
25	CFI_REL_OFFSET 14,__SFVDSO_RETURN_ADDRESS
26	xc	__SFUSER_BACKCHAIN(8,%r15),__SFUSER_BACKCHAIN(%r15)
27	brasl	%r14,__s390_vdso_\func
28	lg	%r14,__SFVDSO_RETURN_ADDRESS(%r15)
29	CFI_RESTORE 14
30	aghi	%r15,STACK_FRAME_VDSO_OVERHEAD
31	CFI_DEF_CFA_OFFSET STACK_FRAME_USER_OVERHEAD
32	CFI_RESTORE 15
33	br	%r14
34	CFI_ENDPROC
35	.size	__kernel_\func,.-__kernel_\func
36.endm
37
38vdso_func gettimeofday
39vdso_func clock_getres
40vdso_func clock_gettime
41vdso_func getcpu
42
43.macro vdso_syscall func,syscall
44	.globl __kernel_\func
45	.type  __kernel_\func,@function
46	__ALIGN
47__kernel_\func:
48	CFI_STARTPROC
49	svc	\syscall
50	/* Make sure we notice when a syscall returns, which shouldn't happen */
51	.word	0
52	CFI_ENDPROC
53	.size	__kernel_\func,.-__kernel_\func
54.endm
55
56vdso_syscall restart_syscall,__NR_restart_syscall
57vdso_syscall sigreturn,__NR_sigreturn
58vdso_syscall rt_sigreturn,__NR_rt_sigreturn
59