blob: d743947f4c77af5c5dcd7ce10eee31d9176a41c6 [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;
82 struct _fpstate __user * fpstate;
83 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;
110 struct _fpstate __user * fpstate;
111 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;
124 __u16 twd; /* Note this is not the same as the 32bit/x87/FSAVE twd */
125 __u16 fop;
126 __u64 rip;
127 __u64 rdp;
128 __u32 mxcsr;
129 __u32 mxcsr_mask;
130 __u32 st_space[32]; /* 8*16 bytes for each FP-reg */
131 __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */
132 __u32 reserved2[24];
133};
134
Ingo Molnar1cdde192008-02-13 16:20:35 +0100135#ifdef __KERNEL__
Thomas Gleixner77129c52007-10-23 22:37:24 +0200136struct sigcontext {
137 unsigned long r8;
138 unsigned long r9;
139 unsigned long r10;
140 unsigned long r11;
141 unsigned long r12;
142 unsigned long r13;
143 unsigned long r14;
144 unsigned long r15;
H. Peter Anvin742fa542008-01-30 13:30:56 +0100145 unsigned long di;
146 unsigned long si;
147 unsigned long bp;
148 unsigned long bx;
149 unsigned long dx;
150 unsigned long ax;
151 unsigned long cx;
152 unsigned long sp;
153 unsigned long ip;
154 unsigned long flags;
Thomas Gleixner77129c52007-10-23 22:37:24 +0200155 unsigned short cs;
156 unsigned short gs;
157 unsigned short fs;
158 unsigned short __pad0;
159 unsigned long err;
160 unsigned long trapno;
161 unsigned long oldmask;
162 unsigned long cr2;
163 struct _fpstate __user *fpstate; /* zero when no FPU context */
164 unsigned long reserved1[8];
165};
Ingo Molnar1cdde192008-02-13 16:20:35 +0100166#else /* __KERNEL__ */
167/*
168 * User-space might still rely on the old definition:
169 */
170struct sigcontext {
171 unsigned long r8;
172 unsigned long r9;
173 unsigned long r10;
174 unsigned long r11;
175 unsigned long r12;
176 unsigned long r13;
177 unsigned long r14;
178 unsigned long r15;
179 unsigned long rdi;
180 unsigned long rsi;
181 unsigned long rbp;
182 unsigned long rbx;
183 unsigned long rdx;
184 unsigned long rax;
185 unsigned long rcx;
186 unsigned long rsp;
187 unsigned long rip;
188 unsigned long eflags; /* RFLAGS */
189 unsigned short cs;
190 unsigned short gs;
191 unsigned short fs;
192 unsigned short __pad0;
193 unsigned long err;
194 unsigned long trapno;
195 unsigned long oldmask;
196 unsigned long cr2;
197 struct _fpstate __user *fpstate; /* zero when no FPU context */
198 unsigned long reserved1[8];
199};
200#endif /* !__KERNEL__ */
Thomas Gleixner77129c52007-10-23 22:37:24 +0200201
202#endif /* !__i386__ */
203
Thomas Gleixner96a388d2007-10-11 11:20:03 +0200204#endif