aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/traps.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-06-04 17:25:41 +0200
committerJan Beulich <jbeulich@suse.com>2013-06-04 17:25:41 +0200
commit10b2b21a241795394637167bd4b076f2de17741f (patch)
tree1c69c4e55a295502a3c6c92e5dd359862a95865c /xen/arch/x86/traps.c
parent10f969150025498fe27d985f9021a68f8c7acc31 (diff)
downloadxen-10b2b21a241795394637167bd4b076f2de17741f.tar.gz
xen-10b2b21a241795394637167bd4b076f2de17741f.tar.bz2
xen-10b2b21a241795394637167bd4b076f2de17741f.zip
x86: fix XCR0 handling
- both VMX and SVM ignored the ECX input to XSETBV - both SVM and VMX used the full 64-bit RAX when calculating the input mask to XSETBV - faults on XSETBV did not get recovered from Also consolidate the handling for PV and HVM into a single function, and make the per-CPU variable "xcr0" static to xstate.c. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Diffstat (limited to 'xen/arch/x86/traps.c')
-rw-r--r--xen/arch/x86/traps.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index ef964c3e39..57dbd0c120 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2198,25 +2198,9 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
if ( !guest_kernel_mode(v, regs) )
goto fail;
- switch ( (u32)regs->ecx )
- {
- case XCR_XFEATURE_ENABLED_MASK:
- /* bit 0 of XCR0 must be set and reserved bit must not be set */
- if ( !(new_xfeature & XSTATE_FP) || (new_xfeature & ~xfeature_mask) )
- goto fail;
-
- /* YMM state takes SSE state as prerequisite. */
- if ( (xfeature_mask & new_xfeature & XSTATE_YMM) &&
- !(new_xfeature & XSTATE_SSE) )
- goto fail;
-
- v->arch.xcr0 = new_xfeature;
- v->arch.xcr0_accum |= new_xfeature;
- set_xcr0(new_xfeature);
- break;
- default:
- goto fail;
- }
+ if ( handle_xsetbv(regs->ecx, new_xfeature) )
+ goto fail;
+
break;
}
default: