uint32_t fs[FSCAPINTS], max_fs[FSCAPINTS];
unsigned int i;
+ p->x86_vendor = get_cpu_vendor(p->basic.vendor_ebx, p->basic.vendor_ecx,
+ p->basic.vendor_edx, gcv_guest);
+
p->basic.max_leaf = min(p->basic.max_leaf, max->basic.max_leaf);
p->feat.max_subleaf = min(p->feat.max_subleaf, max->feat.max_subleaf);
p->extd.max_leaf = min(p->extd.max_leaf, max->extd.max_leaf);
*res = EMPTY_LEAF;
break;
+ case 0x0:
case 0x7:
case XSTATE_CPUID:
ASSERT_UNREACHABLE();
res->a = 0;
break;
+ case 0x0:
case 0x7:
case XSTATE_CPUID:
ASSERT_UNREACHABLE();
switch ( leaf )
{
case 0 ... CPUID_GUEST_NR_BASIC - 1:
- if ( leaf > p->basic.max_leaf )
+ ASSERT(p->basic.max_leaf < ARRAY_SIZE(p->basic.raw));
+ if ( leaf > min_t(uint32_t, p->basic.max_leaf,
+ ARRAY_SIZE(p->basic.raw) - 1) )
return;
switch ( leaf )
default:
goto legacy;
+
+ case 0x0:
+ *res = p->basic.raw[leaf];
+ break;
}
break;
{
struct cpuid_policy *p = d->arch.cpuid;
const struct cpuid_leaf leaf = { ctl->eax, ctl->ebx, ctl->ecx, ctl->edx };
- int rc;
+ int rc, old_vendor = p->x86_vendor;
/*
* Skip update for leaves we don't care about. This avoids the overhead
switch ( ctl->input[0] )
{
- case 0: {
- int old_vendor = p->x86_vendor;
-
- p->x86_vendor = get_cpu_vendor(ctl->ebx, ctl->ecx, ctl->edx, gcv_guest);
-
+ case 0:
if ( is_hvm_domain(d) && (p->x86_vendor != old_vendor) )
{
struct vcpu *v;
for_each_vcpu( d, v )
hvm_update_guest_vendor(v);
}
-
break;
- }
case 1:
if ( is_pv_domain(d) && ((levelling_caps & LCAP_1cd) == LCAP_1cd) )
* - All of the feat and xstate unions
* - max_{,sub}leaf
* - All FEATURESET_* words
+ * - Low short vendor infomation
*
* Per-domain objects:
*
* - All of the feat and xstate unions
* - max_{,sub}leaf
* - All FEATURESET_* words
+ * - Low short vendor infomation
*
* Everything else should be considered inaccurate, and not necesserily 0.
*/
struct cpuid_leaf raw[CPUID_GUEST_NR_BASIC];
struct {
/* Leaf 0x0 - Max and vendor. */
- uint32_t max_leaf, /* b */:32, /* c */:32, /* d */:32;
+ uint32_t max_leaf, vendor_ebx, vendor_ecx, vendor_edx;
/* Leaf 0x1 - Family/model/stepping and features. */
uint32_t raw_fms, /* b */:32;