xref: /dragonfly/sys/cpu/x86_64/include/signal.h (revision 0212bfce)
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 <machine/trap.h>	/* codes for SIGILL, SIGFPE */
49 
50 /*
51  * Information pushed on stack when a signal is delivered.
52  * This is used by the kernel to restore state following
53  * execution of the signal handler.  It is also made available
54  * to the handler to allow it to restore state properly if
55  * a non-standard exit is performed.
56  *
57  * The sequence of the fields/registers in struct sigcontext should match
58  * those in mcontext_t.
59  */
60 struct	sigcontext {
61 	sigset_t	sc_mask;	/* signal mask to restore */
62 
63 	long		sc_onstack;	/* sigstack state to restore */
64 	long		sc_rdi;
65 	long		sc_rsi;
66 	long		sc_rdx;
67 	long		sc_rcx;
68 	long		sc_r8;
69 	long		sc_r9;
70 	long		sc_rax;
71 	long		sc_rbx;
72 	long		sc_rbp;
73 	long		sc_r10;
74 	long		sc_r11;
75 	long		sc_r12;
76 	long		sc_r13;
77 	long		sc_r14;
78 	long		sc_r15;
79 	long		sc_xflags;
80 	long		sc_trapno;
81 	long		sc_addr;
82 	long		sc_flags;
83 	long		sc_err;
84 	long		sc_rip;
85 	long		sc_cs;
86 	long		sc_rflags;
87 	long		sc_rsp;
88 	long		sc_ss;
89 
90 	unsigned int	sc_len;
91 	unsigned int	sc_fpformat;
92 	unsigned int	sc_ownedfp;
93 	unsigned int	sc_reserved;
94 	unsigned int    sc_unused[8];
95 
96 	/* 64 byte aligned */
97 	int             sc_fpregs[256]; /* 1024 bytes */
98 } __attribute__((aligned(64)));
99 
100 #endif /* __BSD_VISIBLE */
101 
102 /*
103  * Tells the kernel how many pages to drop the signal trampoline down
104  * when mapping it.  Must be at least 1 page because kern_exec mprotects
105  * it to R+X (making it unwritable).
106  */
107 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
108 #define SZSIGCODE_EXTRA_BYTES	(1*PAGE_SIZE)
109 #endif
110 
111 #endif /* !_CPU_SIGNAL_H_ */
112