1 #ifndef _ASM_X86_SIGCONTEXT_H
2 #define _ASM_X86_SIGCONTEXT_H
4 #include <linux/compiler.h>
5 #include <linux/types.h>
7 #define FP_XSTATE_MAGIC1 0x46505853U
8 #define FP_XSTATE_MAGIC2 0x46505845U
9 #define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
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.
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.
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.
29 /* feature bit mask (including fp/sse/extended
30 * state) that is present in the memory
33 __u32 xstate_size; /* actual xsave state size, based on the
34 * features saved in the layout.
35 * 'extended_size' will be greater than
38 __u32 padding[7]; /* for future use. */
43 * As documented in the iBCS2 standard..
45 * The first part of "struct _fpstate" is just the normal i387
46 * hardware setup, the extra "status" word is used to save the
47 * coprocessor status word before entering the handler.
49 * Pentium III FXSR, SSE support
50 * Gareth Hughes <gareth@valinux.com>, May 2000
52 * The FPU state data structure has had to grow to accommodate the
53 * extended FPU state required by the Streaming SIMD Extensions.
54 * There is no documented standard to accomplish this at the moment.
57 unsigned short significand[4];
58 unsigned short exponent;
62 unsigned short significand[4];
63 unsigned short exponent;
64 unsigned short padding[3];
68 unsigned long element[4];
72 /* Regular FPU environment */
78 unsigned long dataoff;
79 unsigned long datasel;
81 unsigned short status;
82 unsigned short magic; /* 0xffff = regular FPU data only */
84 /* FXSR FPU environment */
85 unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
87 unsigned long reserved;
88 struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
89 struct _xmmreg _xmm[8];
90 unsigned long padding1[44];
93 unsigned long padding2[12];
94 struct _fpx_sw_bytes sw_reserved; /* represents the extended
99 #define X86_FXSR_MAGIC 0x0000
103 unsigned short gs, __gsh;
104 unsigned short fs, __fsh;
105 unsigned short es, __esh;
106 unsigned short ds, __dsh;
115 unsigned long trapno;
118 unsigned short cs, __csh;
120 unsigned long sp_at_signal;
121 unsigned short ss, __ssh;
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)
130 void __user *fpstate; /* zero when no FPU/extended context */
131 unsigned long oldmask;
134 #else /* __KERNEL__ */
136 * User-space might still rely on the old definition:
139 unsigned short gs, __gsh;
140 unsigned short fs, __fsh;
141 unsigned short es, __esh;
142 unsigned short ds, __dsh;
151 unsigned long trapno;
154 unsigned short cs, __csh;
155 unsigned long eflags;
156 unsigned long esp_at_signal;
157 unsigned short ss, __ssh;
158 struct _fpstate __user *fpstate;
159 unsigned long oldmask;
162 #endif /* !__KERNEL__ */
167 /* Note: reserved1/2 may someday contain valuable data. Always save/restore
168 them when you change signal frames. */
172 __u16 twd; /* Note this is not the same as the
173 32bit/x87/FSAVE twd */
179 __u32 st_space[32]; /* 8*16 bytes for each FP-reg */
180 __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */
184 struct _fpx_sw_bytes sw_reserved; /* represents the extended
185 * state information */
212 unsigned short __pad0;
214 unsigned long trapno;
215 unsigned long oldmask;
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)
225 void __user *fpstate; /* zero when no FPU/extended context */
226 unsigned long reserved1[8];
228 #else /* __KERNEL__ */
230 * User-space might still rely on the old definition:
250 unsigned long eflags; /* RFLAGS */
254 unsigned short __pad0;
256 unsigned long trapno;
257 unsigned long oldmask;
259 struct _fpstate __user *fpstate; /* zero when no FPU context */
260 unsigned long reserved1[8];
262 #endif /* !__KERNEL__ */
264 #endif /* !__i386__ */
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.
279 struct _fpstate fpstate;
280 struct _xsave_hdr xstate_hdr;
281 /* new processor state extensions go here */
284 #endif /* _ASM_X86_SIGCONTEXT_H */