xref: /openbmc/qemu/linux-user/s390x/vdso.S (revision b63c6b97)
1/*
2 * s390x linux replacement vdso.
3 *
4 * Copyright 2023 Linaro, Ltd.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include <asm/unistd.h>
10#include "vdso-asmoffset.h"
11
12.macro endf name
13	.globl	\name
14	.type	\name, @function
15	.size	\name, . - \name
16.endm
17
18.macro raw_syscall n
19        .ifne	\n < 0x100
20	svc	\n
21	.else
22	lghi	%r1, \n
23	svc	0
24        .endif
25.endm
26
27.macro vdso_syscall name, nr
28\name:
29	.cfi_startproc
30	aghi	%r15, -(STACK_FRAME_OVERHEAD + 16)
31	.cfi_adjust_cfa_offset STACK_FRAME_OVERHEAD + 16
32	stg	%r14, STACK_FRAME_OVERHEAD(%r15)
33	.cfi_rel_offset %r14, STACK_FRAME_OVERHEAD
34	raw_syscall \nr
35	lg	%r14, STACK_FRAME_OVERHEAD(%r15)
36	aghi	%r15, STACK_FRAME_OVERHEAD + 16
37	.cfi_restore %r14
38	.cfi_adjust_cfa_offset -(STACK_FRAME_OVERHEAD + 16)
39	br	%r14
40	.cfi_endproc
41endf	\name
42.endm
43
44vdso_syscall __kernel_gettimeofday, __NR_gettimeofday
45vdso_syscall __kernel_clock_gettime, __NR_clock_gettime
46vdso_syscall __kernel_clock_getres, __NR_clock_getres
47vdso_syscall __kernel_getcpu, __NR_getcpu
48
49/*
50 * TODO unwind info, though we're ok without it.
51 * The kernel supplies bogus empty unwind info, and it is likely ignored
52 * by all users.  Without it we get the fallback signal frame handling.
53 */
54
55__kernel_sigreturn:
56	raw_syscall __NR_sigreturn
57endf	__kernel_sigreturn
58
59__kernel_rt_sigreturn:
60	raw_syscall __NR_rt_sigreturn
61endf	__kernel_rt_sigreturn
62