162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci#ifndef _ASM_IA64_SIGCONTEXT_H
362306a36Sopenharmony_ci#define _ASM_IA64_SIGCONTEXT_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/*
662306a36Sopenharmony_ci * Copyright (C) 1998, 1999, 2001 Hewlett-Packard Co
762306a36Sopenharmony_ci * Copyright (C) 1998, 1999, 2001 David Mosberger-Tang <davidm@hpl.hp.com>
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include <asm/fpu.h>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define IA64_SC_FLAG_ONSTACK_BIT		0	/* is handler running on signal stack? */
1362306a36Sopenharmony_ci#define IA64_SC_FLAG_IN_SYSCALL_BIT		1	/* did signal interrupt a syscall? */
1462306a36Sopenharmony_ci#define IA64_SC_FLAG_FPH_VALID_BIT		2	/* is state in f[32]-f[127] valid? */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define IA64_SC_FLAG_ONSTACK		(1 << IA64_SC_FLAG_ONSTACK_BIT)
1762306a36Sopenharmony_ci#define IA64_SC_FLAG_IN_SYSCALL		(1 << IA64_SC_FLAG_IN_SYSCALL_BIT)
1862306a36Sopenharmony_ci#define IA64_SC_FLAG_FPH_VALID		(1 << IA64_SC_FLAG_FPH_VALID_BIT)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci# ifndef __ASSEMBLY__
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/*
2362306a36Sopenharmony_ci * Note on handling of register backing store: sc_ar_bsp contains the address that would
2462306a36Sopenharmony_ci * be found in ar.bsp after executing a "cover" instruction the context in which the
2562306a36Sopenharmony_ci * signal was raised.  If signal delivery required switching to an alternate signal stack
2662306a36Sopenharmony_ci * (sc_rbs_base is not NULL), the "dirty" partition (as it would exist after executing the
2762306a36Sopenharmony_ci * imaginary "cover" instruction) is backed by the *alternate* signal stack, not the
2862306a36Sopenharmony_ci * original one.  In this case, sc_rbs_base contains the base address of the new register
2962306a36Sopenharmony_ci * backing store.  The number of registers in the dirty partition can be calculated as:
3062306a36Sopenharmony_ci *
3162306a36Sopenharmony_ci *   ndirty = ia64_rse_num_regs(sc_rbs_base, sc_rbs_base + (sc_loadrs >> 16))
3262306a36Sopenharmony_ci *
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cistruct sigcontext {
3662306a36Sopenharmony_ci	unsigned long		sc_flags;	/* see manifest constants above */
3762306a36Sopenharmony_ci	unsigned long		sc_nat;		/* bit i == 1 iff scratch reg gr[i] is a NaT */
3862306a36Sopenharmony_ci	stack_t			sc_stack;	/* previously active stack */
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci	unsigned long		sc_ip;		/* instruction pointer */
4162306a36Sopenharmony_ci	unsigned long		sc_cfm;		/* current frame marker */
4262306a36Sopenharmony_ci	unsigned long		sc_um;		/* user mask bits */
4362306a36Sopenharmony_ci	unsigned long		sc_ar_rsc;	/* register stack configuration register */
4462306a36Sopenharmony_ci	unsigned long		sc_ar_bsp;	/* backing store pointer */
4562306a36Sopenharmony_ci	unsigned long		sc_ar_rnat;	/* RSE NaT collection register */
4662306a36Sopenharmony_ci	unsigned long		sc_ar_ccv;	/* compare and exchange compare value register */
4762306a36Sopenharmony_ci	unsigned long		sc_ar_unat;	/* ar.unat of interrupted context */
4862306a36Sopenharmony_ci	unsigned long		sc_ar_fpsr;	/* floating-point status register */
4962306a36Sopenharmony_ci	unsigned long		sc_ar_pfs;	/* previous function state */
5062306a36Sopenharmony_ci	unsigned long		sc_ar_lc;	/* loop count register */
5162306a36Sopenharmony_ci	unsigned long		sc_pr;		/* predicate registers */
5262306a36Sopenharmony_ci	unsigned long		sc_br[8];	/* branch registers */
5362306a36Sopenharmony_ci	/* Note: sc_gr[0] is used as the "uc_link" member of ucontext_t */
5462306a36Sopenharmony_ci	unsigned long		sc_gr[32];	/* general registers (static partition) */
5562306a36Sopenharmony_ci	struct ia64_fpreg	sc_fr[128];	/* floating-point registers */
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	unsigned long		sc_rbs_base;	/* NULL or new base of sighandler's rbs */
5862306a36Sopenharmony_ci	unsigned long		sc_loadrs;	/* see description above */
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci	unsigned long		sc_ar25;	/* cmp8xchg16 uses this */
6162306a36Sopenharmony_ci	unsigned long		sc_ar26;	/* rsvd for scratch use */
6262306a36Sopenharmony_ci	unsigned long		sc_rsvd[12];	/* reserved for future use */
6362306a36Sopenharmony_ci	/*
6462306a36Sopenharmony_ci	 * The mask must come last so we can increase _NSIG_WORDS
6562306a36Sopenharmony_ci	 * without breaking binary compatibility.
6662306a36Sopenharmony_ci	 */
6762306a36Sopenharmony_ci	sigset_t		sc_mask;	/* signal mask to restore after handler returns */
6862306a36Sopenharmony_ci};
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci# endif /* __ASSEMBLY__ */
7162306a36Sopenharmony_ci#endif /* _ASM_IA64_SIGCONTEXT_H */
72