xen/23539-hvm-cpuid-FSGSBASE.patch

35 lines
1.4 KiB
Diff
Raw Normal View History

# HG changeset patch
# User Yang, Wei <wei.y.yang@intel.com>
# Date 1308150408 -3600
# Node ID 8c75f35d55f60cb2f374e3b5c7c520f8633d733f
# Parent 35b4220c98bc89b7162d19ed6c858e027fabff69
Enable RDWRGSFS feature support for HVM guests
Write/read FS/GS base instructions enable user level code to
read/write FS & GS segment base registers for thread local storage.
Signed-off-by: Yang, Wei <wei.y.yang@intel.com>
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -304,7 +304,8 @@ static void xc_cpuid_hvm_policy(
case 0x00000007: /* Intel-defined CPU features */
if ( input[1] == 0 ) {
regs[1] &= (bitmaskof(X86_FEATURE_SMEP) |
- bitmaskof(X86_FEATURE_ERMS));
+ bitmaskof(X86_FEATURE_ERMS) |
+ bitmaskof(X86_FEATURE_FSGSBASE));
} else
regs[1] = 0;
regs[0] = regs[2] = regs[3] = 0;
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -297,6 +297,7 @@ static inline int hvm_do_pmu_interrupt(s
X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | \
(cpu_has_smep ? X86_CR4_SMEP : 0) | \
+ (cpu_has_fsgsbase ? X86_CR4_FSGSBASE : 0) | \
(xsave_enabled(_v) ? X86_CR4_OSXSAVE : 0))))
/* These exceptions must always be intercepted. */