return 0;
}
+static void domain_cpuid(const struct domain *d, uint32_t leaf,
+ uint32_t subleaf, struct cpuid_leaf *res)
+{
+ unsigned int i;
+
+ for ( i = 0; i < MAX_CPUID_INPUT; i++ )
+ {
+ cpuid_input_t *cpuid = &d->arch.cpuids[i];
+
+ if ( (cpuid->input[0] == leaf) &&
+ ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) ||
+ (cpuid->input[1] == subleaf)) )
+ {
+ *res = (struct cpuid_leaf){ cpuid->eax, cpuid->ebx,
+ cpuid->ecx, cpuid->edx };
+ return;
+ }
+ }
+}
+
static void pv_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res)
{
struct vcpu *curr = current;
const struct cpuid_policy *p = currd->arch.cpuid;
if ( !is_control_domain(currd) && !is_hardware_domain(currd) )
- domain_cpuid(currd, leaf, subleaf, &res->a, &res->b, &res->c, &res->d);
+ domain_cpuid(currd, leaf, subleaf, res);
else
cpuid_count_leaf(leaf, subleaf, res);
struct domain *d = v->domain;
const struct cpuid_policy *p = d->arch.cpuid;
- domain_cpuid(d, leaf, subleaf, &res->a, &res->b, &res->c, &res->d);
+ domain_cpuid(d, leaf, subleaf, res);
switch ( leaf )
{
vpmu_dump(v);
}
-void domain_cpuid(
- const struct domain *d,
- unsigned int input,
- unsigned int sub_input,
- unsigned int *eax,
- unsigned int *ebx,
- unsigned int *ecx,
- unsigned int *edx)
-{
- cpuid_input_t *cpuid;
- int i;
-
- for ( i = 0; i < MAX_CPUID_INPUT; i++ )
- {
- cpuid = &d->arch.cpuids[i];
-
- if ( (cpuid->input[0] == input) &&
- ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) ||
- (cpuid->input[1] == sub_input)) )
- {
- *eax = cpuid->eax;
- *ebx = cpuid->ebx;
- *ecx = cpuid->ecx;
- *edx = cpuid->edx;
-
- /*
- * Do not advertise host's invariant TSC unless the TSC is
- * emulated, or the domain cannot migrate to other hosts.
- */
- if ( (input == 0x80000007) && /* Advanced Power Management */
- !d->disable_migrate && !d->arch.vtsc )
- *edx &= ~cpufeat_mask(X86_FEATURE_ITSC);
-
- return;
- }
- }
-
- *eax = *ebx = *ecx = *edx = 0;
-}
-
void vcpu_kick(struct vcpu *v)
{
/*
X86_CR4_OSXSAVE | X86_CR4_SMEP | \
X86_CR4_FSGSBASE | X86_CR4_SMAP))
-void domain_cpuid(const struct domain *d,
- unsigned int input,
- unsigned int sub_input,
- unsigned int *eax,
- unsigned int *ebx,
- unsigned int *ecx,
- unsigned int *edx);
-
#define domain_max_vcpus(d) (is_hvm_domain(d) ? HVM_MAX_VCPUS : MAX_VIRT_CPUS)
static inline struct vcpu_guest_context *alloc_vcpu_guest_context(void)