[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] A few x86/64 cleanups.
ChangeSet 1.1282, 2005/04/07 09:01:29+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx A few x86/64 cleanups. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> arch/x86/domain.c | 16 ++++++++-------- arch/x86/x86_64/mm.c | 20 ++++++++++++-------- include/asm-x86/config.h | 1 + include/asm-x86/x86_64/asm_defns.h | 4 ++++ include/asm-x86/x86_64/page.h | 9 --------- include/xen/shadow.h | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c 2005-04-07 05:03:46 -04:00 +++ b/xen/arch/x86/domain.c 2005-04-07 05:03:46 -04:00 @@ -516,7 +516,7 @@ void toggle_guest_mode(struct exec_domain *ed) { ed->arch.flags ^= TF_kernel_mode; - __asm__ __volatile__ ( "mfence; swapgs" ); /* AMD erratum #88 */ + __asm__ __volatile__ ( "swapgs" ); update_pagetables(ed); write_ptbase(ed); } @@ -600,7 +600,7 @@ /* If in kernel mode then switch the GS bases around. */ if ( n->arch.flags & TF_kernel_mode ) - __asm__ __volatile__ ( "mfence; swapgs" ); /* AMD erratum #88 */ + __asm__ __volatile__ ( safe_swapgs ); if ( unlikely(!all_segs_okay) ) { @@ -651,12 +651,12 @@ static void clear_segments(void) { __asm__ __volatile__ ( - "movl %0,%%ds; " - "movl %0,%%es; " - "movl %0,%%fs; " - "movl %0,%%gs; " - "mfence; swapgs; " /* AMD erratum #88 */ - "movl %0,%%gs" + " movl %0,%%ds; " + " movl %0,%%es; " + " movl %0,%%fs; " + " movl %0,%%gs; " + ""safe_swapgs" " + " movl %0,%%gs" : : "r" (0) ); } diff -Nru a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c --- a/xen/arch/x86/x86_64/mm.c 2005-04-07 05:03:46 -04:00 +++ b/xen/arch/x86/x86_64/mm.c 2005-04-07 05:03:46 -04:00 @@ -23,6 +23,7 @@ #include <xen/init.h> #include <xen/mm.h> #include <xen/sched.h> +#include <asm/asm_defns.h> #include <asm/page.h> #include <asm/flushtlb.h> #include <asm/fixmap.h> @@ -248,31 +249,33 @@ long do_set_segment_base(unsigned int which, unsigned long base) { struct exec_domain *ed = current; - - base = canonicalise_virt_address(base); + long ret = 0; switch ( which ) { case SEGBASE_FS: ed->arch.user_ctxt.fs_base = base; - wrmsr(MSR_FS_BASE, base, base>>32); + if ( wrmsr_user(MSR_FS_BASE, base, base>>32) ) + ret = -EFAULT; break; case SEGBASE_GS_USER: ed->arch.user_ctxt.gs_base_user = base; - wrmsr(MSR_SHADOW_GS_BASE, base, base>>32); + if ( wrmsr_user(MSR_SHADOW_GS_BASE, base, base>>32) ) + ret = -EFAULT; break; case SEGBASE_GS_KERNEL: ed->arch.user_ctxt.gs_base_kernel = base; - wrmsr(MSR_GS_BASE, base, base>>32); + if ( wrmsr_user(MSR_GS_BASE, base, base>>32) ) + ret = -EFAULT; break; case SEGBASE_GS_USER_SEL: __asm__ __volatile__ ( " swapgs \n" "1: movl %k0,%%gs \n" - " mfence; swapgs \n" /* AMD erratum #88 */ + " "safe_swapgs" \n" ".section .fixup,\"ax\" \n" "2: xorl %k0,%k0 \n" " jmp 1b \n" @@ -285,10 +288,11 @@ break; default: - return -EINVAL; + ret = -EINVAL; + break; } - return 0; + return ret; } diff -Nru a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h --- a/xen/include/asm-x86/config.h 2005-04-07 05:03:46 -04:00 +++ b/xen/include/asm-x86/config.h 2005-04-07 05:03:46 -04:00 @@ -12,6 +12,7 @@ #endif #define CONFIG_X86 1 +#define CONFIG_SHADOW 1 #define CONFIG_SMP 1 #define CONFIG_X86_LOCAL_APIC 1 diff -Nru a/xen/include/asm-x86/x86_64/asm_defns.h b/xen/include/asm-x86/x86_64/asm_defns.h --- a/xen/include/asm-x86/x86_64/asm_defns.h 2005-04-07 05:03:46 -04:00 +++ b/xen/include/asm-x86/x86_64/asm_defns.h 2005-04-07 05:03:46 -04:00 @@ -39,6 +39,10 @@ "popq %rsi;" \ "popq %rdi;" +/* Work around AMD erratum #88 */ +#define safe_swapgs \ + "mfence; swapgs;" + #else #define SAVE_ALL \ diff -Nru a/xen/include/asm-x86/x86_64/page.h b/xen/include/asm-x86/x86_64/page.h --- a/xen/include/asm-x86/x86_64/page.h 2005-04-07 05:03:46 -04:00 +++ b/xen/include/asm-x86/x86_64/page.h 2005-04-07 05:03:46 -04:00 @@ -98,15 +98,6 @@ #define L3_DISALLOW_MASK ((cpu_has_nx?0:(1UL<<63)) | (7UL << 7)) #define L4_DISALLOW_MASK ((cpu_has_nx?0:(1UL<<63)) | (7UL << 7)) -#ifndef __ASSEMBLY__ -static inline unsigned long canonicalise_virt_address(unsigned long v) -{ - v &= VADDR_MASK; - if ( v & (1UL << (VADDR_BITS - 1)) ) - v |= ~VADDR_MASK; -} -#endif /* !__ASSEMBLY__ */ - #endif /* __X86_64_PAGE_H__ */ /* diff -Nru a/xen/include/xen/shadow.h b/xen/include/xen/shadow.h --- a/xen/include/xen/shadow.h 2005-04-07 05:03:46 -04:00 +++ b/xen/include/xen/shadow.h 2005-04-07 05:03:46 -04:00 @@ -4,7 +4,7 @@ #include <xen/config.h> -#ifdef CONFIG_X86 +#ifdef CONFIG_SHADOW #include <asm/shadow.h> _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |