[PATCH v5 12/13] x86/xsaves: Fix fpstate_init() for XSAVES

From: Yu-cheng Yu
Date: Mon May 09 2016 - 16:52:05 EST


When XSAVES is used, xsave.header.xcomp_bv[63] must be set.

Signed-off-by: Yu-cheng Yu <yu-cheng.yu@xxxxxxxxx>
---
arch/x86/kernel/fpu/core.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 41ab106..25e2605 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -224,6 +224,9 @@ void fpstate_init(union fpregs_state *state)

memset(state, 0, kernel_xstate_size);

+ if (cpu_has_xsaves)
+ state->xsave.header.xcomp_bv = (u64)1 << 63;
+
if (cpu_has_fxsr)
fpstate_init_fxstate(&state->fxsave);
else
--
1.9.1