18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci#ifndef __MIPS_UAPI_ASM_UCONTEXT_H
38c2ecf20Sopenharmony_ci#define __MIPS_UAPI_ASM_UCONTEXT_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/**
68c2ecf20Sopenharmony_ci * struct extcontext - extended context header structure
78c2ecf20Sopenharmony_ci * @magic:	magic value identifying the type of extended context
88c2ecf20Sopenharmony_ci * @size:	the size in bytes of the enclosing structure
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * Extended context structures provide context which does not fit within struct
118c2ecf20Sopenharmony_ci * sigcontext. They are placed sequentially in memory at the end of struct
128c2ecf20Sopenharmony_ci * ucontext and struct sigframe, with each extended context structure beginning
138c2ecf20Sopenharmony_ci * with a header defined by this struct. The type of context represented is
148c2ecf20Sopenharmony_ci * indicated by the magic field. Userland may check each extended context
158c2ecf20Sopenharmony_ci * structure against magic values that it recognises. The size field allows any
168c2ecf20Sopenharmony_ci * unrecognised context to be skipped, allowing for future expansion. The end
178c2ecf20Sopenharmony_ci * of the extended context data is indicated by the magic value
188c2ecf20Sopenharmony_ci * END_EXTCONTEXT_MAGIC.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_cistruct extcontext {
218c2ecf20Sopenharmony_ci	unsigned int		magic;
228c2ecf20Sopenharmony_ci	unsigned int		size;
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/**
268c2ecf20Sopenharmony_ci * struct msa_extcontext - MSA extended context structure
278c2ecf20Sopenharmony_ci * @ext:	the extended context header, with magic == MSA_EXTCONTEXT_MAGIC
288c2ecf20Sopenharmony_ci * @wr:		the most significant 64 bits of each MSA vector register
298c2ecf20Sopenharmony_ci * @csr:	the value of the MSA control & status register
308c2ecf20Sopenharmony_ci *
318c2ecf20Sopenharmony_ci * If MSA context is live for a task at the time a signal is delivered to it,
328c2ecf20Sopenharmony_ci * this structure will hold the MSA context of the task as it was prior to the
338c2ecf20Sopenharmony_ci * signal delivery.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_cistruct msa_extcontext {
368c2ecf20Sopenharmony_ci	struct extcontext	ext;
378c2ecf20Sopenharmony_ci#define MSA_EXTCONTEXT_MAGIC	0x784d5341	/* xMSA */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	unsigned long long	wr[32];
408c2ecf20Sopenharmony_ci	unsigned int		csr;
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define END_EXTCONTEXT_MAGIC	0x78454e44	/* xEND */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/**
468c2ecf20Sopenharmony_ci * struct ucontext - user context structure
478c2ecf20Sopenharmony_ci * @uc_flags:
488c2ecf20Sopenharmony_ci * @uc_link:
498c2ecf20Sopenharmony_ci * @uc_stack:
508c2ecf20Sopenharmony_ci * @uc_mcontext:	holds basic processor state
518c2ecf20Sopenharmony_ci * @uc_sigmask:
528c2ecf20Sopenharmony_ci * @uc_extcontext:	holds extended processor state
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_cistruct ucontext {
558c2ecf20Sopenharmony_ci	/* Historic fields matching asm-generic */
568c2ecf20Sopenharmony_ci	unsigned long		uc_flags;
578c2ecf20Sopenharmony_ci	struct ucontext		*uc_link;
588c2ecf20Sopenharmony_ci	stack_t			uc_stack;
598c2ecf20Sopenharmony_ci	struct sigcontext	uc_mcontext;
608c2ecf20Sopenharmony_ci	sigset_t		uc_sigmask;
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci	/* Extended context structures may follow ucontext */
638c2ecf20Sopenharmony_ci	unsigned long long	uc_extcontext[0];
648c2ecf20Sopenharmony_ci};
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#endif /* __MIPS_UAPI_ASM_UCONTEXT_H */
67