1 /*
2  * Copyright (C) 2012 ARM Ltd.
3  * Copyright (C) 2017 SiFive, Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  * This file was copied from arch/arm64/include/uapi/asm/ucontext.h
18  */
19 #ifndef _UAPI__ASM_UCONTEXT_H
20 #define _UAPI__ASM_UCONTEXT_H
21 
22 #include <linux/types.h>
23 
24 struct ucontext {
25 	unsigned long	  uc_flags;
26 	struct ucontext	 *uc_link;
27 	stack_t		  uc_stack;
28 	sigset_t	  uc_sigmask;
29 	/* There's some padding here to allow sigset_t to be expanded in the
30 	 * future.  Though this is unlikely, other architectures put uc_sigmask
31 	 * at the end of this structure and explicitly state it can be
32 	 * expanded, so we didn't want to box ourselves in here. */
33 	__u8		  __unused[1024 / 8 - sizeof(sigset_t)];
34 	/* We can't put uc_sigmask at the end of this structure because we need
35 	 * to be able to expand sigcontext in the future.  For example, the
36 	 * vector ISA extension will almost certainly add ISA state.  We want
37 	 * to ensure all user-visible ISA state can be saved and restored via a
38 	 * ucontext, so we're putting this at the end in order to allow for
39 	 * infinite extensibility.  Since we know this will be extended and we
40 	 * assume sigset_t won't be extended an extreme amount, we're
41 	 * prioritizing this. */
42 	struct sigcontext uc_mcontext;
43 };
44 
45 #endif /* _UAPI__ASM_UCONTEXT_H */
46