ucontext.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASMARM_UCONTEXT_H
  3. #define _ASMARM_UCONTEXT_H
  4. #include <asm/fpstate.h>
  5. #include <asm/user.h>
  6. /*
  7. * struct sigcontext only has room for the basic registers, but struct
  8. * ucontext now has room for all registers which need to be saved and
  9. * restored. Coprocessor registers are stored in uc_regspace. Each
  10. * coprocessor's saved state should start with a documented 32-bit magic
  11. * number, followed by a 32-bit word giving the coproccesor's saved size.
  12. * uc_regspace may be expanded if necessary, although this takes some
  13. * coordination with glibc.
  14. */
  15. struct ucontext {
  16. unsigned long uc_flags;
  17. struct ucontext *uc_link;
  18. stack_t uc_stack;
  19. struct sigcontext uc_mcontext;
  20. sigset_t uc_sigmask;
  21. /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
  22. int __unused[32 - (sizeof (sigset_t) / sizeof (int))];
  23. /* Last for extensibility. Eight byte aligned because some
  24. coprocessors require eight byte alignment. */
  25. unsigned long uc_regspace[128] __attribute__((__aligned__(8)));
  26. };
  27. #ifdef __KERNEL__
  28. /*
  29. * Coprocessor save state. The magic values and specific
  30. * coprocessor's layouts are part of the userspace ABI. Each one of
  31. * these should be a multiple of eight bytes and aligned to eight
  32. * bytes, to prevent unpredictable padding in the signal frame.
  33. */
  34. /*
  35. * Dummy padding block: if this magic is encountered, the block should
  36. * be skipped using the corresponding size field.
  37. */
  38. #define DUMMY_MAGIC 0xb0d9ed01
  39. #ifdef CONFIG_IWMMXT
  40. /* iwmmxt_area is 0x98 bytes long, preceded by 8 bytes of signature */
  41. #define IWMMXT_MAGIC 0x12ef842a
  42. #define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8)
  43. struct iwmmxt_sigframe {
  44. unsigned long magic;
  45. unsigned long size;
  46. struct iwmmxt_struct storage;
  47. } __attribute__((__aligned__(8)));
  48. #endif /* CONFIG_IWMMXT */
  49. #ifdef CONFIG_VFP
  50. #define VFP_MAGIC 0x56465001
  51. struct vfp_sigframe
  52. {
  53. unsigned long magic;
  54. unsigned long size;
  55. struct user_vfp ufp;
  56. struct user_vfp_exc ufp_exc;
  57. } __attribute__((__aligned__(8)));
  58. /*
  59. * 8 byte for magic and size, 264 byte for ufp, 12 bytes for ufp_exc,
  60. * 4 bytes padding.
  61. */
  62. #define VFP_STORAGE_SIZE sizeof(struct vfp_sigframe)
  63. #endif /* CONFIG_VFP */
  64. /*
  65. * Auxiliary signal frame. This saves stuff like FP state.
  66. * The layout of this structure is not part of the user ABI,
  67. * because the config options aren't. uc_regspace is really
  68. * one of these.
  69. */
  70. struct aux_sigframe {
  71. #ifdef CONFIG_IWMMXT
  72. struct iwmmxt_sigframe iwmmxt;
  73. #endif
  74. #ifdef CONFIG_VFP
  75. struct vfp_sigframe vfp;
  76. #endif
  77. /* Something that isn't a valid magic number for any coprocessor. */
  78. unsigned long end_magic;
  79. } __attribute__((__aligned__(8)));
  80. #endif
  81. #endif /* !_ASMARM_UCONTEXT_H */