xref: /titanic_41/usr/src/cmd/csh/sparc/signal.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
3*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate  */
5*7c478bd9Sstevel@tonic-gate 
6*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
7*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
8*7c478bd9Sstevel@tonic-gate 
9*7c478bd9Sstevel@tonic-gate /*
10*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
11*7c478bd9Sstevel@tonic-gate  * All rights reserved. The Berkeley Software License Agreement
12*7c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
13*7c478bd9Sstevel@tonic-gate  */
14*7c478bd9Sstevel@tonic-gate 
15*7c478bd9Sstevel@tonic-gate #ifndef CSH_SIGNAL_H
16*7c478bd9Sstevel@tonic-gate #define CSH_SIGNAL_H
17*7c478bd9Sstevel@tonic-gate 
18*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
19*7c478bd9Sstevel@tonic-gate 
20*7c478bd9Sstevel@tonic-gate /*
21*7c478bd9Sstevel@tonic-gate  * 4.3BSD signal compatibility header
22*7c478bd9Sstevel@tonic-gate  *
23*7c478bd9Sstevel@tonic-gate  */
24*7c478bd9Sstevel@tonic-gate #define sigmask(m)	(m > 32 ? 0 : (1 << ((m)-1)))
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate /*
27*7c478bd9Sstevel@tonic-gate  * 4.3BSD signal vector structure used in sigvec call.
28*7c478bd9Sstevel@tonic-gate  */
29*7c478bd9Sstevel@tonic-gate struct  sigvec {
30*7c478bd9Sstevel@tonic-gate         void    (*sv_handler)();        /* signal handler */
31*7c478bd9Sstevel@tonic-gate         int     sv_mask;                /* signal mask to apply */
32*7c478bd9Sstevel@tonic-gate         int     sv_flags;               /* see signal options below */
33*7c478bd9Sstevel@tonic-gate };
34*7c478bd9Sstevel@tonic-gate 
35*7c478bd9Sstevel@tonic-gate #define SV_ONSTACK      0x0001  /* take signal on signal stack */
36*7c478bd9Sstevel@tonic-gate #define SV_INTERRUPT    0x0002  /* do not restart system on signal return */
37*7c478bd9Sstevel@tonic-gate #define SV_RESETHAND    0x0004  /* reset handler to SIG_DFL when signal taken */
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #define sv_onstack sv_flags
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate /*
42*7c478bd9Sstevel@tonic-gate  * Machine dependent data structure
43*7c478bd9Sstevel@tonic-gate  */
44*7c478bd9Sstevel@tonic-gate struct  sigcontext {
45*7c478bd9Sstevel@tonic-gate         int     sc_onstack;             /* sigstack state to restore */
46*7c478bd9Sstevel@tonic-gate         int     sc_mask;                /* signal mask to restore */
47*7c478bd9Sstevel@tonic-gate #define MAXWINDOW       31              /* max usable windows in sparc */
48*7c478bd9Sstevel@tonic-gate 	long	sc_sp;			/* sp to restore */
49*7c478bd9Sstevel@tonic-gate 	long	sc_pc;			/* pc to retore */
50*7c478bd9Sstevel@tonic-gate 	long	sc_npc;                 /* next pc to restore */
51*7c478bd9Sstevel@tonic-gate 	long	sc_psr;                 /* psr to restore */
52*7c478bd9Sstevel@tonic-gate 	long	sc_g1;                  /* register that must be restored */
53*7c478bd9Sstevel@tonic-gate 	long	sc_o0;
54*7c478bd9Sstevel@tonic-gate 	long	sc_wbcnt;               /* number of outstanding windows */
55*7c478bd9Sstevel@tonic-gate 	long	*sc_spbuf[MAXWINDOW];   /* sp's for each wbuf */
56*7c478bd9Sstevel@tonic-gate 	long	sc_wbuf[MAXWINDOW][16]; /* outstanding window save buffer */
57*7c478bd9Sstevel@tonic-gate };
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate #define SI_DFLCODE	1
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate #define BUS_HWERR	BUS_ADRERR	/* misc hardware error (e.g. timeout) */
62*7c478bd9Sstevel@tonic-gate #define BUS_ALIGN	BUS_ADRALN	/* hardware alignment error */
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate #define SEGV_NOMAP	SEGV_MAPERR	/* no mapping at the fault address */
65*7c478bd9Sstevel@tonic-gate #define SEGV_PROT	SEGV_ACCERR	/* access exceeded protections */
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate /*
68*7c478bd9Sstevel@tonic-gate  * The SEGV_CODE(code) will be SEGV_NOMAP, SEGV_PROT, or SEGV_OBJERR.
69*7c478bd9Sstevel@tonic-gate  * In the SEGV_OBJERR case, doing a SEGV_ERRNO(code) gives an errno value
70*7c478bd9Sstevel@tonic-gate  * reported by the underlying file object mapped at the fault address.
71*7c478bd9Sstevel@tonic-gate  */
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate #define SIG_NOADDR	((char *)~0)
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate #define	SEGV_MAKE_ERR(e) (((e) << 8) | SEGV_MAPERR)
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate #endif	/* CSH_SIGNAL_H */
78