From 633a5a52b98e22f730941b86fcb186604b58fa2c Mon Sep 17 00:00:00 2001 From: Glauber de Oliveira Costa Date: Wed, 30 Jan 2008 13:32:08 +0100 Subject: [PATCH] --- yaml --- r: 80103 b: refs/heads/master c: e801f864ec7e5b149bd05337800e419f408523bb h: refs/heads/master i: 80101: 632670590ee28a6aad51497f17ff70f15eb4568d 80099: 639fbb0a73c1aada3cdab881847394a05c93bebe 80095: 01a08d9e038f5ca859c71445329f2d2f6955c910 v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/paravirt.c | 1 + trunk/include/asm-x86/paravirt.h | 9 +++++++++ trunk/include/asm-x86/processor.h | 8 ++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index facfd3557de8..e42837eed189 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4a8c4c4e10d1bc2c3bd80caabb6a76a66849f7e8 +refs/heads/master: e801f864ec7e5b149bd05337800e419f408523bb diff --git a/trunk/arch/x86/kernel/paravirt.c b/trunk/arch/x86/kernel/paravirt.c index 072c1a08efe6..e7c17cc4a99e 100644 --- a/trunk/arch/x86/kernel/paravirt.c +++ b/trunk/arch/x86/kernel/paravirt.c @@ -390,6 +390,7 @@ struct pv_cpu_ops pv_cpu_ops = { .irq_enable_syscall_ret = native_irq_enable_syscall_ret, .iret = native_iret, + .swapgs = native_swapgs, .set_iopl_mask = native_set_iopl_mask, .io_delay = native_io_delay, diff --git a/trunk/include/asm-x86/paravirt.h b/trunk/include/asm-x86/paravirt.h index 7d1c126e2249..e8fbf742d425 100644 --- a/trunk/include/asm-x86/paravirt.h +++ b/trunk/include/asm-x86/paravirt.h @@ -127,6 +127,8 @@ struct pv_cpu_ops { void (*irq_enable_syscall_ret)(void); void (*iret)(void); + void (*swapgs)(void); + struct pv_lazy_ops lazy_mode; }; @@ -1228,6 +1230,13 @@ static inline unsigned long __raw_local_irq_save(void) call *pv_cpu_ops+PV_CPU_read_cr0; \ pop %edx; pop %ecx #else +#define SWAPGS \ + PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ + PV_SAVE_REGS; \ + call *pv_cpu_ops+PV_CPU_swapgs; \ + PV_RESTORE_REGS \ + ) + #define GET_CR2_INTO_RCX \ call *pv_mmu_ops+PV_MMU_read_cr2; \ movq %rax, %rcx; \ diff --git a/trunk/include/asm-x86/processor.h b/trunk/include/asm-x86/processor.h index e6fa06fee72a..72740c6f1109 100644 --- a/trunk/include/asm-x86/processor.h +++ b/trunk/include/asm-x86/processor.h @@ -435,6 +435,13 @@ static inline void native_load_sp0(struct tss_struct *tss, #endif } +static inline void native_swapgs(void) +{ +#ifdef CONFIG_X86_64 + asm volatile("swapgs" ::: "memory"); +#endif +} + #ifdef CONFIG_PARAVIRT #include #else @@ -456,6 +463,7 @@ static inline void load_sp0(struct tss_struct *tss, } #define set_iopl_mask native_set_iopl_mask +#define SWAPGS swapgs #endif /* CONFIG_PARAVIRT */ /*