2 * arm linux replacement vdso.
4 * Copyright 2023 Linaro, Ltd.
6 * SPDX-License-Identifier: GPL-2.0-or-later
9 #include <asm/unistd.h>
10 #include "vdso-asmoffset.h"
13 * All supported cpus have T16 instructions: at least arm4t.
15 * We support user-user with m-profile cpus as an extension, because it
16 * is useful for testing gcc, which requires we avoid A32 instructions.
20 .eabi_attribute Tag_FP_arch, 0
21 .eabi_attribute Tag_ARM_ISA_use, 0
37 .macro fdpic_thunk ofs
46 .type \name, %function
47 .size \name, . - \name
51 * We must save/restore r7 for the EABI syscall number.
52 * While we're doing that, we might as well save LR to get a free return,
53 * and a branch that is interworking back to ARMv5.
56 .macro SYSCALL name, nr
60 .cfi_adjust_cfa_offset 8
69 SYSCALL __vdso_clock_gettime, __NR_clock_gettime
70 SYSCALL __vdso_clock_gettime64, __NR_clock_gettime64
71 SYSCALL __vdso_clock_getres, __NR_clock_getres
72 SYSCALL __vdso_gettimeofday, __NR_gettimeofday
76 * We, like the real kernel, use a table of sigreturn trampolines.
77 * Unlike the real kernel, we do not attempt to pack this into as
78 * few bytes as possible -- simply use 8 bytes per slot.
80 * Within each slot, use the exact same code sequence as the kernel,
81 * lest we trip up someone doing code inspection.
86 .org sigreturn_codes + 8 * \n
89 .macro cfi_fdpic_r9 ofs
94 * DW_CFA_expression r9, length (7),
95 * DW_OP_breg13, ofs, DW_OP_deref,
96 * DW_OP_plus_uconst, 4, DW_OP_deref
98 .cfi_escape 0x10, 9, 7, 0x7d, (\ofs & 0x7f) + 0x80, (\ofs >> 7), 0x06, 0x23, 4, 0x06
101 .macro cfi_fdpic_pc ofs
106 * DW_CFA_expression lr (14), length (5),
107 * DW_OP_breg13, ofs, DW_OP_deref, DW_OP_deref
109 .cfi_escape 0x10, 14, 5, 0x7d, (\ofs & 0x7f) + 0x80, (\ofs >> 7), 0x06, 0x06
113 * Start the unwind info at least one instruction before the signal
114 * trampoline, because the unwinder will assume we are returning
117 .cfi_startproc simple
119 .cfi_return_column 15
121 .cfi_def_cfa sp, 32 + 64
122 .cfi_offset r0, -16 * 4
123 .cfi_offset r1, -15 * 4
124 .cfi_offset r2, -14 * 4
125 .cfi_offset r3, -13 * 4
126 .cfi_offset r4, -12 * 4
127 .cfi_offset r5, -11 * 4
128 .cfi_offset r6, -10 * 4
129 .cfi_offset r7, -9 * 4
130 .cfi_offset r8, -8 * 4
131 .cfi_offset r9, -7 * 4
132 .cfi_offset r10, -6 * 4
133 .cfi_offset r11, -5 * 4
134 .cfi_offset r12, -4 * 4
135 .cfi_offset r13, -3 * 4
136 .cfi_offset r14, -2 * 4
137 .cfi_offset r15, -1 * 4
143 /* [EO]ABI sigreturn */
145 raw_syscall __NR_sigreturn
147 .cfi_def_cfa_offset 160 + 64
149 /* [EO]ABI rt_sigreturn */
151 raw_syscall __NR_rt_sigreturn
155 /* FDPIC sigreturn */
157 cfi_fdpic_pc SIGFRAME_RC3_OFFSET
158 cfi_fdpic_r9 SIGFRAME_RC3_OFFSET
161 fdpic_thunk SIGFRAME_RC3_OFFSET
164 /* FDPIC rt_sigreturn */
166 cfi_fdpic_pc RT_SIGFRAME_RC3_OFFSET
167 cfi_fdpic_r9 RT_SIGFRAME_RC3_OFFSET
170 fdpic_thunk RT_SIGFRAME_RC3_OFFSET