aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-09-05 03:32:38 -0400
committerIngo Molnar <mingo@kernel.org>2015-09-08 04:03:58 -0400
commitf2c609bca0b6526810fa22330ce4d173cc023ef8 (patch)
tree654afd905dbca2771dd8e1dc73a8da738879f0e7
parent2d057c69e743bfb88f1259ddbf1b1160bdd850e5 (diff)
x86/headers: Move the 'struct sigcontext' definitions into the UAPI header
Our goal is to eliminate the duplicate struct sigcontext_ia32 definition, so move the kernel's primary sigcontext type into the UAPI header, defining these two variants: struct sigcontext_32 struct sigcontext_64 ... and map them to 'struct sigcontext'. Acked-by: Mikko Rapeli <mikko.rapeli@iki.fi> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/1441438363-9999-11-git-send-email-mingo@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/include/asm/sigcontext.h73
-rw-r--r--arch/x86/include/uapi/asm/sigcontext.h83
2 files changed, 83 insertions, 73 deletions
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index b9c2bd6402df..25815f00b4ff 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -3,77 +3,4 @@
3 3
4#include <uapi/asm/sigcontext.h> 4#include <uapi/asm/sigcontext.h>
5 5
6#ifdef __i386__
7struct sigcontext {
8 __u16 gs, __gsh;
9 __u16 fs, __fsh;
10 __u16 es, __esh;
11 __u16 ds, __dsh;
12 __u32 di;
13 __u32 si;
14 __u32 bp;
15 __u32 sp;
16 __u32 bx;
17 __u32 dx;
18 __u32 cx;
19 __u32 ax;
20 __u32 trapno;
21 __u32 err;
22 __u32 ip;
23 __u16 cs, __csh;
24 __u32 flags;
25 __u32 sp_at_signal;
26 __u16 ss, __ssh;
27
28 /*
29 * fpstate is really (struct _fpstate *) or (struct _xstate *)
30 * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
31 * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
32 * of extended memory layout. See comments at the definition of
33 * (struct _fpx_sw_bytes)
34 */
35 void __user *fpstate; /* Zero when no FPU/extended context */
36 __u32 oldmask;
37 __u32 cr2;
38};
39#else /* __x86_64__: */
40struct sigcontext {
41 __u64 r8;
42 __u64 r9;
43 __u64 r10;
44 __u64 r11;
45 __u64 r12;
46 __u64 r13;
47 __u64 r14;
48 __u64 r15;
49 __u64 di;
50 __u64 si;
51 __u64 bp;
52 __u64 bx;
53 __u64 dx;
54 __u64 ax;
55 __u64 cx;
56 __u64 sp;
57 __u64 ip;
58 __u64 flags;
59 __u16 cs;
60 __u16 gs;
61 __u16 fs;
62 __u16 __pad0;
63 __u64 err;
64 __u64 trapno;
65 __u64 oldmask;
66 __u64 cr2;
67
68 /*
69 * fpstate is really (struct _fpstate *) or (struct _xstate *)
70 * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
71 * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
72 * of extended memory layout. See comments at the definition of
73 * (struct _fpx_sw_bytes)
74 */
75 void __user *fpstate; /* Zero when no FPU/extended context */
76 __u64 reserved1[8];
77};
78#endif /* !__x86_64__ */
79#endif /* _ASM_X86_SIGCONTEXT_H */ 6#endif /* _ASM_X86_SIGCONTEXT_H */
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index ca542e37c783..3591cef6d7d2 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -190,6 +190,89 @@ struct _xstate {
190 /* New processor state extensions go here: */ 190 /* New processor state extensions go here: */
191}; 191};
192 192
193struct sigcontext_32 {
194 __u16 gs, __gsh;
195 __u16 fs, __fsh;
196 __u16 es, __esh;
197 __u16 ds, __dsh;
198 __u32 di;
199 __u32 si;
200 __u32 bp;
201 __u32 sp;
202 __u32 bx;
203 __u32 dx;
204 __u32 cx;
205 __u32 ax;
206 __u32 trapno;
207 __u32 err;
208 __u32 ip;
209 __u16 cs, __csh;
210 __u32 flags;
211 __u32 sp_at_signal;
212 __u16 ss, __ssh;
213
214 /*
215 * fpstate is really (struct _fpstate *) or (struct _xstate *)
216 * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
217 * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
218 * of extended memory layout. See comments at the definition of
219 * (struct _fpx_sw_bytes)
220 */
221 void __user *fpstate; /* Zero when no FPU/extended context */
222 __u32 oldmask;
223 __u32 cr2;
224};
225
226struct sigcontext_64 {
227 __u64 r8;
228 __u64 r9;
229 __u64 r10;
230 __u64 r11;
231 __u64 r12;
232 __u64 r13;
233 __u64 r14;
234 __u64 r15;
235 __u64 di;
236 __u64 si;
237 __u64 bp;
238 __u64 bx;
239 __u64 dx;
240 __u64 ax;
241 __u64 cx;
242 __u64 sp;
243 __u64 ip;
244 __u64 flags;
245 __u16 cs;
246 __u16 gs;
247 __u16 fs;
248 __u16 __pad0;
249 __u64 err;
250 __u64 trapno;
251 __u64 oldmask;
252 __u64 cr2;
253
254 /*
255 * fpstate is really (struct _fpstate *) or (struct _xstate *)
256 * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
257 * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
258 * of extended memory layout. See comments at the definition of
259 * (struct _fpx_sw_bytes)
260 */
261 void __user *fpstate; /* Zero when no FPU/extended context */
262 __u64 reserved1[8];
263};
264
265/*
266 * Create the real 'struct sigcontext' type:
267 */
268#ifdef __KERNEL__
269# ifdef __i386__
270# define sigcontext sigcontext_32
271# else
272# define sigcontext sigcontext_64
273# endif
274#endif
275
193/* 276/*
194 * The old user-space sigcontext definition, just in case user-space still 277 * The old user-space sigcontext definition, just in case user-space still
195 * relies on it. The kernel definition (in asm/sigcontext.h) has unified 278 * relies on it. The kernel definition (in asm/sigcontext.h) has unified