162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ASM_X86_SIGFRAME_H 362306a36Sopenharmony_ci#define _ASM_X86_SIGFRAME_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <uapi/asm/sigcontext.h> 662306a36Sopenharmony_ci#include <asm/siginfo.h> 762306a36Sopenharmony_ci#include <asm/ucontext.h> 862306a36Sopenharmony_ci#include <linux/compat.h> 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifdef CONFIG_X86_32 1162306a36Sopenharmony_ci#define sigframe_ia32 sigframe 1262306a36Sopenharmony_ci#define rt_sigframe_ia32 rt_sigframe 1362306a36Sopenharmony_ci#define ucontext_ia32 ucontext 1462306a36Sopenharmony_ci#else /* !CONFIG_X86_32 */ 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#ifdef CONFIG_IA32_EMULATION 1762306a36Sopenharmony_ci#include <asm/ia32.h> 1862306a36Sopenharmony_ci#endif /* CONFIG_IA32_EMULATION */ 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#endif /* CONFIG_X86_32 */ 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) 2362306a36Sopenharmony_cistruct sigframe_ia32 { 2462306a36Sopenharmony_ci u32 pretcode; 2562306a36Sopenharmony_ci int sig; 2662306a36Sopenharmony_ci struct sigcontext_32 sc; 2762306a36Sopenharmony_ci /* 2862306a36Sopenharmony_ci * fpstate is unused. fpstate is moved/allocated after 2962306a36Sopenharmony_ci * retcode[] below. This movement allows to have the FP state and the 3062306a36Sopenharmony_ci * future state extensions (xsave) stay together. 3162306a36Sopenharmony_ci * And at the same time retaining the unused fpstate, prevents changing 3262306a36Sopenharmony_ci * the offset of extramask[] in the sigframe and thus prevent any 3362306a36Sopenharmony_ci * legacy application accessing/modifying it. 3462306a36Sopenharmony_ci */ 3562306a36Sopenharmony_ci struct _fpstate_32 fpstate_unused; 3662306a36Sopenharmony_ci unsigned int extramask[1]; 3762306a36Sopenharmony_ci char retcode[8]; 3862306a36Sopenharmony_ci /* fp state follows here */ 3962306a36Sopenharmony_ci}; 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_cistruct rt_sigframe_ia32 { 4262306a36Sopenharmony_ci u32 pretcode; 4362306a36Sopenharmony_ci int sig; 4462306a36Sopenharmony_ci u32 pinfo; 4562306a36Sopenharmony_ci u32 puc; 4662306a36Sopenharmony_ci#ifdef CONFIG_IA32_EMULATION 4762306a36Sopenharmony_ci compat_siginfo_t info; 4862306a36Sopenharmony_ci#else /* !CONFIG_IA32_EMULATION */ 4962306a36Sopenharmony_ci struct siginfo info; 5062306a36Sopenharmony_ci#endif /* CONFIG_IA32_EMULATION */ 5162306a36Sopenharmony_ci struct ucontext_ia32 uc; 5262306a36Sopenharmony_ci char retcode[8]; 5362306a36Sopenharmony_ci /* fp state follows here */ 5462306a36Sopenharmony_ci}; 5562306a36Sopenharmony_ci#endif /* defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) */ 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#ifdef CONFIG_X86_64 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_cistruct rt_sigframe { 6062306a36Sopenharmony_ci char __user *pretcode; 6162306a36Sopenharmony_ci struct ucontext uc; 6262306a36Sopenharmony_ci struct siginfo info; 6362306a36Sopenharmony_ci /* fp state follows here */ 6462306a36Sopenharmony_ci}; 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#ifdef CONFIG_X86_X32_ABI 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_cistruct ucontext_x32 { 6962306a36Sopenharmony_ci unsigned int uc_flags; 7062306a36Sopenharmony_ci unsigned int uc_link; 7162306a36Sopenharmony_ci compat_stack_t uc_stack; 7262306a36Sopenharmony_ci unsigned int uc__pad0; /* needed for alignment */ 7362306a36Sopenharmony_ci struct sigcontext uc_mcontext; /* the 64-bit sigcontext type */ 7462306a36Sopenharmony_ci compat_sigset_t uc_sigmask; /* mask last for extensibility */ 7562306a36Sopenharmony_ci}; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_cistruct rt_sigframe_x32 { 7862306a36Sopenharmony_ci u64 pretcode; 7962306a36Sopenharmony_ci struct ucontext_x32 uc; 8062306a36Sopenharmony_ci compat_siginfo_t info; 8162306a36Sopenharmony_ci /* fp state follows here */ 8262306a36Sopenharmony_ci}; 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#endif /* CONFIG_X86_X32_ABI */ 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#endif /* CONFIG_X86_64 */ 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#endif /* _ASM_X86_SIGFRAME_H */ 89