x86/entry/64: Use the TSS sp2 slot for SYSCALL/SYSRET scratch space
[platform/kernel/linux-rpi.git] / arch / x86 / entry / entry_64.S
index ce6af44..7e82e55 100644 (file)
@@ -215,18 +215,20 @@ ENTRY(entry_SYSCALL_64)
        /*
         * This path is only taken when PAGE_TABLE_ISOLATION is disabled so it
         * is not required to switch CR3.
+        *
+        * tss.sp2 is scratch space.
         */
-       movq    %rsp, PER_CPU_VAR(rsp_scratch)
+       movq    %rsp, PER_CPU_VAR(cpu_tss_rw + TSS_sp2)
        movq    PER_CPU_VAR(cpu_current_top_of_stack), %rsp
 
        /* Construct struct pt_regs on stack */
-       pushq   $__USER_DS                      /* pt_regs->ss */
-       pushq   PER_CPU_VAR(rsp_scratch)        /* pt_regs->sp */
-       pushq   %r11                            /* pt_regs->flags */
-       pushq   $__USER_CS                      /* pt_regs->cs */
-       pushq   %rcx                            /* pt_regs->ip */
+       pushq   $__USER_DS                              /* pt_regs->ss */
+       pushq   PER_CPU_VAR(cpu_tss_rw + TSS_sp2)       /* pt_regs->sp */
+       pushq   %r11                                    /* pt_regs->flags */
+       pushq   $__USER_CS                              /* pt_regs->cs */
+       pushq   %rcx                                    /* pt_regs->ip */
 GLOBAL(entry_SYSCALL_64_after_hwframe)
-       pushq   %rax                            /* pt_regs->orig_ax */
+       pushq   %rax                                    /* pt_regs->orig_ax */
 
        PUSH_AND_CLEAR_REGS rax=$-ENOSYS