xstate.h 1.7 KB
Newer Older
1 2 3
#ifndef __ASM_X86_XSAVE_H
#define __ASM_X86_XSAVE_H

4
#include <linux/types.h>
5
#include <asm/processor.h>
6
#include <linux/uaccess.h>
7

8
/* Bit 63 of XCR0 is reserved for future expansion */
D
Dave Hansen 已提交
9
#define XFEATURE_MASK_EXTEND	(~(XFEATURE_MASK_FPSSE | (1ULL << 63)))
10

I
Ingo Molnar 已提交
11 12
#define XSTATE_CPUID		0x0000000d

13 14
#define FXSAVE_SIZE	512

15 16 17 18 19
#define XSAVE_HDR_SIZE	    64
#define XSAVE_HDR_OFFSET    FXSAVE_SIZE

#define XSAVE_YMM_SIZE	    256
#define XSAVE_YMM_OFFSET    (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET)
S
Sheng Yang 已提交
20

21 22 23
/* Supervisor features */
#define XFEATURE_MASK_SUPERVISOR (XFEATURE_MASK_PT)

24
/* Supported features which support lazy state saving */
D
Dave Hansen 已提交
25
#define XFEATURE_MASK_LAZY	(XFEATURE_MASK_FP | \
26
				 XFEATURE_MASK_SSE | \
D
Dave Hansen 已提交
27
				 XFEATURE_MASK_YMM | \
28
				 XFEATURE_MASK_OPMASK | \
D
Dave Hansen 已提交
29
				 XFEATURE_MASK_ZMM_Hi256 | \
30 31
				 XFEATURE_MASK_Hi16_ZMM	 | \
				 XFEATURE_MASK_PKRU)
32

33 34 35
/* Supported features which require eager state saving */
#define XFEATURE_MASK_EAGER	(XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR)

36
/* All currently supported features */
D
Dave Hansen 已提交
37
#define XCNTXT_MASK	(XFEATURE_MASK_LAZY | XFEATURE_MASK_EAGER)
38

39 40 41 42 43 44
#ifdef CONFIG_X86_64
#define REX_PREFIX	"0x48, "
#else
#define REX_PREFIX
#endif

45
extern u64 xfeatures_mask;
46
extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
47

48 49
extern void __init update_regset_xstate_info(unsigned int size,
					     u64 xstate_mask);
50

51
void fpu__xstate_clear_all_cpu_caps(void);
52
void *get_xsave_addr(struct xregs_state *xsave, int xstate);
53
const void *get_xsave_field_ptr(int xstate_field);
54
int using_compacted_format(void);
55 56 57 58
int copyout_from_xsaves(unsigned int pos, unsigned int count, void *kbuf,
			void __user *ubuf, struct xregs_state *xsave);
int copyin_to_xsaves(const void *kbuf, const void __user *ubuf,
		     struct xregs_state *xsave);
59
#endif