xen/libxc: Clean up pv_cpuid switch statements.

Signed-off-by: Keir Fraser <keir@xen.org>
This commit is contained in:
Keir Fraser committed 2011-07-16 09:09:46 +01:00
1 parent 508424df09
commit 3f3d4fd3b5
2 files changed
+21 -14

No files matched your search

+5 -5
View File
@@ -438,7 +438,7 @@ static void xc_cpuid_pv_policy(
do_domctl(xch, &domctl);
xfeature_mask = domctl.u.vcpuextstate.xfeature_mask;
if ( (input[0] & 0x7fffffff) == 1 )
if ( (input[0] & 0x7fffffff) == 0x00000001 )
{
clear_bit(X86_FEATURE_VME, regs[3]);
clear_bit(X86_FEATURE_PSE, regs[3]);
@@ -451,7 +451,7 @@ static void xc_cpuid_pv_policy(
switch ( input[0] )
{
case 1:
case 0x00000001:
if ( !xen_64bit || strstr(brand, "AMD") )
clear_bit(X86_FEATURE_SEP, regs[3]);
clear_bit(X86_FEATURE_DS, regs[3]);
@@ -478,7 +478,7 @@ static void xc_cpuid_pv_policy(
set_bit(X86_FEATURE_HYPERVISOR, regs[2]);
break;
case 7:
case 0x00000007:
if ( input[1] == 0 )
regs[1] &= (bitmaskof(X86_FEATURE_FSGSBASE) |
bitmaskof(X86_FEATURE_ERMS));
@@ -516,8 +516,8 @@ static void xc_cpuid_pv_policy(
clear_bit(X86_FEATURE_TOPOEXT, regs[2]);
break;
case 5: /* MONITOR/MWAIT */
case 0xa: /* Architectural Performance Monitor Features */
case 0x00000005: /* MONITOR/MWAIT */
case 0x0000000a: /* Architectural Performance Monitor Features */
case 0x0000000b: /* Extended Topology Enumeration */
case 0x8000000a: /* SVM revision and features */
case 0x8000001b: /* Instruction Based Sampling */
+16 -9
View File
@@ -777,7 +777,7 @@ static void pv_cpuid(struct cpu_user_regs *regs)
: "=a" (a), "=b" (b), "=c" (c), "=d" (d)
: "0" (a), "1" (b), "2" (c), "3" (d) );
if ( (regs->eax & 0x7fffffff) == 1 )
if ( (regs->eax & 0x7fffffff) == 0x00000001 )
{
/* Modify Feature Information. */
__clear_bit(X86_FEATURE_VME, &d);
@@ -787,9 +787,10 @@ static void pv_cpuid(struct cpu_user_regs *regs)
__clear_bit(X86_FEATURE_PGE, &d);
__clear_bit(X86_FEATURE_PSE36, &d);
}
switch ( (uint32_t)regs->eax )
{
case 1:
case 0x00000001:
/* Modify Feature Information. */
if ( !cpu_has_sep )
__clear_bit(X86_FEATURE_SEP, &d);
@@ -821,7 +822,8 @@ static void pv_cpuid(struct cpu_user_regs *regs)
__clear_bit(X86_FEATURE_X2APIC % 32, &c);
__set_bit(X86_FEATURE_HYPERVISOR % 32, &c);
break;
case 7:
case 0x00000007:
if ( regs->ecx == 0 )
b &= (cpufeat_mask(X86_FEATURE_FSGSBASE) |
cpufeat_mask(X86_FEATURE_ERMS));
@@ -829,6 +831,12 @@ static void pv_cpuid(struct cpu_user_regs *regs)
b = 0;
a = c = d = 0;
break;
case 0x0000000d: /* XSAVE */
if ( !xsave_enabled(current) )
goto unsupported;
break;
case 0x80000001:
/* Modify Feature Information. */
if ( is_pv_32bit_vcpu(current) )
@@ -855,19 +863,18 @@ static void pv_cpuid(struct cpu_user_regs *regs)
__clear_bit(X86_FEATURE_NODEID_MSR % 32, &c);
__clear_bit(X86_FEATURE_TOPOEXT % 32, &c);
break;
case 0xd: /* XSAVE */
if ( xsave_enabled(current) )
break;
/* fall through */
case 5: /* MONITOR/MWAIT */
case 0xa: /* Architectural Performance Monitor Features */
case 0x00000005: /* MONITOR/MWAIT */
case 0x0000000a: /* Architectural Performance Monitor Features */
case 0x0000000b: /* Extended Topology Enumeration */
case 0x8000000a: /* SVM revision and features */
case 0x8000001b: /* Instruction Based Sampling */
case 0x8000001c: /* Light Weight Profiling */
case 0x8000001e: /* Extended topology reporting */
unsupported:
a = b = c = d = 0;
break;
default:
(void)cpuid_hypervisor_leaves(regs->eax, 0, &a, &b, &c, &d);
break;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.