lkml.org 
[lkml]   [2021]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V3 2/6] x86_32: use percpu instead of offset-calculation to get thread.sp0 when SWITCH_TO_KERNEL_STACK
Date
From: Lai Jiangshan <laijs@linux.alibaba.com>

TSS_entry2task_stack is used to refer to tss.sp1 which is stored the value
of thread.sp0.

At the code where TSS_entry2task_stack is used in SWITCH_TO_KERNEL_STACK,
the CR3 is already kernel CR3 and kernel segments is loaded.

So we can directly use the percpu to get tss.sp1(thread.sp0) instead of
the complex offset-calculation.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
---
arch/x86/entry/entry_32.S | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index df8c017e6161..3b4d1a63d1f0 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -465,16 +465,11 @@
cmpl $SIZEOF_entry_stack, %ecx
jae .Lend_\@

- /* Load stack pointer into %esi and %edi */
+ /* Load stack pointer into %esi */
movl %esp, %esi
- movl %esi, %edi
-
- /* Move %edi to the top of the entry stack */
- andl $(MASK_entry_stack), %edi
- addl $(SIZEOF_entry_stack), %edi

/* Load top of task-stack into %edi */
- movl TSS_entry2task_stack(%edi), %edi
+ movl PER_CPU_VAR(cpu_tss_rw + TSS_sp1), %edi

/* Special case - entry from kernel mode via entry stack */
#ifdef CONFIG_VM86
--
2.19.1.6.gb485710b
\
 
 \ /
  Last update: 2021-01-27 16:57    [W:0.392 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site