18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __SPARC_SIGCONTEXT_H
38c2ecf20Sopenharmony_ci#define __SPARC_SIGCONTEXT_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
68c2ecf20Sopenharmony_ci#include <uapi/asm/sigcontext.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#define __SUNOS_MAXWIN   31
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* This is what SunOS does, so shall I unless we use new 32bit signals or rt signals. */
138c2ecf20Sopenharmony_cistruct sigcontext32 {
148c2ecf20Sopenharmony_ci	int sigc_onstack;      /* state to restore */
158c2ecf20Sopenharmony_ci	int sigc_mask;         /* sigmask to restore */
168c2ecf20Sopenharmony_ci	int sigc_sp;           /* stack pointer */
178c2ecf20Sopenharmony_ci	int sigc_pc;           /* program counter */
188c2ecf20Sopenharmony_ci	int sigc_npc;          /* next program counter */
198c2ecf20Sopenharmony_ci	int sigc_psr;          /* for condition codes etc */
208c2ecf20Sopenharmony_ci	int sigc_g1;           /* User uses these two registers */
218c2ecf20Sopenharmony_ci	int sigc_o0;           /* within the trampoline code. */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	/* Now comes information regarding the users window set
248c2ecf20Sopenharmony_ci	 * at the time of the signal.
258c2ecf20Sopenharmony_ci	 */
268c2ecf20Sopenharmony_ci	int sigc_oswins;       /* outstanding windows */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	/* stack ptrs for each regwin buf */
298c2ecf20Sopenharmony_ci	unsigned int sigc_spbuf[__SUNOS_MAXWIN];
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	/* Windows to restore after signal */
328c2ecf20Sopenharmony_ci	struct reg_window32 sigc_wbuf[__SUNOS_MAXWIN];
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* This is what we use for 32bit new non-rt signals. */
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_citypedef struct {
398c2ecf20Sopenharmony_ci	struct {
408c2ecf20Sopenharmony_ci		unsigned int psr;
418c2ecf20Sopenharmony_ci		unsigned int pc;
428c2ecf20Sopenharmony_ci		unsigned int npc;
438c2ecf20Sopenharmony_ci		unsigned int y;
448c2ecf20Sopenharmony_ci		unsigned int u_regs[16]; /* globals and ins */
458c2ecf20Sopenharmony_ci	}			si_regs;
468c2ecf20Sopenharmony_ci	int			si_mask;
478c2ecf20Sopenharmony_ci} __siginfo32_t;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define __SIGC_MAXWIN	7
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_citypedef struct {
528c2ecf20Sopenharmony_ci	unsigned long locals[8];
538c2ecf20Sopenharmony_ci	unsigned long ins[8];
548c2ecf20Sopenharmony_ci} __siginfo_reg_window;
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_citypedef struct {
578c2ecf20Sopenharmony_ci	int			wsaved;
588c2ecf20Sopenharmony_ci	__siginfo_reg_window	reg_window[__SIGC_MAXWIN];
598c2ecf20Sopenharmony_ci	unsigned long		rwbuf_stkptrs[__SIGC_MAXWIN];
608c2ecf20Sopenharmony_ci} __siginfo_rwin_t;
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#ifdef CONFIG_SPARC64
638c2ecf20Sopenharmony_citypedef struct {
648c2ecf20Sopenharmony_ci	unsigned   int si_float_regs [64];
658c2ecf20Sopenharmony_ci	unsigned   long si_fsr;
668c2ecf20Sopenharmony_ci	unsigned   long si_gsr;
678c2ecf20Sopenharmony_ci	unsigned   long si_fprs;
688c2ecf20Sopenharmony_ci} __siginfo_fpu_t;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* This is what SunOS doesn't, so we have to write this alone
718c2ecf20Sopenharmony_ci   and do it properly. */
728c2ecf20Sopenharmony_cistruct sigcontext {
738c2ecf20Sopenharmony_ci	/* The size of this array has to match SI_MAX_SIZE from siginfo.h */
748c2ecf20Sopenharmony_ci	char			sigc_info[128];
758c2ecf20Sopenharmony_ci	struct {
768c2ecf20Sopenharmony_ci		unsigned long	u_regs[16]; /* globals and ins */
778c2ecf20Sopenharmony_ci		unsigned long	tstate;
788c2ecf20Sopenharmony_ci		unsigned long	tpc;
798c2ecf20Sopenharmony_ci		unsigned long	tnpc;
808c2ecf20Sopenharmony_ci		unsigned int	y;
818c2ecf20Sopenharmony_ci		unsigned int	fprs;
828c2ecf20Sopenharmony_ci	}			sigc_regs;
838c2ecf20Sopenharmony_ci	__siginfo_fpu_t *	sigc_fpu_save;
848c2ecf20Sopenharmony_ci	struct {
858c2ecf20Sopenharmony_ci		void	*	ss_sp;
868c2ecf20Sopenharmony_ci		int		ss_flags;
878c2ecf20Sopenharmony_ci		unsigned long	ss_size;
888c2ecf20Sopenharmony_ci	}			sigc_stack;
898c2ecf20Sopenharmony_ci	unsigned long		sigc_mask;
908c2ecf20Sopenharmony_ci	__siginfo_rwin_t *	sigc_rwin_save;
918c2ecf20Sopenharmony_ci};
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#else
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_citypedef struct {
968c2ecf20Sopenharmony_ci	unsigned long si_float_regs [32];
978c2ecf20Sopenharmony_ci	unsigned long si_fsr;
988c2ecf20Sopenharmony_ci	unsigned long si_fpqdepth;
998c2ecf20Sopenharmony_ci	struct {
1008c2ecf20Sopenharmony_ci		unsigned long *insn_addr;
1018c2ecf20Sopenharmony_ci		unsigned long insn;
1028c2ecf20Sopenharmony_ci	} si_fpqueue [16];
1038c2ecf20Sopenharmony_ci} __siginfo_fpu_t;
1048c2ecf20Sopenharmony_ci#endif /* (CONFIG_SPARC64) */
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci#endif /* !(__ASSEMBLY__) */
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#endif /* !(__SPARC_SIGCONTEXT_H) */
110