signal.h revision 53108
11543Srgrimes/*
21543Srgrimes * Copyright (c) 1986, 1989, 1991, 1993
31543Srgrimes *	The Regents of the University of California.  All rights reserved.
41543Srgrimes *
51543Srgrimes * Redistribution and use in source and binary forms, with or without
61543Srgrimes * modification, are permitted provided that the following conditions
71543Srgrimes * are met:
81543Srgrimes * 1. Redistributions of source code must retain the above copyright
91543Srgrimes *    notice, this list of conditions and the following disclaimer.
101543Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111543Srgrimes *    notice, this list of conditions and the following disclaimer in the
121543Srgrimes *    documentation and/or other materials provided with the distribution.
131543Srgrimes * 3. All advertising materials mentioning features or use of this software
141543Srgrimes *    must display the following acknowledgement:
151543Srgrimes *	This product includes software developed by the University of
161543Srgrimes *	California, Berkeley and its contributors.
171543Srgrimes * 4. Neither the name of the University nor the names of its contributors
181543Srgrimes *    may be used to endorse or promote products derived from this software
191543Srgrimes *    without specific prior written permission.
201543Srgrimes *
211543Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221543Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231543Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241543Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251543Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261543Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271543Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281543Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291543Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301543Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311543Srgrimes * SUCH DAMAGE.
321543Srgrimes *
331543Srgrimes *	@(#)signal.h	8.1 (Berkeley) 6/11/93
341543Srgrimes * $FreeBSD: head/sys/i386/include/signal.h 53108 1999-11-12 13:52:11Z marcel $
351543Srgrimes */
361543Srgrimes
371543Srgrimes#ifndef _MACHINE_SIGNAL_H_
381543Srgrimes#define	_MACHINE_SIGNAL_H_
391543Srgrimes
401543Srgrimes/*
411543Srgrimes * Machine-dependent signal definitions
421543Srgrimes */
431543Srgrimes
441543Srgrimestypedef int sig_atomic_t;
451543Srgrimes
461543Srgrimes#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
471543Srgrimes
481543Srgrimes#include <machine/trap.h>	/* codes for SIGILL, SIGFPE */
491543Srgrimes
501543Srgrimes/*
511543Srgrimes * Information pushed on stack when a signal is delivered.
521543Srgrimes * This is used by the kernel to restore state following
531543Srgrimes * execution of the signal handler.  It is also made available
541543Srgrimes * to the handler to allow it to restore state properly if
551543Srgrimes * a non-standard exit is performed.
561543Srgrimes */
571543Srgrimestypedef unsigned int osigset_t;
581543Srgrimes
591543Srgrimesstruct	osigcontext {
601543Srgrimes	int	sc_onstack;		/* sigstack state to restore */
611543Srgrimes	osigset_t sc_mask;		/* signal mask to restore */
621543Srgrimes	int	sc_esp;			/* machine state follows: */
631543Srgrimes	int	sc_ebp;
641543Srgrimes	int	sc_isp;
651543Srgrimes	int	sc_eip;
661543Srgrimes	int	sc_efl;
671543Srgrimes	int	sc_es;
681543Srgrimes	int	sc_ds;
691543Srgrimes	int	sc_cs;
701543Srgrimes	int	sc_ss;
711543Srgrimes	int	sc_edi;
721543Srgrimes	int	sc_esi;
731543Srgrimes	int	sc_ebx;
741543Srgrimes	int	sc_edx;
751543Srgrimes	int	sc_ecx;
761543Srgrimes	int	sc_eax;
771543Srgrimes	int	sc_gs;
781543Srgrimes	int	sc_fs;
791543Srgrimes	int	sc_trapno;
801543Srgrimes	int	sc_err;
811543Srgrimes};
821543Srgrimes
831543Srgrimes/*
84 * The sequence of the fields/registers in struct sigcontext should match
85 * those in mcontext_t.
86 */
87struct	sigcontext {
88	sigset_t sc_mask;		/* signal mask to restore */
89	int	sc_onstack;		/* sigstack state to restore */
90	int	sc_gs;			/* machine state (struct trapframe): */
91	int	sc_fs;
92	int	sc_es;
93	int	sc_ds;
94	int	sc_edi;
95	int	sc_esi;
96	int	sc_ebp;
97	int	sc_isp;
98	int	sc_ebx;
99	int	sc_edx;
100	int	sc_ecx;
101	int	sc_eax;
102	int	sc_trapno;
103	int	sc_err;
104	int	sc_eip;
105	int	sc_cs;
106	int	sc_efl;
107	int	sc_esp;
108	int	sc_ss;
109	/*
110	 * XXX FPU state is 27 * 4 bytes h/w, 1 * 4 bytes s/w (probably not
111	 * needed here), or that + 16 * 4 bytes for emulators (probably all
112	 * needed here).  The "spare" bytes are mostly not spare.
113	 */
114	int	sc_fpregs[28];		/* machine state (FPU): */
115	int	sc_spare[17];
116};
117
118#define	sc_sp		sc_esp
119#define	sc_fp		sc_ebp
120#define	sc_pc		sc_eip
121#define	sc_ps		sc_efl
122#define	sc_eflags	sc_efl
123
124#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
125
126#endif /* !_MACHINE_SIGNAL_H_ */
127