frame.h revision 128019
1146998Sdes/*-
2137015Sdes * Copyright (c) 1990 The Regents of the University of California.
3137015Sdes * All rights reserved.
4137015Sdes *
5137015Sdes * This code is derived from software contributed to Berkeley by
6137015Sdes * William Jolitz.
7137015Sdes *
8146998Sdes * Redistribution and use in source and binary forms, with or without
9146998Sdes * modification, are permitted provided that the following conditions
10146998Sdes * are met:
11146998Sdes * 1. Redistributions of source code must retain the above copyright
12146998Sdes *    notice, this list of conditions and the following disclaimer.
13146998Sdes * 2. Redistributions in binary form must reproduce the above copyright
14137015Sdes *    notice, this list of conditions and the following disclaimer in the
15137015Sdes *    documentation and/or other materials provided with the distribution.
16146998Sdes * 4. Neither the name of the University nor the names of its contributors
17137015Sdes *    may be used to endorse or promote products derived from this software
18137015Sdes *    without specific prior written permission.
19137015Sdes *
20137015Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21146998Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22146998Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23137015Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24146998Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25146998Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26146998Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27137015Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28137015Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29137015Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30137015Sdes * SUCH DAMAGE.
31137015Sdes *
32137015Sdes *	from: @(#)frame.h	5.2 (Berkeley) 1/18/91
33137015Sdes * $FreeBSD: head/sys/i386/include/frame.h 128019 2004-04-07 20:46:16Z imp $
34137015Sdes */
35137015Sdes
36137015Sdes#ifndef _MACHINE_FRAME_H_
37137015Sdes#define _MACHINE_FRAME_H_ 1
38137015Sdes
39137015Sdes/*
40137015Sdes * System stack frames.
41137015Sdes */
42137015Sdes
43137015Sdes/*
44137015Sdes * Exception/Trap Stack Frame
45137015Sdes */
46137015Sdes
47137015Sdesstruct trapframe {
48137015Sdes	int	tf_fs;
49137015Sdes	int	tf_es;
50137015Sdes	int	tf_ds;
51137015Sdes	int	tf_edi;
52146998Sdes	int	tf_esi;
53137015Sdes	int	tf_ebp;
54137015Sdes	int	tf_isp;
55137015Sdes	int	tf_ebx;
56137015Sdes	int	tf_edx;
57137015Sdes	int	tf_ecx;
58146998Sdes	int	tf_eax;
59137015Sdes	int	tf_trapno;
60137015Sdes	/* below portion defined in 386 hardware */
61137015Sdes	int	tf_err;
62137015Sdes	int	tf_eip;
63137015Sdes	int	tf_cs;
64137015Sdes	int	tf_eflags;
65137015Sdes	/* below only when crossing rings (e.g. user to kernel) */
66137015Sdes	int	tf_esp;
67137015Sdes	int	tf_ss;
68137015Sdes};
69137015Sdes
70137015Sdes/* Superset of trap frame, for traps from virtual-8086 mode */
71137015Sdes
72137015Sdesstruct trapframe_vm86 {
73137015Sdes	int	tf_fs;
74137015Sdes	int	tf_es;
75137015Sdes	int	tf_ds;
76137015Sdes	int	tf_edi;
77137015Sdes	int	tf_esi;
78137015Sdes	int	tf_ebp;
79137015Sdes	int	tf_isp;
80137015Sdes	int	tf_ebx;
81137015Sdes	int	tf_edx;
82137015Sdes	int	tf_ecx;
83146998Sdes	int	tf_eax;
84146998Sdes	int	tf_trapno;
85146998Sdes	/* below portion defined in 386 hardware */
86146998Sdes	int	tf_err;
87146998Sdes	int	tf_eip;
88146998Sdes	int	tf_cs;
89146998Sdes	int	tf_eflags;
90146998Sdes	/* below only when crossing rings (e.g. user to kernel) */
91146998Sdes	int	tf_esp;
92146998Sdes	int	tf_ss;
93146998Sdes	/* below only when switching out of VM86 mode */
94146998Sdes	int	tf_vm86_es;
95	int	tf_vm86_ds;
96	int	tf_vm86_fs;
97	int	tf_vm86_gs;
98};
99
100/* Interrupt stack frame */
101
102struct intrframe {
103	int	if_vec;
104	int	if_fs;
105	int	if_es;
106	int	if_ds;
107	int	if_edi;
108	int	if_esi;
109	int	if_ebp;
110	int	:32;
111	int	if_ebx;
112	int	if_edx;
113	int	if_ecx;
114	int	if_eax;
115	int	:32;		/* for compat with trap frame - trapno */
116	int	:32;		/* for compat with trap frame - err */
117	/* below portion defined in 386 hardware */
118	int	if_eip;
119	int	if_cs;
120	int	if_eflags;
121	/* below only when crossing rings (e.g. user to kernel) */
122	int	if_esp;
123	int	if_ss;
124};
125
126/* frame of clock (same as interrupt frame) */
127
128struct clockframe {
129	int	cf_vec;
130	int	cf_fs;
131	int	cf_es;
132	int	cf_ds;
133	int	cf_edi;
134	int	cf_esi;
135	int	cf_ebp;
136	int	:32;
137	int	cf_ebx;
138	int	cf_edx;
139	int	cf_ecx;
140	int	cf_eax;
141	int	:32;		/* for compat with trap frame - trapno */
142	int	:32;		/* for compat with trap frame - err */
143	/* below portion defined in 386 hardware */
144	int	cf_eip;
145	int	cf_cs;
146	int	cf_eflags;
147	/* below only when crossing rings (e.g. user to kernel) */
148	int	cf_esp;
149	int	cf_ss;
150};
151
152int	kdb_trap(int, int, struct trapframe *);
153
154#define	INTR_TO_TRAPFRAME(frame) ((struct trapframe *)&(frame)->if_fs)
155
156#endif /* _MACHINE_FRAME_H_ */
157