xref: /OK3568_Linux_fs/kernel/arch/mips/include/uapi/asm/ucontext.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*4882a593Smuzhiyun #ifndef __MIPS_UAPI_ASM_UCONTEXT_H
3*4882a593Smuzhiyun #define __MIPS_UAPI_ASM_UCONTEXT_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun /**
6*4882a593Smuzhiyun  * struct extcontext - extended context header structure
7*4882a593Smuzhiyun  * @magic:	magic value identifying the type of extended context
8*4882a593Smuzhiyun  * @size:	the size in bytes of the enclosing structure
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * Extended context structures provide context which does not fit within struct
11*4882a593Smuzhiyun  * sigcontext. They are placed sequentially in memory at the end of struct
12*4882a593Smuzhiyun  * ucontext and struct sigframe, with each extended context structure beginning
13*4882a593Smuzhiyun  * with a header defined by this struct. The type of context represented is
14*4882a593Smuzhiyun  * indicated by the magic field. Userland may check each extended context
15*4882a593Smuzhiyun  * structure against magic values that it recognises. The size field allows any
16*4882a593Smuzhiyun  * unrecognised context to be skipped, allowing for future expansion. The end
17*4882a593Smuzhiyun  * of the extended context data is indicated by the magic value
18*4882a593Smuzhiyun  * END_EXTCONTEXT_MAGIC.
19*4882a593Smuzhiyun  */
20*4882a593Smuzhiyun struct extcontext {
21*4882a593Smuzhiyun 	unsigned int		magic;
22*4882a593Smuzhiyun 	unsigned int		size;
23*4882a593Smuzhiyun };
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun /**
26*4882a593Smuzhiyun  * struct msa_extcontext - MSA extended context structure
27*4882a593Smuzhiyun  * @ext:	the extended context header, with magic == MSA_EXTCONTEXT_MAGIC
28*4882a593Smuzhiyun  * @wr:		the most significant 64 bits of each MSA vector register
29*4882a593Smuzhiyun  * @csr:	the value of the MSA control & status register
30*4882a593Smuzhiyun  *
31*4882a593Smuzhiyun  * If MSA context is live for a task at the time a signal is delivered to it,
32*4882a593Smuzhiyun  * this structure will hold the MSA context of the task as it was prior to the
33*4882a593Smuzhiyun  * signal delivery.
34*4882a593Smuzhiyun  */
35*4882a593Smuzhiyun struct msa_extcontext {
36*4882a593Smuzhiyun 	struct extcontext	ext;
37*4882a593Smuzhiyun #define MSA_EXTCONTEXT_MAGIC	0x784d5341	/* xMSA */
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun 	unsigned long long	wr[32];
40*4882a593Smuzhiyun 	unsigned int		csr;
41*4882a593Smuzhiyun };
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun #define END_EXTCONTEXT_MAGIC	0x78454e44	/* xEND */
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun /**
46*4882a593Smuzhiyun  * struct ucontext - user context structure
47*4882a593Smuzhiyun  * @uc_flags:
48*4882a593Smuzhiyun  * @uc_link:
49*4882a593Smuzhiyun  * @uc_stack:
50*4882a593Smuzhiyun  * @uc_mcontext:	holds basic processor state
51*4882a593Smuzhiyun  * @uc_sigmask:
52*4882a593Smuzhiyun  * @uc_extcontext:	holds extended processor state
53*4882a593Smuzhiyun  */
54*4882a593Smuzhiyun struct ucontext {
55*4882a593Smuzhiyun 	/* Historic fields matching asm-generic */
56*4882a593Smuzhiyun 	unsigned long		uc_flags;
57*4882a593Smuzhiyun 	struct ucontext		*uc_link;
58*4882a593Smuzhiyun 	stack_t			uc_stack;
59*4882a593Smuzhiyun 	struct sigcontext	uc_mcontext;
60*4882a593Smuzhiyun 	sigset_t		uc_sigmask;
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun 	/* Extended context structures may follow ucontext */
63*4882a593Smuzhiyun 	unsigned long long	uc_extcontext[0];
64*4882a593Smuzhiyun };
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun #endif /* __MIPS_UAPI_ASM_UCONTEXT_H */
67