diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2008-07-29 13:29:24 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-30 13:49:27 -0400 |
commit | bdd8caba5ed5bb7ee21c9f061597284ffeb280bf (patch) | |
tree | 036491dc4b283979f462008bc961800847187937 /include/asm-x86/sigcontext.h | |
parent | 9dc89c0f96a6ce6a1b7f9a47dd8bf6f17e2002c9 (diff) |
x86, xsave: struct _fpstate extensions to include extended state information
Bytes 464..511 in the current 512byte layout of fxsave/fxrstor
frame, are reserved for SW usage. On cpu's supporting xsave/xrstor, these bytes
are used to extended the fpstate pointer in the sigcontext, which now includes
the extended state information along with fpstate information.
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/asm-x86/sigcontext.h')
-rw-r--r-- | include/asm-x86/sigcontext.h | 87 |
1 files changed, 83 insertions, 4 deletions
diff --git a/include/asm-x86/sigcontext.h b/include/asm-x86/sigcontext.h index 24879c85b291..899fe2f8abb9 100644 --- a/include/asm-x86/sigcontext.h +++ b/include/asm-x86/sigcontext.h | |||
@@ -4,6 +4,40 @@ | |||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <asm/types.h> | 5 | #include <asm/types.h> |
6 | 6 | ||
7 | #define FP_XSTATE_MAGIC1 0x46505853U | ||
8 | #define FP_XSTATE_MAGIC2 0x46505845U | ||
9 | #define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2) | ||
10 | |||
11 | /* | ||
12 | * bytes 464..511 in the current 512byte layout of fxsave/fxrstor frame | ||
13 | * are reserved for SW usage. On cpu's supporting xsave/xrstor, these bytes | ||
14 | * are used to extended the fpstate pointer in the sigcontext, which now | ||
15 | * includes the extended state information along with fpstate information. | ||
16 | * | ||
17 | * Presence of FP_XSTATE_MAGIC1 at the beginning of this SW reserved | ||
18 | * area and FP_XSTATE_MAGIC2 at the end of memory layout | ||
19 | * (extended_size - FP_XSTATE_MAGIC2_SIZE) indicates the presence of the | ||
20 | * extended state information in the memory layout pointed by the fpstate | ||
21 | * pointer in sigcontext. | ||
22 | */ | ||
23 | struct _fpx_sw_bytes { | ||
24 | __u32 magic1; /* FP_XSTATE_MAGIC1 */ | ||
25 | __u32 extended_size; /* total size of the layout referred by | ||
26 | * fpstate pointer in the sigcontext. | ||
27 | */ | ||
28 | __u64 xstate_bv; | ||
29 | /* feature bit mask (including fp/sse/extended | ||
30 | * state) that is present in the memory | ||
31 | * layout. | ||
32 | */ | ||
33 | __u32 xstate_size; /* actual xsave state size, based on the | ||
34 | * features saved in the layout. | ||
35 | * 'extended_size' will be greater than | ||
36 | * 'xstate_size'. | ||
37 | */ | ||
38 | __u32 padding[7]; /* for future use. */ | ||
39 | }; | ||
40 | |||
7 | #ifdef __i386__ | 41 | #ifdef __i386__ |
8 | /* | 42 | /* |
9 | * As documented in the iBCS2 standard.. | 43 | * As documented in the iBCS2 standard.. |
@@ -53,7 +87,13 @@ struct _fpstate { | |||
53 | unsigned long reserved; | 87 | unsigned long reserved; |
54 | struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ | 88 | struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ |
55 | struct _xmmreg _xmm[8]; | 89 | struct _xmmreg _xmm[8]; |
56 | unsigned long padding[56]; | 90 | unsigned long padding1[44]; |
91 | |||
92 | union { | ||
93 | unsigned long padding2[12]; | ||
94 | struct _fpx_sw_bytes sw_reserved; /* represents the extended | ||
95 | * state info */ | ||
96 | }; | ||
57 | }; | 97 | }; |
58 | 98 | ||
59 | #define X86_FXSR_MAGIC 0x0000 | 99 | #define X86_FXSR_MAGIC 0x0000 |
@@ -79,7 +119,15 @@ struct sigcontext { | |||
79 | unsigned long flags; | 119 | unsigned long flags; |
80 | unsigned long sp_at_signal; | 120 | unsigned long sp_at_signal; |
81 | unsigned short ss, __ssh; | 121 | unsigned short ss, __ssh; |
82 | struct _fpstate __user *fpstate; | 122 | |
123 | /* | ||
124 | * fpstate is really (struct _fpstate *) or (struct _xstate *) | ||
125 | * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved | ||
126 | * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end | ||
127 | * of extended memory layout. See comments at the defintion of | ||
128 | * (struct _fpx_sw_bytes) | ||
129 | */ | ||
130 | void __user *fpstate; /* zero when no FPU/extended context */ | ||
83 | unsigned long oldmask; | 131 | unsigned long oldmask; |
84 | unsigned long cr2; | 132 | unsigned long cr2; |
85 | }; | 133 | }; |
@@ -130,7 +178,12 @@ struct _fpstate { | |||
130 | __u32 mxcsr_mask; | 178 | __u32 mxcsr_mask; |
131 | __u32 st_space[32]; /* 8*16 bytes for each FP-reg */ | 179 | __u32 st_space[32]; /* 8*16 bytes for each FP-reg */ |
132 | __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */ | 180 | __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */ |
133 | __u32 reserved2[24]; | 181 | __u32 reserved2[12]; |
182 | union { | ||
183 | __u32 reserved3[12]; | ||
184 | struct _fpx_sw_bytes sw_reserved; /* represents the extended | ||
185 | * state information */ | ||
186 | }; | ||
134 | }; | 187 | }; |
135 | 188 | ||
136 | #ifdef __KERNEL__ | 189 | #ifdef __KERNEL__ |
@@ -161,7 +214,15 @@ struct sigcontext { | |||
161 | unsigned long trapno; | 214 | unsigned long trapno; |
162 | unsigned long oldmask; | 215 | unsigned long oldmask; |
163 | unsigned long cr2; | 216 | unsigned long cr2; |
164 | struct _fpstate __user *fpstate; /* zero when no FPU context */ | 217 | |
218 | /* | ||
219 | * fpstate is really (struct _fpstate *) or (struct _xstate *) | ||
220 | * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved | ||
221 | * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end | ||
222 | * of extended memory layout. See comments at the defintion of | ||
223 | * (struct _fpx_sw_bytes) | ||
224 | */ | ||
225 | void __user *fpstate; /* zero when no FPU/extended context */ | ||
165 | unsigned long reserved1[8]; | 226 | unsigned long reserved1[8]; |
166 | }; | 227 | }; |
167 | #else /* __KERNEL__ */ | 228 | #else /* __KERNEL__ */ |
@@ -202,4 +263,22 @@ struct sigcontext { | |||
202 | 263 | ||
203 | #endif /* !__i386__ */ | 264 | #endif /* !__i386__ */ |
204 | 265 | ||
266 | struct _xsave_hdr { | ||
267 | u64 xstate_bv; | ||
268 | u64 reserved1[2]; | ||
269 | u64 reserved2[5]; | ||
270 | }; | ||
271 | |||
272 | /* | ||
273 | * Extended state pointed by the fpstate pointer in the sigcontext. | ||
274 | * In addition to the fpstate, information encoded in the xstate_hdr | ||
275 | * indicates the presence of other extended state information | ||
276 | * supported by the processor and OS. | ||
277 | */ | ||
278 | struct _xstate { | ||
279 | struct _fpstate fpstate; | ||
280 | struct _xsave_hdr xstate_hdr; | ||
281 | /* new processor state extensions go here */ | ||
282 | }; | ||
283 | |||
205 | #endif /* ASM_X86__SIGCONTEXT_H */ | 284 | #endif /* ASM_X86__SIGCONTEXT_H */ |