xref: /OK3568_Linux_fs/kernel/arch/ia64/include/uapi/asm/sigcontext.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*4882a593Smuzhiyun #ifndef _ASM_IA64_SIGCONTEXT_H
3*4882a593Smuzhiyun #define _ASM_IA64_SIGCONTEXT_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun /*
6*4882a593Smuzhiyun  * Copyright (C) 1998, 1999, 2001 Hewlett-Packard Co
7*4882a593Smuzhiyun  * Copyright (C) 1998, 1999, 2001 David Mosberger-Tang <davidm@hpl.hp.com>
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include <asm/fpu.h>
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #define IA64_SC_FLAG_ONSTACK_BIT		0	/* is handler running on signal stack? */
13*4882a593Smuzhiyun #define IA64_SC_FLAG_IN_SYSCALL_BIT		1	/* did signal interrupt a syscall? */
14*4882a593Smuzhiyun #define IA64_SC_FLAG_FPH_VALID_BIT		2	/* is state in f[32]-f[127] valid? */
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #define IA64_SC_FLAG_ONSTACK		(1 << IA64_SC_FLAG_ONSTACK_BIT)
17*4882a593Smuzhiyun #define IA64_SC_FLAG_IN_SYSCALL		(1 << IA64_SC_FLAG_IN_SYSCALL_BIT)
18*4882a593Smuzhiyun #define IA64_SC_FLAG_FPH_VALID		(1 << IA64_SC_FLAG_FPH_VALID_BIT)
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun # ifndef __ASSEMBLY__
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun /*
23*4882a593Smuzhiyun  * Note on handling of register backing store: sc_ar_bsp contains the address that would
24*4882a593Smuzhiyun  * be found in ar.bsp after executing a "cover" instruction the context in which the
25*4882a593Smuzhiyun  * signal was raised.  If signal delivery required switching to an alternate signal stack
26*4882a593Smuzhiyun  * (sc_rbs_base is not NULL), the "dirty" partition (as it would exist after executing the
27*4882a593Smuzhiyun  * imaginary "cover" instruction) is backed by the *alternate* signal stack, not the
28*4882a593Smuzhiyun  * original one.  In this case, sc_rbs_base contains the base address of the new register
29*4882a593Smuzhiyun  * backing store.  The number of registers in the dirty partition can be calculated as:
30*4882a593Smuzhiyun  *
31*4882a593Smuzhiyun  *   ndirty = ia64_rse_num_regs(sc_rbs_base, sc_rbs_base + (sc_loadrs >> 16))
32*4882a593Smuzhiyun  *
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun struct sigcontext {
36*4882a593Smuzhiyun 	unsigned long		sc_flags;	/* see manifest constants above */
37*4882a593Smuzhiyun 	unsigned long		sc_nat;		/* bit i == 1 iff scratch reg gr[i] is a NaT */
38*4882a593Smuzhiyun 	stack_t			sc_stack;	/* previously active stack */
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun 	unsigned long		sc_ip;		/* instruction pointer */
41*4882a593Smuzhiyun 	unsigned long		sc_cfm;		/* current frame marker */
42*4882a593Smuzhiyun 	unsigned long		sc_um;		/* user mask bits */
43*4882a593Smuzhiyun 	unsigned long		sc_ar_rsc;	/* register stack configuration register */
44*4882a593Smuzhiyun 	unsigned long		sc_ar_bsp;	/* backing store pointer */
45*4882a593Smuzhiyun 	unsigned long		sc_ar_rnat;	/* RSE NaT collection register */
46*4882a593Smuzhiyun 	unsigned long		sc_ar_ccv;	/* compare and exchange compare value register */
47*4882a593Smuzhiyun 	unsigned long		sc_ar_unat;	/* ar.unat of interrupted context */
48*4882a593Smuzhiyun 	unsigned long		sc_ar_fpsr;	/* floating-point status register */
49*4882a593Smuzhiyun 	unsigned long		sc_ar_pfs;	/* previous function state */
50*4882a593Smuzhiyun 	unsigned long		sc_ar_lc;	/* loop count register */
51*4882a593Smuzhiyun 	unsigned long		sc_pr;		/* predicate registers */
52*4882a593Smuzhiyun 	unsigned long		sc_br[8];	/* branch registers */
53*4882a593Smuzhiyun 	/* Note: sc_gr[0] is used as the "uc_link" member of ucontext_t */
54*4882a593Smuzhiyun 	unsigned long		sc_gr[32];	/* general registers (static partition) */
55*4882a593Smuzhiyun 	struct ia64_fpreg	sc_fr[128];	/* floating-point registers */
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun 	unsigned long		sc_rbs_base;	/* NULL or new base of sighandler's rbs */
58*4882a593Smuzhiyun 	unsigned long		sc_loadrs;	/* see description above */
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun 	unsigned long		sc_ar25;	/* cmp8xchg16 uses this */
61*4882a593Smuzhiyun 	unsigned long		sc_ar26;	/* rsvd for scratch use */
62*4882a593Smuzhiyun 	unsigned long		sc_rsvd[12];	/* reserved for future use */
63*4882a593Smuzhiyun 	/*
64*4882a593Smuzhiyun 	 * The mask must come last so we can increase _NSIG_WORDS
65*4882a593Smuzhiyun 	 * without breaking binary compatibility.
66*4882a593Smuzhiyun 	 */
67*4882a593Smuzhiyun 	sigset_t		sc_mask;	/* signal mask to restore after handler returns */
68*4882a593Smuzhiyun };
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun # endif /* __ASSEMBLY__ */
71*4882a593Smuzhiyun #endif /* _ASM_IA64_SIGCONTEXT_H */
72