aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-09-05 03:32:35 -0400
committerIngo Molnar <mingo@kernel.org>2015-09-08 04:03:57 -0400
commit7bb0dc2222779b4cbf1ec9ad651e500e62fa5b11 (patch)
tree632a56aead143d8ec7d952da4f4173bfa76f74ac
parent337a167d1a5b2704414679d1a993220a4613ec13 (diff)
x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate
'struct _fpstate_ia32' and 'struct _fpstate' on i386 are identical in all fields, except 'padding1' being named 'padding'. We unify the two structures and add a union that is both named 'padding1' and 'padding', in the (unlikely) case there's user-space code that relies on the padding field name. We rename the two main types to be: struct _fpstate_32 struct _fpstate_64 for the 32-bit and 64-bit frame, and map them to the main and compat structure names (_fpstate) depending on whether we are on 32-bit or on 64-bit kernels. We also keep the old _fpstate_ia32 name as a legacy name. 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-8-git-send-email-mingo@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/include/asm/sigframe.h1
-rw-r--r--arch/x86/include/uapi/asm/sigcontext.h26
-rw-r--r--arch/x86/include/uapi/asm/sigcontext32.h29
3 files changed, 17 insertions, 39 deletions
diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h
index 1f3175bb994e..a27c73d6863a 100644
--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -10,7 +10,6 @@
10#define sigframe_ia32 sigframe 10#define sigframe_ia32 sigframe
11#define rt_sigframe_ia32 rt_sigframe 11#define rt_sigframe_ia32 rt_sigframe
12#define sigcontext_ia32 sigcontext 12#define sigcontext_ia32 sigcontext
13#define _fpstate_ia32 _fpstate
14#define ucontext_ia32 ucontext 13#define ucontext_ia32 ucontext
15#else /* !CONFIG_X86_32 */ 14#else /* !CONFIG_X86_32 */
16 15
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h
index 9df4df3e40ef..85811167821f 100644
--- a/arch/x86/include/uapi/asm/sigcontext.h
+++ b/arch/x86/include/uapi/asm/sigcontext.h
@@ -95,9 +95,10 @@ struct _xmmreg {
95 95
96#define X86_FXSR_MAGIC 0x0000 96#define X86_FXSR_MAGIC 0x0000
97 97
98#ifdef __i386__ 98/*
99 99 * The 32-bit FPU frame:
100struct _fpstate { 100 */
101struct _fpstate_32 {
101 /* Legacy FPU environment: */ 102 /* Legacy FPU environment: */
102 __u32 cw; 103 __u32 cw;
103 __u32 sw; 104 __u32 sw;
@@ -117,7 +118,10 @@ struct _fpstate {
117 __u32 reserved; 118 __u32 reserved;
118 struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ 119 struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
119 struct _xmmreg _xmm[8]; /* First 8 XMM registers */ 120 struct _xmmreg _xmm[8]; /* First 8 XMM registers */
120 __u32 padding1[44]; /* Second 8 XMM registers plus padding */ 121 union {
122 __u32 padding1[44]; /* Second 8 XMM registers plus padding */
123 __u32 padding[44]; /* Alias name for old user-space */
124 };
121 125
122 union { 126 union {
123 __u32 padding2[12]; 127 __u32 padding2[12];
@@ -125,10 +129,8 @@ struct _fpstate {
125 }; 129 };
126}; 130};
127 131
128#else /* __x86_64__: */
129
130/* 132/*
131 * The FXSAVE frame. 133 * The 64-bit FPU frame. (FXSAVE format and later)
132 * 134 *
133 * Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is 135 * Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is
134 * larger: 'struct _xstate'. Note that 'struct _xstate' embedds 136 * larger: 'struct _xstate'. Note that 'struct _xstate' embedds
@@ -138,7 +140,7 @@ struct _fpstate {
138 * Note2: Reserved fields may someday contain valuable data. Always save/restore 140 * Note2: Reserved fields may someday contain valuable data. Always save/restore
139 * them when you change signal frames. 141 * them when you change signal frames.
140 */ 142 */
141struct _fpstate { 143struct _fpstate_64 {
142 __u16 cwd; 144 __u16 cwd;
143 __u16 swd; 145 __u16 swd;
144 /* Note this is not the same as the 32-bit/x87/FSAVE twd: */ 146 /* Note this is not the same as the 32-bit/x87/FSAVE twd: */
@@ -157,7 +159,13 @@ struct _fpstate {
157 }; 159 };
158}; 160};
159 161
160#endif /* __x86_64__ */ 162#ifdef __i386__
163# define _fpstate _fpstate_32
164#else
165# define _fpstate _fpstate_64
166#endif
167
168#define _fpstate_ia32 _fpstate_32
161 169
162struct _header { 170struct _header {
163 __u64 xfeatures; 171 __u64 xfeatures;
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 356caab997e7..19a89165ea1d 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -5,35 +5,6 @@
5 5
6#include <asm/sigcontext.h> 6#include <asm/sigcontext.h>
7 7
8/* FXSAVE frame: FSAVE frame with extensions */
9struct _fpstate_ia32 {
10 /* Regular FPU environment: */
11 __u32 cw;
12 __u32 sw;
13 __u32 tag; /* Not compatible with the 64-bit frame */
14 __u32 ipoff;
15 __u32 cssel;
16 __u32 dataoff;
17 __u32 datasel;
18 struct _fpreg _st[8];
19 __u16 status;
20 __u16 magic; /* 0xffff: regular FPU data only */
21 /* 0x0000: FXSR data */
22
23 /* Extended FXSR FPU environment: */
24 __u32 _fxsr_env[6];
25 __u32 mxcsr;
26 __u32 reserved;
27 struct _fpxreg _fxsr_st[8];
28 struct _xmmreg _xmm[8]; /* The first 8 XMM registers */
29 __u32 padding[44]; /* The second 8 XMM registers plus padding */
30 union {
31 __u32 padding2[12];
32 /* Might encode xstate extensions, see asm/sigcontext.h: */
33 struct _fpx_sw_bytes sw_reserved;
34 };
35};
36
37/* 32-bit compat sigcontext: */ 8/* 32-bit compat sigcontext: */
38struct sigcontext_ia32 { 9struct sigcontext_ia32 {
39 __u16 gs, __gsh; 10 __u16 gs, __gsh;