diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2008-07-29 13:29:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-30 13:49:27 -0400 |
commit | c37b5efea43f9e500363f9973dd00e3d2cdcc685 (patch) | |
tree | 9ce635f1672099dafcd78e535b4ea18d80235d8f /include | |
parent | bdd8caba5ed5bb7ee21c9f061597284ffeb280bf (diff) |
x86, xsave: save/restore the extended state context in sigframe
On cpu's supporting xsave/xrstor, fpstate pointer in the sigcontext, will
include the extended state information along with fpstate information. Presence
of extended state information is indicated by the presence
of FP_XSTATE_MAGIC1 at fpstate.sw_reserved.magic1 and FP_XSTATE_MAGIC2
at fpstate + (fpstate.sw_reserved.extended_size - FP_XSTATE_MAGIC2_SIZE).
Extended feature bit mask that is saved in the memory layout is represented
by the fpstate.sw_reserved.xstate_bv
For RT signal frames, UC_FP_XSTATE in the uc_flags also indicate the
presence of extended state information in the sigcontext's fpstate
pointer.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/i387.h | 4 | ||||
-rw-r--r-- | include/asm-x86/ucontext.h | 6 | ||||
-rw-r--r-- | include/asm-x86/xsave.h | 5 |
3 files changed, 13 insertions, 2 deletions
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h index dc3745e8040a..d3dda7161954 100644 --- a/include/asm-x86/i387.h +++ b/include/asm-x86/i387.h | |||
@@ -31,8 +31,10 @@ extern user_regset_active_fn fpregs_active, xfpregs_active; | |||
31 | extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get; | 31 | extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get; |
32 | extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set; | 32 | extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set; |
33 | 33 | ||
34 | extern struct _fpx_sw_bytes fx_sw_reserved; | ||
34 | #ifdef CONFIG_IA32_EMULATION | 35 | #ifdef CONFIG_IA32_EMULATION |
35 | extern unsigned int sig_xstate_ia32_size; | 36 | extern unsigned int sig_xstate_ia32_size; |
37 | extern struct _fpx_sw_bytes fx_sw_reserved_ia32; | ||
36 | struct _fpstate_ia32; | 38 | struct _fpstate_ia32; |
37 | struct _xstate_ia32; | 39 | struct _xstate_ia32; |
38 | extern int save_i387_xstate_ia32(void __user *buf); | 40 | extern int save_i387_xstate_ia32(void __user *buf); |
@@ -104,7 +106,7 @@ static inline void clear_fpu_state(struct task_struct *tsk) | |||
104 | X86_FEATURE_FXSAVE_LEAK); | 106 | X86_FEATURE_FXSAVE_LEAK); |
105 | } | 107 | } |
106 | 108 | ||
107 | static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) | 109 | static inline int fxsave_user(struct i387_fxsave_struct __user *fx) |
108 | { | 110 | { |
109 | int err; | 111 | int err; |
110 | 112 | ||
diff --git a/include/asm-x86/ucontext.h b/include/asm-x86/ucontext.h index 9948dd328084..89eaa5456a7e 100644 --- a/include/asm-x86/ucontext.h +++ b/include/asm-x86/ucontext.h | |||
@@ -1,6 +1,12 @@ | |||
1 | #ifndef ASM_X86__UCONTEXT_H | 1 | #ifndef ASM_X86__UCONTEXT_H |
2 | #define ASM_X86__UCONTEXT_H | 2 | #define ASM_X86__UCONTEXT_H |
3 | 3 | ||
4 | #define UC_FP_XSTATE 0x1 /* indicates the presence of extended state | ||
5 | * information in the memory layout pointed | ||
6 | * by the fpstate pointer in the ucontext's | ||
7 | * sigcontext struct (uc_mcontext). | ||
8 | */ | ||
9 | |||
4 | struct ucontext { | 10 | struct ucontext { |
5 | unsigned long uc_flags; | 11 | unsigned long uc_flags; |
6 | struct ucontext *uc_link; | 12 | struct ucontext *uc_link; |
diff --git a/include/asm-x86/xsave.h b/include/asm-x86/xsave.h index b716511aede2..b7f64b9fcd94 100644 --- a/include/asm-x86/xsave.h +++ b/include/asm-x86/xsave.h | |||
@@ -29,6 +29,9 @@ extern struct xsave_struct *init_xstate_buf; | |||
29 | extern void xsave_cntxt_init(void); | 29 | extern void xsave_cntxt_init(void); |
30 | extern void xsave_init(void); | 30 | extern void xsave_init(void); |
31 | extern int init_fpu(struct task_struct *child); | 31 | extern int init_fpu(struct task_struct *child); |
32 | extern int check_for_xstate(struct i387_fxsave_struct __user *buf, | ||
33 | void __user *fpstate, | ||
34 | struct _fpx_sw_bytes *sw); | ||
32 | 35 | ||
33 | static inline int xrstor_checking(struct xsave_struct *fx) | 36 | static inline int xrstor_checking(struct xsave_struct *fx) |
34 | { | 37 | { |
@@ -48,7 +51,7 @@ static inline int xrstor_checking(struct xsave_struct *fx) | |||
48 | return err; | 51 | return err; |
49 | } | 52 | } |
50 | 53 | ||
51 | static inline int xsave_check(struct xsave_struct __user *buf) | 54 | static inline int xsave_user(struct xsave_struct __user *buf) |
52 | { | 55 | { |
53 | int err; | 56 | int err; |
54 | __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" | 57 | __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n" |