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