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