[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 3/3] Nested VMX: Fix IA32_VMX_CR4_FIXED1 msr emulation



>>> On 10.09.13 at 08:14, Yang Zhang <yang.z.zhang@xxxxxxxxx> wrote:
> +        hvm_cpuid(0x0, &eax, &ebx, &ecx, &edx);
> +        if ( eax >= 0xa )
> +        {
> +            hvm_cpuid(0xa, &eax, &ebx, &ecx, &edx);
> +            /* Check whether guest has the perf monitor feature. */
> +            if ( (eax & 0xff) && (eax & 0xff00) )
> +                data |= X86_CR4_PCE;
> +        }
> +        else if ( eax >= 0x7 )
> +        {
> +            hvm_cpuid(0x7, &eax, &ebx, &ecx, &edx);
> +            if ( ebx & cpufeat_mask(X86_FEATURE_FSGSBASE) )
> +                data |= X86_CR4_FSGSBASE;
> +            if ( ebx & cpufeat_mask(X86_FEATURE_SMEP) )
> +                data |= X86_CR4_SMEP;
> +            if ( ebx & cpufeat_mask(X86_FEATURE_SMAP) )
> +                data |= X86_CR4_SMAP;
> +        }

I told you on v1 already that if/else-if doesn't work here: If the
maximum leaf is 10 or higher, the last three bits will never get
set. Either you need to retain the use of another variable for the
maximum leaf, or (my preference) you need to use a switch
statement with suitably annotated fall through.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.