[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210127163231.12709-4-jiangshanlai@gmail.com>
Date: Thu, 28 Jan 2021 00:32:19 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Lai Jiangshan <laijs@...ux.alibaba.com>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Al Viro <viro@...iv.linux.org.uk>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Joerg Roedel <jroedel@...e.de>,
Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Gabriel Krisman Bertazi <krisman@...labora.com>,
Kees Cook <keescook@...omium.org>,
Frederic Weisbecker <frederic@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Arvind Sankar <nivedita@...m.mit.edu>,
Brian Gerst <brgerst@...il.com>,
Ard Biesheuvel <ardb@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Mike Rapoport <rppt@...nel.org>, Mike Hommey <mh@...ndium.org>,
Mark Gross <mgross@...ux.intel.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Tony Luck <tony.luck@...el.com>,
Anthony Steinhauser <asteinhauser@...gle.com>,
Jay Lang <jaytlang@....edu>,
"Chang S. Bae" <chang.seok.bae@...el.com>
Subject: [PATCH V3 3/6] x86_32/sysenter: switch to the task stack without emptying the entry stack
From: Lai Jiangshan <laijs@...ux.alibaba.com>
Like the way x86_64 uses the "old" stack, we can save the entry stack
pointer to a register and switch to the task stack. So that we have
space on the "old" stack to save more things or scratch registers.
Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
---
arch/x86/entry/entry_32.S | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index 3b4d1a63d1f0..3e693db0963d 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -905,19 +905,18 @@ SYM_FUNC_START(entry_SYSENTER_32)
pushl %eax
BUG_IF_WRONG_CR3 no_user_check=1
SWITCH_TO_KERNEL_CR3 scratch_reg=%eax
- popl %eax
- popfl
- /* Stack empty again, switch to task stack */
- movl TSS_entry2task_stack(%esp), %esp
+ /* Switch to task stack */
+ movl %esp, %eax
+ movl (2*4+TSS_entry2task_stack)(%esp), %esp
.Lsysenter_past_esp:
pushl $__USER_DS /* pt_regs->ss */
pushl $0 /* pt_regs->sp (placeholder) */
- pushfl /* pt_regs->flags (except IF = 0) */
+ pushl %ss:4(%eax) /* pt_regs->flags (except IF = 0) */
pushl $__USER_CS /* pt_regs->cs */
pushl $0 /* pt_regs->ip = 0 (placeholder) */
- pushl %eax /* pt_regs->orig_ax */
+ pushl %ss:(%eax) /* pt_regs->orig_ax */
SAVE_ALL pt_regs_ax=$-ENOSYS /* save rest, stack already switched */
/*
--
2.19.1.6.gb485710b
Powered by blists - more mailing lists