xref: /openbmc/linux/arch/ia64/include/uapi/asm/sigcontext.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
243e40f25SDavid Howells #ifndef _ASM_IA64_SIGCONTEXT_H
343e40f25SDavid Howells #define _ASM_IA64_SIGCONTEXT_H
443e40f25SDavid Howells 
543e40f25SDavid Howells /*
643e40f25SDavid Howells  * Copyright (C) 1998, 1999, 2001 Hewlett-Packard Co
743e40f25SDavid Howells  * Copyright (C) 1998, 1999, 2001 David Mosberger-Tang <davidm@hpl.hp.com>
843e40f25SDavid Howells  */
943e40f25SDavid Howells 
1043e40f25SDavid Howells #include <asm/fpu.h>
1143e40f25SDavid Howells 
1243e40f25SDavid Howells #define IA64_SC_FLAG_ONSTACK_BIT		0	/* is handler running on signal stack? */
1343e40f25SDavid Howells #define IA64_SC_FLAG_IN_SYSCALL_BIT		1	/* did signal interrupt a syscall? */
1443e40f25SDavid Howells #define IA64_SC_FLAG_FPH_VALID_BIT		2	/* is state in f[32]-f[127] valid? */
1543e40f25SDavid Howells 
1643e40f25SDavid Howells #define IA64_SC_FLAG_ONSTACK		(1 << IA64_SC_FLAG_ONSTACK_BIT)
1743e40f25SDavid Howells #define IA64_SC_FLAG_IN_SYSCALL		(1 << IA64_SC_FLAG_IN_SYSCALL_BIT)
1843e40f25SDavid Howells #define IA64_SC_FLAG_FPH_VALID		(1 << IA64_SC_FLAG_FPH_VALID_BIT)
1943e40f25SDavid Howells 
2043e40f25SDavid Howells # ifndef __ASSEMBLY__
2143e40f25SDavid Howells 
2243e40f25SDavid Howells /*
2343e40f25SDavid Howells  * Note on handling of register backing store: sc_ar_bsp contains the address that would
2443e40f25SDavid Howells  * be found in ar.bsp after executing a "cover" instruction the context in which the
2543e40f25SDavid Howells  * signal was raised.  If signal delivery required switching to an alternate signal stack
2643e40f25SDavid Howells  * (sc_rbs_base is not NULL), the "dirty" partition (as it would exist after executing the
2743e40f25SDavid Howells  * imaginary "cover" instruction) is backed by the *alternate* signal stack, not the
2843e40f25SDavid Howells  * original one.  In this case, sc_rbs_base contains the base address of the new register
2943e40f25SDavid Howells  * backing store.  The number of registers in the dirty partition can be calculated as:
3043e40f25SDavid Howells  *
3143e40f25SDavid Howells  *   ndirty = ia64_rse_num_regs(sc_rbs_base, sc_rbs_base + (sc_loadrs >> 16))
3243e40f25SDavid Howells  *
3343e40f25SDavid Howells  */
3443e40f25SDavid Howells 
3543e40f25SDavid Howells struct sigcontext {
3643e40f25SDavid Howells 	unsigned long		sc_flags;	/* see manifest constants above */
3743e40f25SDavid Howells 	unsigned long		sc_nat;		/* bit i == 1 iff scratch reg gr[i] is a NaT */
3843e40f25SDavid Howells 	stack_t			sc_stack;	/* previously active stack */
3943e40f25SDavid Howells 
4043e40f25SDavid Howells 	unsigned long		sc_ip;		/* instruction pointer */
4143e40f25SDavid Howells 	unsigned long		sc_cfm;		/* current frame marker */
4243e40f25SDavid Howells 	unsigned long		sc_um;		/* user mask bits */
4343e40f25SDavid Howells 	unsigned long		sc_ar_rsc;	/* register stack configuration register */
4443e40f25SDavid Howells 	unsigned long		sc_ar_bsp;	/* backing store pointer */
4543e40f25SDavid Howells 	unsigned long		sc_ar_rnat;	/* RSE NaT collection register */
4643e40f25SDavid Howells 	unsigned long		sc_ar_ccv;	/* compare and exchange compare value register */
4743e40f25SDavid Howells 	unsigned long		sc_ar_unat;	/* ar.unat of interrupted context */
4843e40f25SDavid Howells 	unsigned long		sc_ar_fpsr;	/* floating-point status register */
4943e40f25SDavid Howells 	unsigned long		sc_ar_pfs;	/* previous function state */
5043e40f25SDavid Howells 	unsigned long		sc_ar_lc;	/* loop count register */
5143e40f25SDavid Howells 	unsigned long		sc_pr;		/* predicate registers */
5243e40f25SDavid Howells 	unsigned long		sc_br[8];	/* branch registers */
5343e40f25SDavid Howells 	/* Note: sc_gr[0] is used as the "uc_link" member of ucontext_t */
5443e40f25SDavid Howells 	unsigned long		sc_gr[32];	/* general registers (static partition) */
5543e40f25SDavid Howells 	struct ia64_fpreg	sc_fr[128];	/* floating-point registers */
5643e40f25SDavid Howells 
5743e40f25SDavid Howells 	unsigned long		sc_rbs_base;	/* NULL or new base of sighandler's rbs */
5843e40f25SDavid Howells 	unsigned long		sc_loadrs;	/* see description above */
5943e40f25SDavid Howells 
6043e40f25SDavid Howells 	unsigned long		sc_ar25;	/* cmp8xchg16 uses this */
6143e40f25SDavid Howells 	unsigned long		sc_ar26;	/* rsvd for scratch use */
6243e40f25SDavid Howells 	unsigned long		sc_rsvd[12];	/* reserved for future use */
6343e40f25SDavid Howells 	/*
6443e40f25SDavid Howells 	 * The mask must come last so we can increase _NSIG_WORDS
6543e40f25SDavid Howells 	 * without breaking binary compatibility.
6643e40f25SDavid Howells 	 */
6743e40f25SDavid Howells 	sigset_t		sc_mask;	/* signal mask to restore after handler returns */
6843e40f25SDavid Howells };
6943e40f25SDavid Howells 
7043e40f25SDavid Howells # endif /* __ASSEMBLY__ */
7143e40f25SDavid Howells #endif /* _ASM_IA64_SIGCONTEXT_H */
72