diff options
-rw-r--r-- | arch/x86/kernel/process_64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot_64.c | 2 | ||||
-rw-r--r-- | include/asm-x86/processor.h | 22 | ||||
-rw-r--r-- | include/asm-x86/processor_32.h | 20 |
4 files changed, 23 insertions, 23 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index af56104b73ff..e3a3610ade10 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -639,7 +639,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
639 | /* | 639 | /* |
640 | * Reload esp0, LDT and the page table pointer: | 640 | * Reload esp0, LDT and the page table pointer: |
641 | */ | 641 | */ |
642 | tss->x86_tss.sp0 = next->sp0; | 642 | load_sp0(tss, next); |
643 | 643 | ||
644 | /* | 644 | /* |
645 | * Switch DS and ES. | 645 | * Switch DS and ES. |
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c index 2ea02a71b644..5bd42ce144da 100644 --- a/arch/x86/kernel/smpboot_64.c +++ b/arch/x86/kernel/smpboot_64.c | |||
@@ -614,7 +614,7 @@ do_rest: | |||
614 | start_rip = setup_trampoline(); | 614 | start_rip = setup_trampoline(); |
615 | 615 | ||
616 | init_rsp = c_idle.idle->thread.sp; | 616 | init_rsp = c_idle.idle->thread.sp; |
617 | per_cpu(init_tss, cpu).x86_tss.sp0 = init_rsp; | 617 | load_sp0(&per_cpu(init_tss, cpu), &c_idle.idle->thread); |
618 | initial_code = start_secondary; | 618 | initial_code = start_secondary; |
619 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); | 619 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); |
620 | 620 | ||
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h index cede9ad3dc6e..b1ea52156362 100644 --- a/include/asm-x86/processor.h +++ b/include/asm-x86/processor.h | |||
@@ -193,8 +193,22 @@ static inline void native_set_iopl_mask(unsigned mask) | |||
193 | #endif | 193 | #endif |
194 | } | 194 | } |
195 | 195 | ||
196 | static inline void native_load_sp0(struct tss_struct *tss, | ||
197 | struct thread_struct *thread) | ||
198 | { | ||
199 | tss->x86_tss.sp0 = thread->sp0; | ||
200 | #ifdef CONFIG_X86_32 | ||
201 | /* Only happens when SEP is enabled, no need to test "SEP"arately */ | ||
202 | if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) { | ||
203 | tss->x86_tss.ss1 = thread->sysenter_cs; | ||
204 | wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0); | ||
205 | } | ||
206 | #endif | ||
207 | } | ||
196 | 208 | ||
197 | #ifndef CONFIG_PARAVIRT | 209 | #ifdef CONFIG_PARAVIRT |
210 | #include <asm/paravirt.h> | ||
211 | #else | ||
198 | #define __cpuid native_cpuid | 212 | #define __cpuid native_cpuid |
199 | #define paravirt_enabled() 0 | 213 | #define paravirt_enabled() 0 |
200 | 214 | ||
@@ -206,6 +220,12 @@ static inline void native_set_iopl_mask(unsigned mask) | |||
206 | #define set_debugreg(value, register) \ | 220 | #define set_debugreg(value, register) \ |
207 | native_set_debugreg(register, value) | 221 | native_set_debugreg(register, value) |
208 | 222 | ||
223 | static inline void load_sp0(struct tss_struct *tss, | ||
224 | struct thread_struct *thread) | ||
225 | { | ||
226 | native_load_sp0(tss, thread); | ||
227 | } | ||
228 | |||
209 | #define set_iopl_mask native_set_iopl_mask | 229 | #define set_iopl_mask native_set_iopl_mask |
210 | #endif /* CONFIG_PARAVIRT */ | 230 | #endif /* CONFIG_PARAVIRT */ |
211 | 231 | ||
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h index 57b345bc3c74..53037d1a6ae6 100644 --- a/include/asm-x86/processor_32.h +++ b/include/asm-x86/processor_32.h | |||
@@ -278,26 +278,6 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); | |||
278 | 278 | ||
279 | #define KSTK_ESP(task) (task_pt_regs(task)->sp) | 279 | #define KSTK_ESP(task) (task_pt_regs(task)->sp) |
280 | 280 | ||
281 | static inline void native_load_sp0(struct tss_struct *tss, struct thread_struct *thread) | ||
282 | { | ||
283 | tss->x86_tss.sp0 = thread->sp0; | ||
284 | /* This can only happen when SEP is enabled, no need to test "SEP"arately */ | ||
285 | if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) { | ||
286 | tss->x86_tss.ss1 = thread->sysenter_cs; | ||
287 | wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0); | ||
288 | } | ||
289 | } | ||
290 | |||
291 | #ifdef CONFIG_PARAVIRT | ||
292 | #include <asm/paravirt.h> | ||
293 | #else | ||
294 | |||
295 | static inline void load_sp0(struct tss_struct *tss, struct thread_struct *thread) | ||
296 | { | ||
297 | native_load_sp0(tss, thread); | ||
298 | } | ||
299 | #endif /* CONFIG_PARAVIRT */ | ||
300 | |||
301 | /* generic versions from gas */ | 281 | /* generic versions from gas */ |
302 | #define GENERIC_NOP1 ".byte 0x90\n" | 282 | #define GENERIC_NOP1 ".byte 0x90\n" |
303 | #define GENERIC_NOP2 ".byte 0x89,0xf6\n" | 283 | #define GENERIC_NOP2 ".byte 0x89,0xf6\n" |