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