xref: /dragonfly/sys/cpu/x86_64/include/signal.h (revision 655933d6)
1 /*
2  * Copyright (c) 1986, 1989, 1991, 1993
3  *	The Regents of the University of California.
4  * Copyright (c) 2008 The DragonFly Project.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *	@(#)signal.h	8.1 (Berkeley) 6/11/93
32  * $FreeBSD: src/sys/i386/include/signal.h,v 1.12 1999/11/12 13:52:11 marcel Exp $
33  */
34 
35 #ifndef _CPU_SIGNAL_H_
36 #define	_CPU_SIGNAL_H_
37 
38 #include <sys/cdefs.h>
39 
40 /*
41  * Machine-dependent signal definitions
42  */
43 
44 typedef int sig_atomic_t;
45 
46 #if __BSD_VISIBLE
47 
48 #include <sys/_sigset.h>
49 #include <machine/trap.h>	/* codes for SIGILL, SIGFPE */
50 
51 /*
52  * Information pushed on stack when a signal is delivered.
53  * This is used by the kernel to restore state following
54  * execution of the signal handler.  It is also made available
55  * to the handler to allow it to restore state properly if
56  * a non-standard exit is performed.
57  *
58  * The sequence of the fields/registers in struct sigcontext should match
59  * those in mcontext_t.
60  */
61 struct	sigcontext {
62 	sigset_t	sc_mask;	/* signal mask to restore */
63 
64 	long		sc_onstack;	/* sigstack state to restore */
65 	long		sc_rdi;
66 	long		sc_rsi;
67 	long		sc_rdx;
68 	long		sc_rcx;
69 	long		sc_r8;
70 	long		sc_r9;
71 	long		sc_rax;
72 	long		sc_rbx;
73 	long		sc_rbp;
74 	long		sc_r10;
75 	long		sc_r11;
76 	long		sc_r12;
77 	long		sc_r13;
78 	long		sc_r14;
79 	long		sc_r15;
80 	long		sc_xflags;
81 	long		sc_trapno;
82 	long		sc_addr;
83 	long		sc_flags;
84 	long		sc_err;
85 	long		sc_rip;
86 	long		sc_cs;
87 	long		sc_rflags;
88 	long		sc_rsp;
89 	long		sc_ss;
90 
91 	unsigned int	sc_len;
92 	unsigned int	sc_fpformat;
93 	unsigned int	sc_ownedfp;
94 	unsigned int	sc_reserved;
95 	unsigned int    sc_unused[8];
96 
97 	/* 64 byte aligned */
98 	int             sc_fpregs[256]; /* 1024 bytes */
99 } __aligned(64);
100 
101 #endif /* __BSD_VISIBLE */
102 
103 /*
104  * Tells the kernel how many pages to drop the signal trampoline down
105  * when mapping it.  Must be at least 1 page because kern_exec mprotects
106  * it to R+X (making it unwritable).
107  */
108 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
109 #define SZSIGCODE_EXTRA_BYTES	(1*PAGE_SIZE)
110 #endif
111 
112 #endif /* !_CPU_SIGNAL_H_ */
113