diff options
Diffstat (limited to 'arch/x86/include/asm/xsave.h')
-rw-r--r-- | arch/x86/include/asm/xsave.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index 2c4390cae228..06acdbd7570a 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h | |||
@@ -13,6 +13,12 @@ | |||
13 | 13 | ||
14 | #define FXSAVE_SIZE 512 | 14 | #define FXSAVE_SIZE 512 |
15 | 15 | ||
16 | #define XSAVE_HDR_SIZE 64 | ||
17 | #define XSAVE_HDR_OFFSET FXSAVE_SIZE | ||
18 | |||
19 | #define XSAVE_YMM_SIZE 256 | ||
20 | #define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET) | ||
21 | |||
16 | /* | 22 | /* |
17 | * These are the features that the OS can handle currently. | 23 | * These are the features that the OS can handle currently. |
18 | */ | 24 | */ |
@@ -59,6 +65,16 @@ static inline int fpu_xrstor_checking(struct fpu *fpu) | |||
59 | static inline int xsave_user(struct xsave_struct __user *buf) | 65 | static inline int xsave_user(struct xsave_struct __user *buf) |
60 | { | 66 | { |
61 | int err; | 67 | int err; |
68 | |||
69 | /* | ||
70 | * Clear the xsave header first, so that reserved fields are | ||
71 | * initialized to zero. | ||
72 | */ | ||
73 | err = __clear_user(&buf->xsave_hdr, | ||
74 | sizeof(struct xsave_hdr_struct)); | ||
75 | if (unlikely(err)) | ||
76 | return -EFAULT; | ||
77 | |||
62 | __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" | 78 | __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" |
63 | "2:\n" | 79 | "2:\n" |
64 | ".section .fixup,\"ax\"\n" | 80 | ".section .fixup,\"ax\"\n" |