ucontext.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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_CRUNCH
  40. #define CRUNCH_MAGIC 0x5065cf03
  41. #define CRUNCH_STORAGE_SIZE (CRUNCH_SIZE + 8)
  42. struct crunch_sigframe {
  43. unsigned long magic;
  44. unsigned long size;
  45. struct crunch_state storage;
  46. } __attribute__((__aligned__(8)));
  47. #endif
  48. #ifdef CONFIG_IWMMXT
  49. /* iwmmxt_area is 0x98 bytes long, preceded by 8 bytes of signature */
  50. #define IWMMXT_MAGIC 0x12ef842a
  51. #define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8)
  52. struct iwmmxt_sigframe {
  53. unsigned long magic;
  54. unsigned long size;
  55. struct iwmmxt_struct storage;
  56. } __attribute__((__aligned__(8)));
  57. #endif /* CONFIG_IWMMXT */
  58. #ifdef CONFIG_VFP
  59. #define VFP_MAGIC 0x56465001
  60. struct vfp_sigframe
  61. {
  62. unsigned long magic;
  63. unsigned long size;
  64. struct user_vfp ufp;
  65. struct user_vfp_exc ufp_exc;
  66. } __attribute__((__aligned__(8)));
  67. /*
  68. * 8 byte for magic and size, 264 byte for ufp, 12 bytes for ufp_exc,
  69. * 4 bytes padding.
  70. */
  71. #define VFP_STORAGE_SIZE sizeof(struct vfp_sigframe)
  72. #endif /* CONFIG_VFP */
  73. /*
  74. * Auxiliary signal frame. This saves stuff like FP state.
  75. * The layout of this structure is not part of the user ABI,
  76. * because the config options aren't. uc_regspace is really
  77. * one of these.
  78. */
  79. struct aux_sigframe {
  80. #ifdef CONFIG_CRUNCH
  81. struct crunch_sigframe crunch;
  82. #endif
  83. #ifdef CONFIG_IWMMXT
  84. struct iwmmxt_sigframe iwmmxt;
  85. #endif
  86. #ifdef CONFIG_VFP
  87. struct vfp_sigframe vfp;
  88. #endif
  89. /* Something that isn't a valid magic number for any coprocessor. */
  90. unsigned long end_magic;
  91. } __attribute__((__aligned__(8)));
  92. #endif
  93. #endif /* !_ASMARM_UCONTEXT_H */