aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/xsave.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-29 20:23:16 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-30 13:50:35 -0400
commit6152e4b1c99a3689fc318d092cd144597f7dbd14 (patch)
tree8d0590b7ea931da237d037db1bbff5aa0bf1ef34 /include/asm-x86/xsave.h
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 'include/asm-x86/xsave.h')
-rw-r--r--include/asm-x86/xsave.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/asm-x86/xsave.h b/include/asm-x86/xsave.h
index b7f64b9fcd94..08e9a1ac07a9 100644
--- a/include/asm-x86/xsave.h
+++ b/include/asm-x86/xsave.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_X86_XSAVE_H 1#ifndef __ASM_X86_XSAVE_H
2#define __ASM_X86_XSAVE_H 2#define __ASM_X86_XSAVE_H
3 3
4#include <linux/types.h>
4#include <asm/processor.h> 5#include <asm/processor.h>
5#include <asm/i387.h> 6#include <asm/i387.h>
6 7
@@ -14,8 +15,7 @@
14/* 15/*
15 * These are the features that the OS can handle currently. 16 * These are the features that the OS can handle currently.
16 */ 17 */
17#define XCNTXT_LMASK (XSTATE_FP | XSTATE_SSE) 18#define XCNTXT_MASK (XSTATE_FP | XSTATE_SSE)
18#define XCNTXT_HMASK 0x0
19 19
20#ifdef CONFIG_X86_64 20#ifdef CONFIG_X86_64
21#define REX_PREFIX "0x48, " 21#define REX_PREFIX "0x48, "
@@ -23,7 +23,8 @@
23#define REX_PREFIX 23#define REX_PREFIX
24#endif 24#endif
25 25
26extern unsigned int xstate_size, pcntxt_hmask, pcntxt_lmask; 26extern unsigned int xstate_size;
27extern u64 pcntxt_mask;
27extern struct xsave_struct *init_xstate_buf; 28extern struct xsave_struct *init_xstate_buf;
28 29
29extern void xsave_cntxt_init(void); 30extern void xsave_cntxt_init(void);
@@ -73,12 +74,12 @@ static inline int xsave_user(struct xsave_struct __user *buf)
73 return err; 74 return err;
74} 75}
75 76
76static inline int xrestore_user(struct xsave_struct __user *buf, 77static inline int xrestore_user(struct xsave_struct __user *buf, u64 mask)
77 unsigned int lmask,
78 unsigned int hmask)
79{ 78{
80 int err; 79 int err;
81 struct xsave_struct *xstate = ((__force struct xsave_struct *)buf); 80 struct xsave_struct *xstate = ((__force struct xsave_struct *)buf);
81 u32 lmask = mask;
82 u32 hmask = mask >> 32;
82 83
83 __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x2f\n" 84 __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x2f\n"
84 "2:\n" 85 "2:\n"
@@ -96,8 +97,11 @@ static inline int xrestore_user(struct xsave_struct __user *buf,
96 return err; 97 return err;
97} 98}
98 99
99static inline void xrstor_state(struct xsave_struct *fx, int lmask, int hmask) 100static inline void xrstor_state(struct xsave_struct *fx, u64 mask)
100{ 101{
102 u32 lmask = mask;
103 u32 hmask = mask >> 32;
104
101 asm volatile(".byte " REX_PREFIX "0x0f,0xae,0x2f\n\t" 105 asm volatile(".byte " REX_PREFIX "0x0f,0xae,0x2f\n\t"
102 : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) 106 : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
103 : "memory"); 107 : "memory");