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