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