Skip to content

Commit 4302d50

Browse files
committed
Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 sigcontext header cleanups from Ingo Molnar: "This series reorganizes and cleans up various aspects of the main sigcontext UAPI headers, such as unifying the data structures and updating/adding lots of comments to explain all the ABI details and quirks. The headers can now also be built in user-space standalone" * 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/headers: Clean up too long lines x86/headers: Remove <asm/sigcontext.h> references on the kernel side x86/headers: Remove direct sigcontext32.h uses x86/headers: Convert sigcontext_ia32 uses to sigcontext_32 x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32' x86/headers: Make sigcontext pointers bit independent x86/headers: Move the 'struct sigcontext' definitions into the UAPI header x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32 x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate x86/headers: Unify register type definitions between 32-bit compat and i386 x86/headers: Use ABI types consistently in sigcontext*.h x86/headers: Separate out legacy user-space structure definitions x86/headers: Clean up and better document uapi/asm/sigcontext.h x86/headers: Clean up uapi/asm/sigcontext32.h x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h
2 parents ce4d72f + 0e2815d commit 4302d50

File tree

13 files changed

+338
-339
lines changed

13 files changed

+338
-339
lines changed

arch/x86/ia32/ia32_signal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <asm/ptrace.h>
2727
#include <asm/ia32_unistd.h>
2828
#include <asm/user32.h>
29-
#include <asm/sigcontext32.h>
29+
#include <uapi/asm/sigcontext.h>
3030
#include <asm/proto.h>
3131
#include <asm/vdso.h>
3232
#include <asm/sigframe.h>
@@ -68,7 +68,7 @@
6868
}
6969

7070
static int ia32_restore_sigcontext(struct pt_regs *regs,
71-
struct sigcontext_ia32 __user *sc)
71+
struct sigcontext_32 __user *sc)
7272
{
7373
unsigned int tmpflags, err = 0;
7474
void __user *buf;
@@ -170,7 +170,7 @@ asmlinkage long sys32_rt_sigreturn(void)
170170
* Set up a signal frame.
171171
*/
172172

173-
static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
173+
static int ia32_setup_sigcontext(struct sigcontext_32 __user *sc,
174174
void __user *fpstate,
175175
struct pt_regs *regs, unsigned int mask)
176176
{
@@ -234,7 +234,7 @@ static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
234234
unsigned long fx_aligned, math_size;
235235

236236
sp = fpu__alloc_mathframe(sp, 1, &fx_aligned, &math_size);
237-
*fpstate = (struct _fpstate_ia32 __user *) sp;
237+
*fpstate = (struct _fpstate_32 __user *) sp;
238238
if (copy_fpstate_to_sigframe(*fpstate, (void __user *)fx_aligned,
239239
math_size) < 0)
240240
return (void __user *) -1L;

arch/x86/include/asm/fpu/signal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#define _ASM_X86_FPU_SIGNAL_H
66

77
#ifdef CONFIG_X86_64
8-
# include <asm/sigcontext32.h>
8+
# include <uapi/asm/sigcontext.h>
99
# include <asm/user32.h>
1010
struct ksignal;
1111
int ia32_setup_rt_frame(int sig, struct ksignal *ksig,

arch/x86/include/asm/ia32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
* 32 bit structures for IA32 support.
1111
*/
1212

13-
#include <asm/sigcontext32.h>
13+
#include <uapi/asm/sigcontext.h>
1414

1515
/* signal.h */
1616

1717
struct ucontext_ia32 {
1818
unsigned int uc_flags;
1919
unsigned int uc_link;
2020
compat_stack_t uc_stack;
21-
struct sigcontext_ia32 uc_mcontext;
21+
struct sigcontext_32 uc_mcontext;
2222
compat_sigset_t uc_sigmask; /* mask last for extensibility */
2323
};
2424

arch/x86/include/asm/processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct vm86;
1111
#include <asm/math_emu.h>
1212
#include <asm/segment.h>
1313
#include <asm/types.h>
14-
#include <asm/sigcontext.h>
14+
#include <uapi/asm/sigcontext.h>
1515
#include <asm/current.h>
1616
#include <asm/cpufeature.h>
1717
#include <asm/page.h>

arch/x86/include/asm/sigcontext.h

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,8 @@
11
#ifndef _ASM_X86_SIGCONTEXT_H
22
#define _ASM_X86_SIGCONTEXT_H
33

4-
#include <uapi/asm/sigcontext.h>
5-
6-
#ifdef __i386__
7-
struct sigcontext {
8-
unsigned short gs, __gsh;
9-
unsigned short fs, __fsh;
10-
unsigned short es, __esh;
11-
unsigned short ds, __dsh;
12-
unsigned long di;
13-
unsigned long si;
14-
unsigned long bp;
15-
unsigned long sp;
16-
unsigned long bx;
17-
unsigned long dx;
18-
unsigned long cx;
19-
unsigned long ax;
20-
unsigned long trapno;
21-
unsigned long err;
22-
unsigned long ip;
23-
unsigned short cs, __csh;
24-
unsigned long flags;
25-
unsigned long sp_at_signal;
26-
unsigned short ss, __ssh;
4+
/* This is a legacy header - all kernel code includes <uapi/asm/sigcontext.h> directly. */
275

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-
unsigned long oldmask;
37-
unsigned long cr2;
38-
};
39-
#else /* __i386__ */
40-
struct sigcontext {
41-
unsigned long r8;
42-
unsigned long r9;
43-
unsigned long r10;
44-
unsigned long r11;
45-
unsigned long r12;
46-
unsigned long r13;
47-
unsigned long r14;
48-
unsigned long r15;
49-
unsigned long di;
50-
unsigned long si;
51-
unsigned long bp;
52-
unsigned long bx;
53-
unsigned long dx;
54-
unsigned long ax;
55-
unsigned long cx;
56-
unsigned long sp;
57-
unsigned long ip;
58-
unsigned long flags;
59-
unsigned short cs;
60-
unsigned short gs;
61-
unsigned short fs;
62-
unsigned short __pad0;
63-
unsigned long err;
64-
unsigned long trapno;
65-
unsigned long oldmask;
66-
unsigned long cr2;
6+
#include <uapi/asm/sigcontext.h>
677

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-
unsigned long reserved1[8];
77-
};
78-
#endif /* !__i386__ */
798
#endif /* _ASM_X86_SIGCONTEXT_H */

arch/x86/include/asm/sigframe.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
#ifndef _ASM_X86_SIGFRAME_H
22
#define _ASM_X86_SIGFRAME_H
33

4-
#include <asm/sigcontext.h>
4+
#include <uapi/asm/sigcontext.h>
55
#include <asm/siginfo.h>
66
#include <asm/ucontext.h>
77
#include <linux/compat.h>
88

99
#ifdef CONFIG_X86_32
1010
#define sigframe_ia32 sigframe
1111
#define rt_sigframe_ia32 rt_sigframe
12-
#define sigcontext_ia32 sigcontext
13-
#define _fpstate_ia32 _fpstate
1412
#define ucontext_ia32 ucontext
1513
#else /* !CONFIG_X86_32 */
1614

@@ -24,7 +22,7 @@
2422
struct sigframe_ia32 {
2523
u32 pretcode;
2624
int sig;
27-
struct sigcontext_ia32 sc;
25+
struct sigcontext_32 sc;
2826
/*
2927
* fpstate is unused. fpstate is moved/allocated after
3028
* retcode[] below. This movement allows to have the FP state and the
@@ -33,7 +31,7 @@ struct sigframe_ia32 {
3331
* the offset of extramask[] in the sigframe and thus prevent any
3432
* legacy application accessing/modifying it.
3533
*/
36-
struct _fpstate_ia32 fpstate_unused;
34+
struct _fpstate_32 fpstate_unused;
3735
#ifdef CONFIG_IA32_EMULATION
3836
unsigned int extramask[_COMPAT_NSIG_WORDS-1];
3937
#else /* !CONFIG_IA32_EMULATION */

arch/x86/include/asm/signal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern void do_signal(struct pt_regs *regs);
3434

3535
#define __ARCH_HAS_SA_RESTORER
3636

37-
#include <asm/sigcontext.h>
37+
#include <uapi/asm/sigcontext.h>
3838

3939
#ifdef __i386__
4040

0 commit comments

Comments
 (0)