FROMLIST: [PATCH 4/6] arm64: compat: Add a 32-bit vDSO
[GitHub/exynos8895/android_kernel_samsung_universal8895.git] / arch / arm64 / kernel / vdso32 / sigreturn.S
1 /*
2 * Sigreturn trampolines for returning from a signal when the SA_RESTORER
3 * flag is not set.
4 *
5 * Copyright (C) 2016 ARM Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Based on glibc's arm sa_restorer. While this is not strictly necessary, we
20 * provide both A32 and T32 versions, in accordance with the arm sigreturn
21 * code.
22 */
23
24 #include <linux/linkage.h>
25 #include <asm/asm-offsets.h>
26 #include <asm/unistd32.h>
27
28 .macro sigreturn_trampoline name, syscall, regs_offset
29 /*
30 * We provide directives for enabling stack unwinding through the
31 * trampoline. On arm, CFI directives are only used for debugging (and
32 * the vDSO is stripped of debug information), so only the arm-specific
33 * unwinding directives are useful here.
34 */
35 .fnstart
36 .save {r0-r15}
37 .pad #\regs_offset
38 /*
39 * It is necessary to start the unwind tables at least one instruction
40 * before the trampoline, as the unwinder will assume that the signal
41 * handler has been called from the trampoline, that is just before
42 * where the signal handler returns (mov r7, ...).
43 */
44 nop
45 ENTRY(\name)
46 mov r7, #\syscall
47 svc #0
48 .fnend
49 /*
50 * We would like to use ENDPROC, but the macro uses @ which is a
51 * comment symbol for arm assemblers, so directly use .type with %
52 * instead.
53 */
54 .type \name, %function
55 END(\name)
56 .endm
57
58 .text
59
60 .arm
61 sigreturn_trampoline __kernel_sigreturn_arm, \
62 __NR_sigreturn, \
63 COMPAT_SIGFRAME_REGS_OFFSET
64
65 sigreturn_trampoline __kernel_rt_sigreturn_arm, \
66 __NR_rt_sigreturn, \
67 COMPAT_RT_SIGFRAME_REGS_OFFSET
68
69 .thumb
70 sigreturn_trampoline __kernel_sigreturn_thumb, \
71 __NR_sigreturn, \
72 COMPAT_SIGFRAME_REGS_OFFSET
73
74 sigreturn_trampoline __kernel_rt_sigreturn_thumb, \
75 __NR_rt_sigreturn, \
76 COMPAT_RT_SIGFRAME_REGS_OFFSET