sigframe.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #ifdef CONFIG_IA32_EMULATION
  32. unsigned int extramask[_COMPAT_NSIG_WORDS-1];
  33. #else /* !CONFIG_IA32_EMULATION */
  34. unsigned long extramask[_NSIG_WORDS-1];
  35. #endif /* CONFIG_IA32_EMULATION */
  36. char retcode[8];
  37. /* fp state follows here */
  38. };
  39. struct rt_sigframe_ia32 {
  40. u32 pretcode;
  41. int sig;
  42. u32 pinfo;
  43. u32 puc;
  44. #ifdef CONFIG_IA32_EMULATION
  45. compat_siginfo_t info;
  46. #else /* !CONFIG_IA32_EMULATION */
  47. struct siginfo info;
  48. #endif /* CONFIG_IA32_EMULATION */
  49. struct ucontext_ia32 uc;
  50. char retcode[8];
  51. /* fp state follows here */
  52. };
  53. #endif /* defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) */
  54. #ifdef CONFIG_X86_64
  55. struct rt_sigframe {
  56. char __user *pretcode;
  57. struct ucontext uc;
  58. struct siginfo info;
  59. /* fp state follows here */
  60. };
  61. #ifdef CONFIG_X86_X32_ABI
  62. struct ucontext_x32 {
  63. unsigned int uc_flags;
  64. unsigned int uc_link;
  65. compat_stack_t uc_stack;
  66. unsigned int uc__pad0; /* needed for alignment */
  67. struct sigcontext uc_mcontext; /* the 64-bit sigcontext type */
  68. compat_sigset_t uc_sigmask; /* mask last for extensibility */
  69. };
  70. struct rt_sigframe_x32 {
  71. u64 pretcode;
  72. struct ucontext_x32 uc;
  73. compat_siginfo_t info;
  74. /* fp state follows here */
  75. };
  76. #endif /* CONFIG_X86_X32_ABI */
  77. #endif /* CONFIG_X86_64 */
  78. #endif /* _ASM_X86_SIGFRAME_H */