1 /* SPDX-License-Identifier: GPL-2.0 */
3 #include <linux/stringify.h>
4 #include <linux/linkage.h>
5 #include <asm/dwarf2.h>
6 #include <asm/cpufeatures.h>
7 #include <asm/alternative-asm.h>
8 #include <asm/export.h>
9 #include <asm/nospec-branch.h>
10 #include <asm/unwind_hints.h>
11 #include <asm/frame.h>
14 .section .text.__x86.indirect_thunk
17 SYM_FUNC_START(__x86_indirect_thunk_\reg)
19 SYM_FUNC_END(__x86_indirect_thunk_\reg)
21 SYM_FUNC_START_NOALIGN(__x86_retpoline_\reg)
22 ANNOTATE_INTRA_FUNCTION_CALL
31 UNWIND_HINT_RET_OFFSET
33 SYM_FUNC_END(__x86_retpoline_\reg)
38 * Despite being an assembler file we can't just use .irp here
39 * because __KSYM_DEPS__ only uses the C preprocessor and would
40 * only see one instance of "__x86_indirect_thunk_\reg" rather
41 * than one per register with the correct names. So we do it
42 * the simple and nasty way...
44 * Worse, you can only have a single EXPORT_SYMBOL per line,
45 * and CPP can't insert newlines, so we have to repeat everything
49 #define __EXPORT_THUNK(sym) _ASM_NOKPROBE(sym); EXPORT_SYMBOL(sym)
50 #define EXPORT_THUNK(reg) __EXPORT_THUNK(__x86_indirect_thunk_ ## reg)
51 #define EXPORT_RETPOLINE(reg) __EXPORT_THUNK(__x86_retpoline_ ## reg)
54 #define GEN(reg) THUNK reg
55 #include <asm/GEN-for-each-reg.h>
58 #define GEN(reg) EXPORT_THUNK(reg)
59 #include <asm/GEN-for-each-reg.h>
62 #define GEN(reg) EXPORT_RETPOLINE(reg)
63 #include <asm/GEN-for-each-reg.h>