diff options
-rw-r--r-- | arch/x86/kernel/paravirt.c | 1 | ||||
-rw-r--r-- | include/asm-x86/paravirt.h | 9 | ||||
-rw-r--r-- | include/asm-x86/processor.h | 8 |
3 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 072c1a08efe6..e7c17cc4a99e 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -390,6 +390,7 @@ struct pv_cpu_ops pv_cpu_ops = { | |||
390 | 390 | ||
391 | .irq_enable_syscall_ret = native_irq_enable_syscall_ret, | 391 | .irq_enable_syscall_ret = native_irq_enable_syscall_ret, |
392 | .iret = native_iret, | 392 | .iret = native_iret, |
393 | .swapgs = native_swapgs, | ||
393 | 394 | ||
394 | .set_iopl_mask = native_set_iopl_mask, | 395 | .set_iopl_mask = native_set_iopl_mask, |
395 | .io_delay = native_io_delay, | 396 | .io_delay = native_io_delay, |
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h index 7d1c126e2249..e8fbf742d425 100644 --- a/include/asm-x86/paravirt.h +++ b/include/asm-x86/paravirt.h | |||
@@ -127,6 +127,8 @@ struct pv_cpu_ops { | |||
127 | void (*irq_enable_syscall_ret)(void); | 127 | void (*irq_enable_syscall_ret)(void); |
128 | void (*iret)(void); | 128 | void (*iret)(void); |
129 | 129 | ||
130 | void (*swapgs)(void); | ||
131 | |||
130 | struct pv_lazy_ops lazy_mode; | 132 | struct pv_lazy_ops lazy_mode; |
131 | }; | 133 | }; |
132 | 134 | ||
@@ -1228,6 +1230,13 @@ static inline unsigned long __raw_local_irq_save(void) | |||
1228 | call *pv_cpu_ops+PV_CPU_read_cr0; \ | 1230 | call *pv_cpu_ops+PV_CPU_read_cr0; \ |
1229 | pop %edx; pop %ecx | 1231 | pop %edx; pop %ecx |
1230 | #else | 1232 | #else |
1233 | #define SWAPGS \ | ||
1234 | PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ | ||
1235 | PV_SAVE_REGS; \ | ||
1236 | call *pv_cpu_ops+PV_CPU_swapgs; \ | ||
1237 | PV_RESTORE_REGS \ | ||
1238 | ) | ||
1239 | |||
1231 | #define GET_CR2_INTO_RCX \ | 1240 | #define GET_CR2_INTO_RCX \ |
1232 | call *pv_mmu_ops+PV_MMU_read_cr2; \ | 1241 | call *pv_mmu_ops+PV_MMU_read_cr2; \ |
1233 | movq %rax, %rcx; \ | 1242 | movq %rax, %rcx; \ |
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h index e6fa06fee72a..72740c6f1109 100644 --- a/include/asm-x86/processor.h +++ b/include/asm-x86/processor.h | |||
@@ -435,6 +435,13 @@ static inline void native_load_sp0(struct tss_struct *tss, | |||
435 | #endif | 435 | #endif |
436 | } | 436 | } |
437 | 437 | ||
438 | static inline void native_swapgs(void) | ||
439 | { | ||
440 | #ifdef CONFIG_X86_64 | ||
441 | asm volatile("swapgs" ::: "memory"); | ||
442 | #endif | ||
443 | } | ||
444 | |||
438 | #ifdef CONFIG_PARAVIRT | 445 | #ifdef CONFIG_PARAVIRT |
439 | #include <asm/paravirt.h> | 446 | #include <asm/paravirt.h> |
440 | #else | 447 | #else |
@@ -456,6 +463,7 @@ static inline void load_sp0(struct tss_struct *tss, | |||
456 | } | 463 | } |
457 | 464 | ||
458 | #define set_iopl_mask native_set_iopl_mask | 465 | #define set_iopl_mask native_set_iopl_mask |
466 | #define SWAPGS swapgs | ||
459 | #endif /* CONFIG_PARAVIRT */ | 467 | #endif /* CONFIG_PARAVIRT */ |
460 | 468 | ||
461 | /* | 469 | /* |