Commit | Line | Data |
---|---|---|
dc1e35c6 SS |
1 | #ifndef __ASM_X86_XSAVE_H |
2 | #define __ASM_X86_XSAVE_H | |
3 | ||
6152e4b1 | 4 | #include <linux/types.h> |
dc1e35c6 | 5 | #include <asm/processor.h> |
59a36d16 | 6 | #include <linux/uaccess.h> |
dc1e35c6 | 7 | |
56c103ec | 8 | /* Bit 63 of XCR0 is reserved for future expansion */ |
d91cab78 | 9 | #define XFEATURE_MASK_EXTEND (~(XFEATURE_MASK_FPSSE | (1ULL << 63))) |
dc1e35c6 | 10 | |
677b98bd IM |
11 | #define XSTATE_CPUID 0x0000000d |
12 | ||
dc1e35c6 SS |
13 | #define FXSAVE_SIZE 512 |
14 | ||
2d5b5a66 SY |
15 | #define XSAVE_HDR_SIZE 64 |
16 | #define XSAVE_HDR_OFFSET FXSAVE_SIZE | |
17 | ||
18 | #define XSAVE_YMM_SIZE 256 | |
19 | #define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET) | |
5ee481da | 20 | |
1499ce2d YY |
21 | /* Supervisor features */ |
22 | #define XFEATURE_MASK_SUPERVISOR (XFEATURE_MASK_PT) | |
23 | ||
e7d820a5 | 24 | /* Supported features which support lazy state saving */ |
d91cab78 | 25 | #define XFEATURE_MASK_LAZY (XFEATURE_MASK_FP | \ |
a65050c6 | 26 | XFEATURE_MASK_SSE | \ |
d91cab78 | 27 | XFEATURE_MASK_YMM | \ |
394db20c | 28 | XFEATURE_MASK_OPMASK | \ |
d91cab78 | 29 | XFEATURE_MASK_ZMM_Hi256 | \ |
6a667db2 | 30 | XFEATURE_MASK_Hi16_ZMM) |
e7d820a5 | 31 | |
a65050c6 | 32 | /* Supported features which require eager state saving */ |
6a667db2 DH |
33 | #define XFEATURE_MASK_EAGER (XFEATURE_MASK_BNDREGS | \ |
34 | XFEATURE_MASK_BNDCSR | \ | |
35 | XFEATURE_MASK_PKRU) | |
a65050c6 | 36 | |
e7d820a5 | 37 | /* All currently supported features */ |
d91cab78 | 38 | #define XCNTXT_MASK (XFEATURE_MASK_LAZY | XFEATURE_MASK_EAGER) |
dc1e35c6 | 39 | |
b359e8a4 SS |
40 | #ifdef CONFIG_X86_64 |
41 | #define REX_PREFIX "0x48, " | |
42 | #else | |
43 | #define REX_PREFIX | |
44 | #endif | |
45 | ||
614df7fb | 46 | extern u64 xfeatures_mask; |
5b3efd50 | 47 | extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS]; |
dc1e35c6 | 48 | |
5b3efd50 | 49 | extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask); |
b359e8a4 | 50 | |
0a265375 | 51 | void fpu__xstate_clear_all_cpu_caps(void); |
c47ada30 | 52 | void *get_xsave_addr(struct xregs_state *xsave, int xstate); |
04cd027b | 53 | const void *get_xsave_field_ptr(int xstate_field); |
99aa22d0 | 54 | int using_compacted_format(void); |
91c3dba7 YY |
55 | int copyout_from_xsaves(unsigned int pos, unsigned int count, void *kbuf, |
56 | void __user *ubuf, struct xregs_state *xsave); | |
57 | int copyin_to_xsaves(const void *kbuf, const void __user *ubuf, | |
58 | struct xregs_state *xsave); | |
dc1e35c6 | 59 | #endif |