2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 2003 Peter Wemm.
5 * Copyright (c) 1990 The Regents of the University of California.
8 * This code is derived from software contributed to Berkeley by
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * from: @(#)frame.h 5.2 (Berkeley) 1/18/91
39 #ifndef _MACHINE_FRAME_H_
40 #define _MACHINE_FRAME_H_ 1
43 * System stack frames.
48 * Exception/Trap Stack Frame
64 /* below portion defined in 386 hardware */
69 /* below only when crossing rings (user to kernel) */
74 /* Superset of trap frame, for traps from virtual-8086 mode */
76 struct trapframe_vm86 {
89 /* below portion defined in 386 hardware */
94 /* below only when crossing rings (user (including vm86) to kernel) */
97 /* below only when crossing from vm86 mode to kernel */
105 * This alias for the MI TRAPF_USERMODE() should be used when we don't
106 * care about user mode itself, but need to know if a frame has stack
107 * registers. The difference is only logical, but on i386 the logic
108 * for using TRAPF_USERMODE() is complicated by sometimes treating vm86
109 * bioscall mode (which is a special ring 3 user mode) as kernel mode.
111 #define TF_HAS_STACKREGS(tf) TRAPF_USERMODE(tf)
112 #endif /* __i386__ */
116 * Exception/Trap Stack Frame
118 * The ordering of this is specifically so that we can take first 6
119 * the syscall arguments directly from the beginning of the frame.
145 /* below portion defined in hardware */
149 register_t tf_rflags;
150 /* the amd64 frame always has the stack registers */
155 #define TF_HASSEGS 0x1
156 #define TF_HASBASES 0x2
157 #define TF_HASFPXSTATE 0x4
158 #endif /* __amd64__ */
160 #endif /* _MACHINE_FRAME_H_ */