From: Shan Haitao Date: Thu, 13 Oct 2011 14:58:55 +0000 (+0100) Subject: x86: Further fixes for xsave leaf in pv_cpuid(). X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=654ef0997984ce77544ddac7dcdb150e1f63e505;p=xen.git x86: Further fixes for xsave leaf in pv_cpuid(). Signed-off-by: Shan Haitao Committed-by: Keir Fraser --- diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index e22e6d86fc..eecdb4d201 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -768,16 +768,18 @@ static void pv_cpuid(struct cpu_user_regs *regs) if ( current->domain->domain_id != 0 ) { + unsigned int cpuid_leaf = a, sub_leaf = c; + if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) ) domain_cpuid(current->domain, a, c, &a, &b, &c, &d); - switch ( a ) + switch ( cpuid_leaf ) { case 0xd: { - unsigned int sub_leaf, _eax, _ebx, _ecx, _edx; + unsigned int _eax, _ebx, _ecx, _edx; /* EBX value of main leaf 0 depends on enabled xsave features */ - if ( c == 0 && current->arch.xcr0 ) + if ( sub_leaf == 0 && current->arch.xcr0 ) { /* reset EBX to default value first */ b = XSTATE_AREA_MIN_SIZE; @@ -785,8 +787,8 @@ static void pv_cpuid(struct cpu_user_regs *regs) { if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) ) continue; - domain_cpuid(current->domain, a, c, &_eax, &_ebx, &_ecx, - &_edx); + domain_cpuid(current->domain, cpuid_leaf, sub_leaf, + &_eax, &_ebx, &_ecx, &_edx); if ( (_eax + _ebx) > b ) b = _eax + _ebx; }