xref: /openbsd-src/sys/arch/i386/include/frame.h (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1 /*	$OpenBSD: frame.h,v 1.4 2000/08/05 22:07:31 niklas Exp $	*/
2 /*	$NetBSD: frame.h,v 1.12 1995/10/11 04:20:08 mycroft Exp $	*/
3 
4 /*-
5  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
6  * Copyright (c) 1990 The Regents of the University of California.
7  * All rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by
10  * William Jolitz.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. All advertising materials mentioning features or use of this software
21  *    must display the following acknowledgement:
22  *	This product includes software developed by the University of
23  *	California, Berkeley and its contributors.
24  * 4. Neither the name of the University nor the names of its contributors
25  *    may be used to endorse or promote products derived from this software
26  *    without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38  * SUCH DAMAGE.
39  *
40  *	@(#)frame.h	5.2 (Berkeley) 1/18/91
41  */
42 
43 #include <sys/signal.h>
44 
45 /*
46  * System stack frames.
47  */
48 
49 /*
50  * Exception/Trap Stack Frame
51  */
52 struct trapframe {
53 	int	tf_es;
54 	int	tf_ds;
55 	int	tf_edi;
56 	int	tf_esi;
57 	int	tf_ebp;
58 	int	tf_ebx;
59 	int	tf_edx;
60 	int	tf_ecx;
61 	int	tf_eax;
62 	int	tf_trapno;
63 	/* below portion defined in 386 hardware */
64 	int	tf_err;
65 	int	tf_eip;
66 	int	tf_cs;
67 	int	tf_eflags;
68 	/* below used when transitting rings (e.g. user to kernel) */
69 	int	tf_esp;
70 	int	tf_ss;
71 	/* below used when switching out of VM86 mode */
72 	int	tf_vm86_es;
73 	int	tf_vm86_ds;
74 	int	tf_vm86_fs;
75 	int	tf_vm86_gs;
76 };
77 
78 /*
79  * Interrupt stack frame
80  */
81 struct intrframe {
82 	int	if_ppl;
83 	int	if_es;
84 	int	if_ds;
85 	int	if_edi;
86 	int	if_esi;
87 	int	if_ebp;
88 	int	if_ebx;
89 	int	if_edx;
90 	int	if_ecx;
91 	int	if_eax;
92 	int	:32;		/* for compat with trap frame - trapno */
93 	int	:32;		/* for compat with trap frame - err */
94 	/* below portion defined in 386 hardware */
95 	int	if_eip;
96 	int	if_cs;
97 	int	if_eflags;
98 	/* below only when transitting rings (e.g. user to kernel) */
99 	int	if_esp;
100 	int	if_ss;
101 };
102 
103 /*
104  * Stack frame inside cpu_switch()
105  */
106 struct switchframe {
107 	int	sf_ppl;
108 	int	sf_edi;
109 	int	sf_esi;
110 	int	sf_ebx;
111 	int	sf_eip;
112 };
113 
114 /*
115  * Signal frame
116  */
117 struct sigframe {
118 	int	sf_signum;
119 	siginfo_t *sf_sip;
120 	struct	sigcontext *sf_scp;
121 	sig_t	sf_handler;
122 	struct	sigcontext sf_sc;
123 	siginfo_t sf_si;
124 };
125