1 #ifndef _UAPI_ASM_X86_SIGCONTEXT_H
2 #define _UAPI_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 * User-space might still rely on the old definition:
106 unsigned short gs, __gsh;
107 unsigned short fs, __fsh;
108 unsigned short es, __esh;
109 unsigned short ds, __dsh;
118 unsigned long trapno;
121 unsigned short cs, __csh;
122 unsigned long eflags;
123 unsigned long esp_at_signal;
124 unsigned short ss, __ssh;
125 struct _fpstate __user *fpstate;
126 unsigned long oldmask;
129 #endif /* !__KERNEL__ */
134 /* Note: reserved1/2 may someday contain valuable data. Always save/restore
135 them when you change signal frames. */
139 __u16 twd; /* Note this is not the same as the
140 32bit/x87/FSAVE twd */
146 __u32 st_space[32]; /* 8*16 bytes for each FP-reg */
147 __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */
151 struct _fpx_sw_bytes sw_reserved; /* represents the extended
152 * state information */
158 * User-space might still rely on the old definition:
178 __u64 eflags; /* RFLAGS */
182 * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"),
183 * Linux saved and restored fs and gs in these slots. This
184 * was counterproductive, as fsbase and gsbase were never
185 * saved, so arch_prctl was presumably unreliable.
187 * If these slots are ever needed for any other purpose, there
188 * is some risk that very old 64-bit binaries could get
189 * confused. I doubt that many such binaries still work,
190 * though, since the same patch in 2.5.64 also removed the
191 * 64-bit set_thread_area syscall, so it appears that there is
192 * no TLS API that works in both pre- and post-2.5.64 kernels.
194 __u16 __pad2; /* Was gs. */
195 __u16 __pad1; /* Was fs. */
202 struct _fpstate __user *fpstate; /* zero when no FPU context */
208 #endif /* !__KERNEL__ */
210 #endif /* !__i386__ */
219 /* 16 * 16 bytes for each YMMH-reg */
220 __u32 ymmh_space[64];
224 * Extended state pointed by the fpstate pointer in the sigcontext.
225 * In addition to the fpstate, information encoded in the xstate_hdr
226 * indicates the presence of other extended state information
227 * supported by the processor and OS.
230 struct _fpstate fpstate;
231 struct _xsave_hdr xstate_hdr;
232 struct _ymmh_state ymmh;
233 /* new processor state extensions go here */
236 #endif /* _UAPI_ASM_X86_SIGCONTEXT_H */