mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
x86: Simplify retpoline declaration
Because of how KSYM works, we need one declaration per line. Seeing how we're going to be doubling the amount of retpoline symbols, simplify the machinery in order to avoid having to copy/paste even more. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/20200428191700.091696925@infradead.org
This commit is contained in:
parent
089dd8e531
commit
ca3f0d80dd
3 changed files with 48 additions and 40 deletions
25
arch/x86/include/asm/GEN-for-each-reg.h
Normal file
25
arch/x86/include/asm/GEN-for-each-reg.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifdef CONFIG_64BIT
|
||||||
|
GEN(rax)
|
||||||
|
GEN(rbx)
|
||||||
|
GEN(rcx)
|
||||||
|
GEN(rdx)
|
||||||
|
GEN(rsi)
|
||||||
|
GEN(rdi)
|
||||||
|
GEN(rbp)
|
||||||
|
GEN(r8)
|
||||||
|
GEN(r9)
|
||||||
|
GEN(r10)
|
||||||
|
GEN(r11)
|
||||||
|
GEN(r12)
|
||||||
|
GEN(r13)
|
||||||
|
GEN(r14)
|
||||||
|
GEN(r15)
|
||||||
|
#else
|
||||||
|
GEN(eax)
|
||||||
|
GEN(ebx)
|
||||||
|
GEN(ecx)
|
||||||
|
GEN(edx)
|
||||||
|
GEN(esi)
|
||||||
|
GEN(edi)
|
||||||
|
GEN(ebp)
|
||||||
|
#endif
|
|
@ -17,24 +17,12 @@ extern void cmpxchg8b_emu(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_RETPOLINE
|
#ifdef CONFIG_RETPOLINE
|
||||||
#ifdef CONFIG_X86_32
|
|
||||||
#define INDIRECT_THUNK(reg) extern asmlinkage void __x86_indirect_thunk_e ## reg(void);
|
#define DECL_INDIRECT_THUNK(reg) \
|
||||||
#else
|
extern asmlinkage void __x86_indirect_thunk_ ## reg (void);
|
||||||
#define INDIRECT_THUNK(reg) extern asmlinkage void __x86_indirect_thunk_r ## reg(void);
|
|
||||||
INDIRECT_THUNK(8)
|
#undef GEN
|
||||||
INDIRECT_THUNK(9)
|
#define GEN(reg) DECL_INDIRECT_THUNK(reg)
|
||||||
INDIRECT_THUNK(10)
|
#include <asm/GEN-for-each-reg.h>
|
||||||
INDIRECT_THUNK(11)
|
|
||||||
INDIRECT_THUNK(12)
|
|
||||||
INDIRECT_THUNK(13)
|
|
||||||
INDIRECT_THUNK(14)
|
|
||||||
INDIRECT_THUNK(15)
|
|
||||||
#endif
|
|
||||||
INDIRECT_THUNK(ax)
|
|
||||||
INDIRECT_THUNK(bx)
|
|
||||||
INDIRECT_THUNK(cx)
|
|
||||||
INDIRECT_THUNK(dx)
|
|
||||||
INDIRECT_THUNK(si)
|
|
||||||
INDIRECT_THUNK(di)
|
|
||||||
INDIRECT_THUNK(bp)
|
|
||||||
#endif /* CONFIG_RETPOLINE */
|
#endif /* CONFIG_RETPOLINE */
|
||||||
|
|
|
@ -24,25 +24,20 @@ SYM_FUNC_END(__x86_indirect_thunk_\reg)
|
||||||
* only see one instance of "__x86_indirect_thunk_\reg" rather
|
* only see one instance of "__x86_indirect_thunk_\reg" rather
|
||||||
* than one per register with the correct names. So we do it
|
* than one per register with the correct names. So we do it
|
||||||
* the simple and nasty way...
|
* the simple and nasty way...
|
||||||
|
*
|
||||||
|
* Worse, you can only have a single EXPORT_SYMBOL per line,
|
||||||
|
* and CPP can't insert newlines, so we have to repeat everything
|
||||||
|
* at least twice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __EXPORT_THUNK(sym) _ASM_NOKPROBE(sym); EXPORT_SYMBOL(sym)
|
#define __EXPORT_THUNK(sym) _ASM_NOKPROBE(sym); EXPORT_SYMBOL(sym)
|
||||||
#define EXPORT_THUNK(reg) __EXPORT_THUNK(__x86_indirect_thunk_ ## reg)
|
#define EXPORT_THUNK(reg) __EXPORT_THUNK(__x86_indirect_thunk_ ## reg)
|
||||||
#define GENERATE_THUNK(reg) THUNK reg ; EXPORT_THUNK(reg)
|
|
||||||
|
|
||||||
GENERATE_THUNK(_ASM_AX)
|
#undef GEN
|
||||||
GENERATE_THUNK(_ASM_BX)
|
#define GEN(reg) THUNK reg
|
||||||
GENERATE_THUNK(_ASM_CX)
|
#include <asm/GEN-for-each-reg.h>
|
||||||
GENERATE_THUNK(_ASM_DX)
|
|
||||||
GENERATE_THUNK(_ASM_SI)
|
#undef GEN
|
||||||
GENERATE_THUNK(_ASM_DI)
|
#define GEN(reg) EXPORT_THUNK(reg)
|
||||||
GENERATE_THUNK(_ASM_BP)
|
#include <asm/GEN-for-each-reg.h>
|
||||||
#ifdef CONFIG_64BIT
|
|
||||||
GENERATE_THUNK(r8)
|
|
||||||
GENERATE_THUNK(r9)
|
|
||||||
GENERATE_THUNK(r10)
|
|
||||||
GENERATE_THUNK(r11)
|
|
||||||
GENERATE_THUNK(r12)
|
|
||||||
GENERATE_THUNK(r13)
|
|
||||||
GENERATE_THUNK(r14)
|
|
||||||
GENERATE_THUNK(r15)
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in a new issue