1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Syscall restart trampoline for 32 and 64 bits processes.
4 *
5 * Copyright (C) 2018-2022 Helge Deller <deller@gmx.de>
6 * Copyright (C) 2022 John David Anglin <dave.anglin@bell.net>
7 */
8
9#include <asm/unistd.h>
10#include <asm/vdso.h>
11
12#include <linux/linkage.h>
13
14	.text
15
16ENTRY_CFI(__kernel_restart_syscall)
17	/*
18	 * Setup a trampoline to restart the syscall
19	 * with __NR_restart_syscall
20	 */
21
22	/* load return pointer */
23#if defined(__VDSO64__)
24	ldd	0(%sp), %r31
25#elif defined(__VDSO32__)
26	ldw	0(%sp), %r31
27#endif
28
29	be	0x100(%sr2, %r0)
30	ldi	__NR_restart_syscall, %r20
31
32ENDPROC_CFI(__kernel_restart_syscall)
33