blob: 2f9c884d2c0f3950f8a8179a6bd440fee0b228eb [file] [log] [blame]
Thomas Gleixner77129c52007-10-23 22:37:24 +02001#ifndef _ASM_X86_SIGCONTEXT_H
2#define _ASM_X86_SIGCONTEXT_H
3
4#include <linux/compiler.h>
5#include <asm/types.h>
6
7#ifdef __i386__
8/*
9 * As documented in the iBCS2 standard..
10 *
11 * The first part of "struct _fpstate" is just the normal i387
12 * hardware setup, the extra "status" word is used to save the
13 * coprocessor status word before entering the handler.
14 *
15 * Pentium III FXSR, SSE support
16 * Gareth Hughes <gareth@valinux.com>, May 2000
17 *
18 * The FPU state data structure has had to grow to accommodate the
19 * extended FPU state required by the Streaming SIMD Extensions.
20 * There is no documented standard to accomplish this at the moment.
21 */
22struct _fpreg {
23 unsigned short significand[4];
24 unsigned short exponent;
25};
26
27struct _fpxreg {
28 unsigned short significand[4];
29 unsigned short exponent;
30 unsigned short padding[3];
31};
32
33struct _xmmreg {
34 unsigned long element[4];
35};
36
37struct _fpstate {
38 /* Regular FPU environment */
39 unsigned long cw;
40 unsigned long sw;
41 unsigned long tag;
42 unsigned long ipoff;
43 unsigned long cssel;
44 unsigned long dataoff;
45 unsigned long datasel;
46 struct _fpreg _st[8];
47 unsigned short status;
48 unsigned short magic; /* 0xffff = regular FPU data only */
49
50 /* FXSR FPU environment */
51 unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
52 unsigned long mxcsr;
53 unsigned long reserved;
54 struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
55 struct _xmmreg _xmm[8];
56 unsigned long padding[56];
57};
58
59#define X86_FXSR_MAGIC 0x0000
60
Ingo Molnar1cdde192008-02-13 16:20:35 +010061#ifdef __KERNEL__
Thomas Gleixner77129c52007-10-23 22:37:24 +020062struct sigcontext {
63 unsigned short gs, __gsh;
64 unsigned short fs, __fsh;
65 unsigned short es, __esh;
66 unsigned short ds, __dsh;
H. Peter Anvin742fa542008-01-30 13:30:56 +010067 unsigned long di;
68 unsigned long si;
69 unsigned long bp;
70 unsigned long sp;
71 unsigned long bx;
72 unsigned long dx;
73 unsigned long cx;
74 unsigned long ax;
Thomas Gleixner77129c52007-10-23 22:37:24 +020075 unsigned long trapno;
76 unsigned long err;
H. Peter Anvin742fa542008-01-30 13:30:56 +010077 unsigned long ip;
Thomas Gleixner77129c52007-10-23 22:37:24 +020078 unsigned short cs, __csh;
H. Peter Anvin742fa542008-01-30 13:30:56 +010079 unsigned long flags;
80 unsigned long sp_at_signal;
Thomas Gleixner77129c52007-10-23 22:37:24 +020081 unsigned short ss, __ssh;
Joe Perchesaf1fec12008-03-23 01:03:27 -070082 struct _fpstate __user *fpstate;
Thomas Gleixner77129c52007-10-23 22:37:24 +020083 unsigned long oldmask;
84 unsigned long cr2;
85};
Ingo Molnar1cdde192008-02-13 16:20:35 +010086#else /* __KERNEL__ */
87/*
88 * User-space might still rely on the old definition:
89 */
90struct sigcontext {
91 unsigned short gs, __gsh;
92 unsigned short fs, __fsh;
93 unsigned short es, __esh;
94 unsigned short ds, __dsh;
95 unsigned long edi;
96 unsigned long esi;
97 unsigned long ebp;
98 unsigned long esp;
99 unsigned long ebx;
100 unsigned long edx;
101 unsigned long ecx;
102 unsigned long eax;
103 unsigned long trapno;
104 unsigned long err;
105 unsigned long eip;
106 unsigned short cs, __csh;
107 unsigned long eflags;
108 unsigned long esp_at_signal;
109 unsigned short ss, __ssh;
Joe Perchesaf1fec12008-03-23 01:03:27 -0700110 struct _fpstate __user *fpstate;
Ingo Molnar1cdde192008-02-13 16:20:35 +0100111 unsigned long oldmask;
112 unsigned long cr2;
113};
114#endif /* !__KERNEL__ */
Thomas Gleixner77129c52007-10-23 22:37:24 +0200115
116#else /* __i386__ */
117
118/* FXSAVE frame */
119/* Note: reserved1/2 may someday contain valuable data. Always save/restore
120 them when you change signal frames. */
121struct _fpstate {
122 __u16 cwd;
123 __u16 swd;
Joe Perchesaf1fec12008-03-23 01:03:27 -0700124 __u16 twd; /* Note this is not the same as the
125 32bit/x87/FSAVE twd */
Thomas Gleixner77129c52007-10-23 22:37:24 +0200126 __u16 fop;
127 __u64 rip;
128 __u64 rdp;
129 __u32 mxcsr;
130 __u32 mxcsr_mask;
131 __u32 st_space[32]; /* 8*16 bytes for each FP-reg */
132 __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */
133 __u32 reserved2[24];
134};
135
Ingo Molnar1cdde192008-02-13 16:20:35 +0100136#ifdef __KERNEL__
Thomas Gleixner77129c52007-10-23 22:37:24 +0200137struct sigcontext {
138 unsigned long r8;
139 unsigned long r9;
140 unsigned long r10;
141 unsigned long r11;
142 unsigned long r12;
143 unsigned long r13;
144 unsigned long r14;
145 unsigned long r15;
H. Peter Anvin742fa542008-01-30 13:30:56 +0100146 unsigned long di;
147 unsigned long si;
148 unsigned long bp;
149 unsigned long bx;
150 unsigned long dx;
151 unsigned long ax;
152 unsigned long cx;
153 unsigned long sp;
154 unsigned long ip;
155 unsigned long flags;
Thomas Gleixner77129c52007-10-23 22:37:24 +0200156 unsigned short cs;
157 unsigned short gs;
158 unsigned short fs;
159 unsigned short __pad0;
160 unsigned long err;
161 unsigned long trapno;
162 unsigned long oldmask;
163 unsigned long cr2;
164 struct _fpstate __user *fpstate; /* zero when no FPU context */
165 unsigned long reserved1[8];
166};
Ingo Molnar1cdde192008-02-13 16:20:35 +0100167#else /* __KERNEL__ */
168/*
169 * User-space might still rely on the old definition:
170 */
171struct sigcontext {
172 unsigned long r8;
173 unsigned long r9;
174 unsigned long r10;
175 unsigned long r11;
176 unsigned long r12;
177 unsigned long r13;
178 unsigned long r14;
179 unsigned long r15;
180 unsigned long rdi;
181 unsigned long rsi;
182 unsigned long rbp;
183 unsigned long rbx;
184 unsigned long rdx;
185 unsigned long rax;
186 unsigned long rcx;
187 unsigned long rsp;
188 unsigned long rip;
189 unsigned long eflags; /* RFLAGS */
190 unsigned short cs;
191 unsigned short gs;
192 unsigned short fs;
193 unsigned short __pad0;
194 unsigned long err;
195 unsigned long trapno;
196 unsigned long oldmask;
197 unsigned long cr2;
198 struct _fpstate __user *fpstate; /* zero when no FPU context */
199 unsigned long reserved1[8];
200};
201#endif /* !__KERNEL__ */
Thomas Gleixner77129c52007-10-23 22:37:24 +0200202
203#endif /* !__i386__ */
204
Thomas Gleixner96a388d2007-10-11 11:20:03 +0200205#endif