aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_cpuid_x86.c
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-06-02 14:39:50 +0100
committerKeir Fraser <keir@xen.org>2011-06-02 14:39:50 +0100
commit72cc91540e0f2601573222e4398b6197a80ff943 (patch)
tree85d0acc6d32d7f77c246b6c09f77234d2117c2bb /tools/libxc/xc_cpuid_x86.c
parent7a21e8ea1d296dcac2891bcdb02c4a12d1557f25 (diff)
downloadxen-72cc91540e0f2601573222e4398b6197a80ff943.tar.gz
xen-72cc91540e0f2601573222e4398b6197a80ff943.tar.bz2
xen-72cc91540e0f2601573222e4398b6197a80ff943.zip
x86: Hide CPUID leaf 7 from PV guests.
Except for the whitelisted FSGSBASE feature. Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'tools/libxc/xc_cpuid_x86.c')
-rw-r--r--tools/libxc/xc_cpuid_x86.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index c91347867d..c0d446277a 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -466,6 +466,14 @@ static void xc_cpuid_pv_policy(
set_bit(X86_FEATURE_HYPERVISOR, regs[2]);
break;
+ case 7:
+ if ( input[1] == 0 )
+ regs[1] &= bitmaskof(X86_FEATURE_FSGSBASE);
+ else
+ regs[1] = 0;
+ regs[0] = regs[2] = regs[3] = 0;
+ break;
+
case 0x0000000d:
xc_cpuid_config_xsave(xch, domid, xfeature_mask, input, regs);
break;
@@ -612,7 +620,7 @@ int xc_cpuid_apply_policy(xc_interface *xch, domid_t domid)
input[0] = 0x80000000u;
input[1] = XEN_CPUID_INPUT_UNUSED;
- if ( (input[0] == 4) || (input[0] == 0xd) )
+ if ( (input[0] == 4) || (input[0] == 7) || (input[0] == 0xd) )
input[1] = 0;
if ( (input[0] & 0x80000000u) && (input[0] > ext_max) )