diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-07-29 20:23:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-30 13:50:35 -0400 |
commit | 6152e4b1c99a3689fc318d092cd144597f7dbd14 (patch) | |
tree | 8d0590b7ea931da237d037db1bbff5aa0bf1ef34 /arch/x86/kernel/i387.c | |
parent | b4a091a62c8e91d6077e575600363cff73fa02ef (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.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index e0ed59f5c19f..45723f1fe198 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) | |||
552 | (struct i387_fxsave_struct __user *) &fx_user->_fxsr_env[0]; | 552 | (struct i387_fxsave_struct __user *) &fx_user->_fxsr_env[0]; |
553 | struct xsave_hdr_struct *xsave_hdr = | 553 | struct xsave_hdr_struct *xsave_hdr = |
554 | ¤t->thread.xstate->xsave.xsave_hdr; | 554 | ¤t->thread.xstate->xsave.xsave_hdr; |
555 | unsigned int lmask, hmask; | 555 | u64 mask; |
556 | int err; | 556 | int err; |
557 | 557 | ||
558 | if (check_for_xstate(fx, buf, &fx_sw_user)) | 558 | if (check_for_xstate(fx, buf, &fx_sw_user)) |
559 | goto fx_only; | 559 | goto fx_only; |
560 | 560 | ||
561 | lmask = fx_sw_user.xstate_bv; | 561 | mask = fx_sw_user.xstate_bv; |
562 | hmask = fx_sw_user.xstate_bv >> 32; | ||
563 | 562 | ||
564 | err = restore_i387_fxsave(buf, fx_sw_user.xstate_size); | 563 | err = restore_i387_fxsave(buf, fx_sw_user.xstate_size); |
565 | 564 | ||
566 | xsave_hdr->xstate_bv &= (pcntxt_lmask | (((u64) pcntxt_hmask) << 32)); | 565 | xsave_hdr->xstate_bv &= pcntxt_mask; |
567 | /* | 566 | /* |
568 | * These bits must be zero. | 567 | * These bits must be zero. |
569 | */ | 568 | */ |
@@ -573,9 +572,8 @@ static int restore_i387_xsave(void __user *buf) | |||
573 | * Init the state that is not present in the memory layout | 572 | * Init the state that is not present in the memory layout |
574 | * and enabled by the OS. | 573 | * and enabled by the OS. |
575 | */ | 574 | */ |
576 | lmask = ~(pcntxt_lmask & ~lmask); | 575 | mask = ~(pcntxt_mask & ~mask); |
577 | hmask = ~(pcntxt_hmask & ~hmask); | 576 | xsave_hdr->xstate_bv &= mask; |
578 | xsave_hdr->xstate_bv &= (lmask | (((u64) hmask) << 32)); | ||
579 | 577 | ||
580 | return err; | 578 | return err; |
581 | fx_only: | 579 | fx_only: |