]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/x86/include/asm/switch_to.h
x86/entry/32: Pull the MSR_IA32_SYSENTER_CS update code out of native_load_sp0()
[linux.git] / arch / x86 / include / asm / switch_to.h
index fcc5cd387fd17a59e5f28ba5fc8fb65fc57ae5af..7ae8caffbada39facf5d172733c780618a6afc0d 100644 (file)
@@ -72,4 +72,16 @@ do {                                                                 \
        ((last) = __switch_to_asm((prev), (next)));                     \
 } while (0)
 
+#ifdef CONFIG_X86_32
+static inline void refresh_sysenter_cs(struct thread_struct *thread)
+{
+       /* Only happens when SEP is enabled, no need to test "SEP"arately: */
+       if (unlikely(this_cpu_read(cpu_tss.x86_tss.ss1) == thread->sysenter_cs))
+               return;
+
+       this_cpu_write(cpu_tss.x86_tss.ss1, thread->sysenter_cs);
+       wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
+}
+#endif
+
 #endif /* _ASM_X86_SWITCH_TO_H */