summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/i387.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-29 17:23:16 -0700
committerIngo Molnar <mingo@elte.hu>2008-07-30 19:50:35 +0200
commit6152e4b1c99a3689fc318d092cd144597f7dbd14 (patch)
tree8d0590b7ea931da237d037db1bbff5aa0bf1ef34 /arch/x86/kernel/i387.c
parentb4a091a62c8e91d6077e575600363cff73fa02ef (diff)
x86, xsave: keep the XSAVE feature mask as an u64
The XSAVE feature mask is a 64-bit number; keep it that way, in order to avoid the mistake done with rdmsr/wrmsr. Use the xsetbv() function provided in the previous patch. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/i387.c')
-rw-r--r--arch/x86/kernel/i387.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index e0ed59f5c19..45723f1fe19 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -552,18 +552,17 @@ static int restore_i387_xsave(void __user *buf)
(struct i387_fxsave_struct __user *) &fx_user->_fxsr_env[0];
struct xsave_hdr_struct *xsave_hdr =
&current->thread.xstate->xsave.xsave_hdr;
- unsigned int lmask, hmask;
+ u64 mask;
int err;
if (check_for_xstate(fx, buf, &fx_sw_user))
goto fx_only;
- lmask = fx_sw_user.xstate_bv;
- hmask = fx_sw_user.xstate_bv >> 32;
+ mask = fx_sw_user.xstate_bv;
err = restore_i387_fxsave(buf, fx_sw_user.xstate_size);
- xsave_hdr->xstate_bv &= (pcntxt_lmask | (((u64) pcntxt_hmask) << 32));
+ xsave_hdr->xstate_bv &= pcntxt_mask;
/*
* These bits must be zero.
*/
@@ -573,9 +572,8 @@ static int restore_i387_xsave(void __user *buf)
* Init the state that is not present in the memory layout
* and enabled by the OS.
*/
- lmask = ~(pcntxt_lmask & ~lmask);
- hmask = ~(pcntxt_hmask & ~hmask);
- xsave_hdr->xstate_bv &= (lmask | (((u64) hmask) << 32));
+ mask = ~(pcntxt_mask & ~mask);
+ xsave_hdr->xstate_bv &= mask;
return err;
fx_only: