signal.h revision 1.26
11.26Sdrochner/*	$NetBSD: signal.h,v 1.26 2004/05/10 21:51:50 drochner Exp $	*/
21.3Scgd
31.1Sbrezak/*
41.1Sbrezak * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
51.1Sbrezak * All rights reserved.
61.1Sbrezak *
71.1Sbrezak * Redistribution and use in source and binary forms, with or without
81.1Sbrezak * modification, are permitted provided that the following conditions
91.1Sbrezak * are met:
101.1Sbrezak * 1. Redistributions of source code must retain the above copyright
111.1Sbrezak *    notice, this list of conditions and the following disclaimer.
121.1Sbrezak * 2. Redistributions in binary form must reproduce the above copyright
131.1Sbrezak *    notice, this list of conditions and the following disclaimer in the
141.1Sbrezak *    documentation and/or other materials provided with the distribution.
151.17Sagc * 3. Neither the name of the University nor the names of its contributors
161.1Sbrezak *    may be used to endorse or promote products derived from this software
171.1Sbrezak *    without specific prior written permission.
181.1Sbrezak *
191.1Sbrezak * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
201.1Sbrezak * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
211.1Sbrezak * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
221.1Sbrezak * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
231.1Sbrezak * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
241.1Sbrezak * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
251.1Sbrezak * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
261.1Sbrezak * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
271.1Sbrezak * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
281.1Sbrezak * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
291.1Sbrezak * SUCH DAMAGE.
301.1Sbrezak *
311.3Scgd *	@(#)signal.h	7.16 (Berkeley) 3/17/91
321.1Sbrezak */
331.1Sbrezak
341.2Smycroft#ifndef _I386_SIGNAL_H_
351.2Smycroft#define _I386_SIGNAL_H_
361.1Sbrezak
371.16Sbjh21#include <sys/featuretest.h>
381.16Sbjh21
391.1Sbrezaktypedef int sig_atomic_t;
401.18Schristos
411.26Sdrochner#ifdef _KERNEL
421.24Schristos#ifdef COMPAT_16
431.24Schristos#define SIGTRAMP_VALID(vers)	((unsigned)(vers) <= 2)
441.24Schristos#else
451.24Schristos#define SIGTRAMP_VALID(vers)	((vers) == 2)
461.24Schristos#endif
471.26Sdrochner#endif
481.1Sbrezak
491.16Sbjh21#if defined(_NETBSD_SOURCE)
501.1Sbrezak/*
511.1Sbrezak * Get the "code" values
521.1Sbrezak */
531.1Sbrezak#include <machine/trap.h>
541.1Sbrezak
551.1Sbrezak/*
561.1Sbrezak * Information pushed on stack when a signal is delivered.
571.1Sbrezak * This is used by the kernel to restore state following
581.1Sbrezak * execution of the signal handler.  It is also made available
591.1Sbrezak * to the handler to allow it to restore state properly if
601.1Sbrezak * a non-standard exit is performed.
611.1Sbrezak */
621.12Sthorpej#if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
631.10Smycroftstruct sigcontext13 {
641.5Smycroft	int	sc_gs;
651.5Smycroft	int	sc_fs;
661.2Smycroft	int	sc_es;
671.2Smycroft	int	sc_ds;
681.2Smycroft	int	sc_edi;
691.2Smycroft	int	sc_esi;
701.2Smycroft	int	sc_ebp;
711.2Smycroft	int	sc_ebx;
721.2Smycroft	int	sc_edx;
731.2Smycroft	int	sc_ecx;
741.2Smycroft	int	sc_eax;
751.6Smycroft	/* XXX */
761.2Smycroft	int	sc_eip;
771.2Smycroft	int	sc_cs;
781.2Smycroft	int	sc_eflags;
791.2Smycroft	int	sc_esp;
801.2Smycroft	int	sc_ss;
811.5Smycroft
821.5Smycroft	int	sc_onstack;		/* sigstack state to restore */
831.13Sthorpej	int	sc_mask;		/* signal mask to restore (old style) */
841.6Smycroft
851.6Smycroft	int	sc_trapno;		/* XXX should be above */
861.6Smycroft	int	sc_err;
871.10Smycroft};
881.10Smycroft#endif
891.9Smycroft
901.19Schristos/*
911.21Schristos * We expose this to userland for legacy interfaces, but only use
921.21Schristos * it in the kernel for compat code.
931.19Schristos */
941.10Smycroftstruct sigcontext {
951.10Smycroft	int	sc_gs;
961.10Smycroft	int	sc_fs;
971.10Smycroft	int	sc_es;
981.10Smycroft	int	sc_ds;
991.10Smycroft	int	sc_edi;
1001.10Smycroft	int	sc_esi;
1011.10Smycroft	int	sc_ebp;
1021.10Smycroft	int	sc_ebx;
1031.10Smycroft	int	sc_edx;
1041.10Smycroft	int	sc_ecx;
1051.10Smycroft	int	sc_eax;
1061.10Smycroft	/* XXX */
1071.10Smycroft	int	sc_eip;
1081.10Smycroft	int	sc_cs;
1091.10Smycroft	int	sc_eflags;
1101.10Smycroft	int	sc_esp;
1111.10Smycroft	int	sc_ss;
1121.10Smycroft
1131.10Smycroft	int	sc_onstack;		/* sigstack state to restore */
1141.14Sthorpej	int	__sc_mask13;		/* signal mask to restore (old style) */
1151.10Smycroft
1161.10Smycroft	int	sc_trapno;		/* XXX should be above */
1171.10Smycroft	int	sc_err;
1181.10Smycroft
1191.10Smycroft	sigset_t sc_mask;		/* signal mask to restore (new style) */
1201.1Sbrezak};
1211.1Sbrezak
1221.1Sbrezak#define sc_sp sc_esp
1231.1Sbrezak#define sc_fp sc_ebp
1241.1Sbrezak#define sc_pc sc_eip
1251.2Smycroft#define sc_ps sc_eflags
1261.1Sbrezak
1271.16Sbjh21#endif	/* _NETBSD_SOURCE */
1281.4Sjtc#endif	/* !_I386_SIGNAL_H_ */
129