xref: /openbmc/linux/arch/x86/include/asm/sigframe.h (revision a2cce7a9)
1 #ifndef _ASM_X86_SIGFRAME_H
2 #define _ASM_X86_SIGFRAME_H
3 
4 #include <asm/sigcontext.h>
5 #include <asm/siginfo.h>
6 #include <asm/ucontext.h>
7 #include <linux/compat.h>
8 
9 #ifdef CONFIG_X86_32
10 #define sigframe_ia32		sigframe
11 #define rt_sigframe_ia32	rt_sigframe
12 #define sigcontext_ia32		sigcontext
13 #define _fpstate_ia32		_fpstate
14 #define ucontext_ia32		ucontext
15 #else /* !CONFIG_X86_32 */
16 
17 #ifdef CONFIG_IA32_EMULATION
18 #include <asm/ia32.h>
19 #endif /* CONFIG_IA32_EMULATION */
20 
21 #endif /* CONFIG_X86_32 */
22 
23 #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
24 struct sigframe_ia32 {
25 	u32 pretcode;
26 	int sig;
27 	struct sigcontext_ia32 sc;
28 	/*
29 	 * fpstate is unused. fpstate is moved/allocated after
30 	 * retcode[] below. This movement allows to have the FP state and the
31 	 * future state extensions (xsave) stay together.
32 	 * And at the same time retaining the unused fpstate, prevents changing
33 	 * the offset of extramask[] in the sigframe and thus prevent any
34 	 * legacy application accessing/modifying it.
35 	 */
36 	struct _fpstate_ia32 fpstate_unused;
37 #ifdef CONFIG_IA32_EMULATION
38 	unsigned int extramask[_COMPAT_NSIG_WORDS-1];
39 #else /* !CONFIG_IA32_EMULATION */
40 	unsigned long extramask[_NSIG_WORDS-1];
41 #endif /* CONFIG_IA32_EMULATION */
42 	char retcode[8];
43 	/* fp state follows here */
44 };
45 
46 struct rt_sigframe_ia32 {
47 	u32 pretcode;
48 	int sig;
49 	u32 pinfo;
50 	u32 puc;
51 #ifdef CONFIG_IA32_EMULATION
52 	compat_siginfo_t info;
53 #else /* !CONFIG_IA32_EMULATION */
54 	struct siginfo info;
55 #endif /* CONFIG_IA32_EMULATION */
56 	struct ucontext_ia32 uc;
57 	char retcode[8];
58 	/* fp state follows here */
59 };
60 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) */
61 
62 #ifdef CONFIG_X86_64
63 
64 struct rt_sigframe {
65 	char __user *pretcode;
66 	struct ucontext uc;
67 	struct siginfo info;
68 	/* fp state follows here */
69 };
70 
71 #ifdef CONFIG_X86_X32_ABI
72 
73 struct ucontext_x32 {
74 	unsigned int	  uc_flags;
75 	unsigned int 	  uc_link;
76 	compat_stack_t	  uc_stack;
77 	unsigned int	  uc__pad0;     /* needed for alignment */
78 	struct sigcontext uc_mcontext;  /* the 64-bit sigcontext type */
79 	compat_sigset_t	  uc_sigmask;	/* mask last for extensibility */
80 };
81 
82 struct rt_sigframe_x32 {
83 	u64 pretcode;
84 	struct ucontext_x32 uc;
85 	compat_siginfo_t info;
86 	/* fp state follows here */
87 };
88 
89 #endif /* CONFIG_X86_X32_ABI */
90 
91 #endif /* CONFIG_X86_64 */
92 
93 #endif /* _ASM_X86_SIGFRAME_H */
94