1 /* $NetBSD: frame.h,v 1.35 2012/02/19 21:06:11 rmind Exp $ */
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Copyright (c) 1990 The Regents of the University of California.
34 * All rights reserved.
36 * This code is derived from software contributed to Berkeley by
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
42 * 1. Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * 2. Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the distribution.
47 * 3. Neither the name of the University nor the names of its contributors
48 * may be used to endorse or promote products derived from this software
49 * without specific prior written permission.
51 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
52 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
55 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * @(#)frame.h 5.2 (Berkeley) 1/18/91
66 #ifndef _I386_FRAME_H_
67 #define _I386_FRAME_H_
69 #include <sys/signal.h>
72 * System stack frames.
76 * Exception/Trap Stack Frame
95 /* below portion defined in 386 hardware */
100 /* below used when transitting rings (e.g. user to kernel) */
103 /* below used when switching out of VM86 mode */
111 * Interrupt stack frame
126 uint32_t __if_trapno
; /* for compat with trap frame - trapno */
127 uint32_t __if_err
; /* for compat with trap frame - err */
128 /* below portion defined in 386 hardware */
132 /* below only when transitting rings (e.g. user to kernel) */
138 * Stack frame inside cpu_switchto()
147 #if defined(_KERNEL) || defined(__minix)
149 * Old-style signal frame
151 struct sigframe_sigcontext
{
153 /* ret addr + stackframe for handler */
154 int sf_ra_sigreturn
; /* first return to sigreturn */
156 int sf_ra
; /* return address for handler */
157 #endif /* defined(__minix) */
158 int sf_signum
; /* "signum" argument for handler */
159 int sf_code
; /* "code" argument for handler */
160 struct sigcontext
*sf_scp
; /* "scp" argument for handler */
162 /* ret addr + stackframe for sigreturn */
163 uint32_t sf_fp
; /* saved FP */
164 int sf_ra
; /* actual return address for handler */
165 struct sigcontext
*sf_scpcopy
; /* minix scp copy */
166 #endif /* defined(__minix) */
167 struct sigcontext sf_sc
; /* actual saved context */
172 * New-style signal frame
174 struct sigframe_siginfo
{
175 int sf_ra
; /* return address for handler */
176 int sf_signum
; /* "signum" argument for handler */
177 siginfo_t
*sf_sip
; /* "sip" argument for handler */
178 ucontext_t
*sf_ucp
; /* "ucp" argument for handler */
179 siginfo_t sf_si
; /* actual saved siginfo */
180 ucontext_t sf_uc
; /* actual saved ucontext */
184 void *getframe(struct lwp
*, int, int *);
185 void buildcontext(struct lwp
*, int, void *, void *);
186 void sendsig_sigcontext(const ksiginfo_t
*, const sigset_t
*);
189 #endif /* _I386_FRAME_H_ */