Commit d205222e authored by Linus Torvalds's avatar Linus Torvalds Committed by Borislav Petkov

x86/entry: Simplify entry_INT80_compat()

Instead of playing silly games with rdi, use rax for simpler and more
consistent code.
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220506121631.221072885@infradead.org
parent a1e2c031
...@@ -362,26 +362,25 @@ SYM_CODE_START(entry_INT80_compat) ...@@ -362,26 +362,25 @@ SYM_CODE_START(entry_INT80_compat)
/* switch to thread stack expects orig_ax and rdi to be pushed */ /* switch to thread stack expects orig_ax and rdi to be pushed */
pushq %rax /* pt_regs->orig_ax */ pushq %rax /* pt_regs->orig_ax */
pushq %rdi /* pt_regs->di */
/* Need to switch before accessing the thread stack. */ /* Need to switch before accessing the thread stack. */
SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi SWITCH_TO_KERNEL_CR3 scratch_reg=%rax
/* In the Xen PV case we already run on the thread stack. */ /* In the Xen PV case we already run on the thread stack. */
ALTERNATIVE "", "jmp .Lint80_keep_stack", X86_FEATURE_XENPV ALTERNATIVE "", "jmp .Lint80_keep_stack", X86_FEATURE_XENPV
movq %rsp, %rdi movq %rsp, %rax
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
pushq 6*8(%rdi) /* regs->ss */ pushq 5*8(%rax) /* regs->ss */
pushq 5*8(%rdi) /* regs->rsp */ pushq 4*8(%rax) /* regs->rsp */
pushq 4*8(%rdi) /* regs->eflags */ pushq 3*8(%rax) /* regs->eflags */
pushq 3*8(%rdi) /* regs->cs */ pushq 2*8(%rax) /* regs->cs */
pushq 2*8(%rdi) /* regs->ip */ pushq 1*8(%rax) /* regs->ip */
pushq 1*8(%rdi) /* regs->orig_ax */ pushq 0*8(%rax) /* regs->orig_ax */
pushq (%rdi) /* pt_regs->di */
.Lint80_keep_stack: .Lint80_keep_stack:
pushq %rdi /* pt_regs->di */
pushq %rsi /* pt_regs->si */ pushq %rsi /* pt_regs->si */
xorl %esi, %esi /* nospec si */ xorl %esi, %esi /* nospec si */
pushq %rdx /* pt_regs->dx */ pushq %rdx /* pt_regs->dx */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment