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