]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/x86/include/uapi/asm/sigcontext.h
Merge branch 'pm-opp'
[karo-tx-linux.git] / arch / x86 / include / uapi / asm / sigcontext.h
1 #ifndef _UAPI_ASM_X86_SIGCONTEXT_H
2 #define _UAPI_ASM_X86_SIGCONTEXT_H
3
4 #include <linux/compiler.h>
5 #include <linux/types.h>
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 xfeatures;
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
41 #ifdef __i386__
42 /*
43  * As documented in the iBCS2 standard..
44  *
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.
48  *
49  * Pentium III FXSR, SSE support
50  *      Gareth Hughes <gareth@valinux.com>, May 2000
51  *
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.
55  */
56 struct _fpreg {
57         unsigned short significand[4];
58         unsigned short exponent;
59 };
60
61 struct _fpxreg {
62         unsigned short significand[4];
63         unsigned short exponent;
64         unsigned short padding[3];
65 };
66
67 struct _xmmreg {
68         unsigned long element[4];
69 };
70
71 struct _fpstate {
72         /* Regular FPU environment */
73         unsigned long   cw;
74         unsigned long   sw;
75         unsigned long   tag;
76         unsigned long   ipoff;
77         unsigned long   cssel;
78         unsigned long   dataoff;
79         unsigned long   datasel;
80         struct _fpreg   _st[8];
81         unsigned short  status;
82         unsigned short  magic;          /* 0xffff = regular FPU data only */
83
84         /* FXSR FPU environment */
85         unsigned long   _fxsr_env[6];   /* FXSR FPU env is ignored */
86         unsigned long   mxcsr;
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];
91
92         union {
93                 unsigned long   padding2[12];
94                 struct _fpx_sw_bytes sw_reserved; /* represents the extended
95                                                    * state info */
96         };
97 };
98
99 #define X86_FXSR_MAGIC          0x0000
100
101 #ifndef __KERNEL__
102 /*
103  * User-space might still rely on the old definition:
104  */
105 struct sigcontext {
106         unsigned short gs, __gsh;
107         unsigned short fs, __fsh;
108         unsigned short es, __esh;
109         unsigned short ds, __dsh;
110         unsigned long edi;
111         unsigned long esi;
112         unsigned long ebp;
113         unsigned long esp;
114         unsigned long ebx;
115         unsigned long edx;
116         unsigned long ecx;
117         unsigned long eax;
118         unsigned long trapno;
119         unsigned long err;
120         unsigned long eip;
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;
127         unsigned long cr2;
128 };
129 #endif /* !__KERNEL__ */
130
131 #else /* __i386__ */
132
133 /* FXSAVE frame */
134 /* Note: reserved1/2 may someday contain valuable data. Always save/restore
135    them when you change signal frames. */
136 struct _fpstate {
137         __u16   cwd;
138         __u16   swd;
139         __u16   twd;            /* Note this is not the same as the
140                                    32bit/x87/FSAVE twd */
141         __u16   fop;
142         __u64   rip;
143         __u64   rdp;
144         __u32   mxcsr;
145         __u32   mxcsr_mask;
146         __u32   st_space[32];   /* 8*16 bytes for each FP-reg */
147         __u32   xmm_space[64];  /* 16*16 bytes for each XMM-reg  */
148         __u32   reserved2[12];
149         union {
150                 __u32   reserved3[12];
151                 struct _fpx_sw_bytes sw_reserved; /* represents the extended
152                                                    * state information */
153         };
154 };
155
156 #ifndef __KERNEL__
157 /*
158  * User-space might still rely on the old definition:
159  */
160 struct sigcontext {
161         __u64 r8;
162         __u64 r9;
163         __u64 r10;
164         __u64 r11;
165         __u64 r12;
166         __u64 r13;
167         __u64 r14;
168         __u64 r15;
169         __u64 rdi;
170         __u64 rsi;
171         __u64 rbp;
172         __u64 rbx;
173         __u64 rdx;
174         __u64 rax;
175         __u64 rcx;
176         __u64 rsp;
177         __u64 rip;
178         __u64 eflags;           /* RFLAGS */
179         __u16 cs;
180         __u16 gs;
181         __u16 fs;
182         __u16 __pad0;
183         __u64 err;
184         __u64 trapno;
185         __u64 oldmask;
186         __u64 cr2;
187         struct _fpstate __user *fpstate;        /* zero when no FPU context */
188 #ifdef __ILP32__
189         __u32 __fpstate_pad;
190 #endif
191         __u64 reserved1[8];
192 };
193 #endif /* !__KERNEL__ */
194
195 #endif /* !__i386__ */
196
197 struct _header {
198         __u64 xfeatures;
199         __u64 reserved1[2];
200         __u64 reserved2[5];
201 };
202
203 struct _ymmh_state {
204         /* 16 * 16 bytes for each YMMH-reg */
205         __u32 ymmh_space[64];
206 };
207
208 /*
209  * Extended state pointed by the fpstate pointer in the sigcontext.
210  * In addition to the fpstate, information encoded in the xstate_hdr
211  * indicates the presence of other extended state information
212  * supported by the processor and OS.
213  */
214 struct _xstate {
215         struct _fpstate fpstate;
216         struct _header xstate_hdr;
217         struct _ymmh_state ymmh;
218         /* new processor state extensions go here */
219 };
220
221 #endif /* _UAPI_ASM_X86_SIGCONTEXT_H */