sigframe.h 2.1 KB

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