diff options
author | H. Peter Anvin (Intel) <hpa@zytor.com> | 2021-05-10 21:53:14 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2021-05-12 11:49:15 +0300 |
commit | 29e9758966f47004bd7245e6adadcb708386f36a (patch) | |
tree | 25406ba0ca604a689d19f63f1108e1bde538bed4 | |
parent | 6de4ac1d03f75248974a398110b15af0bfe65a11 (diff) | |
download | linux-29e9758966f47004bd7245e6adadcb708386f36a.tar.xz |
x86/entry: Split PUSH_AND_CLEAR_REGS into two submacros
PUSH_AND_CLEAR_REGS, as the name implies, performs two functions:
pushing registers and clearing registers. They don't necessarily have
to be performed in immediate sequence, although all current users
do. Split it into two macros for the case where that isn't desired;
the FRED enabling patchset will eventually make use of this.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210510185316.3307264-6-hpa@zytor.com
-rw-r--r-- | arch/x86/entry/calling.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index 7436d4a74ecb..a4c061fb7c6e 100644 --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -63,7 +63,7 @@ For 32-bit we have the following conventions - kernel is built with * for assembly code: */ -.macro PUSH_AND_CLEAR_REGS rdx=%rdx rax=%rax save_ret=0 +.macro PUSH_REGS rdx=%rdx rax=%rax save_ret=0 .if \save_ret pushq %rsi /* pt_regs->si */ movq 8(%rsp), %rsi /* temporarily store the return address in %rsi */ @@ -90,7 +90,9 @@ For 32-bit we have the following conventions - kernel is built with .if \save_ret pushq %rsi /* return address on top of stack */ .endif +.endm +.macro CLEAR_REGS /* * Sanitize registers of values that a speculation attack might * otherwise want to exploit. The lower registers are likely clobbered @@ -112,6 +114,11 @@ For 32-bit we have the following conventions - kernel is built with .endm +.macro PUSH_AND_CLEAR_REGS rdx=%rdx rax=%rax save_ret=0 + PUSH_REGS rdx=\rdx, rax=\rax, save_ret=\save_ret + CLEAR_REGS +.endm + .macro POP_REGS pop_rdi=1 skip_r11rcx=0 popq %r15 popq %r14 |