]> git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/architecture/i386/frame.h
35ba478de8cded90599f03476beaf01ccabb170e
[apple/xnu.git] / EXTERNAL_HEADERS / architecture / i386 / frame.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * Copyright (c) 1992 NeXT Computer, Inc.
32 *
33 * Intel386 Family: Processor exception frame.
34 *
35 * HISTORY
36 *
37 * 31 August 1992 ? at NeXT
38 * Added v86 mode stuff.
39 *
40 * 8 June 1992 ? at NeXT
41 * Changed name of write field in err_code_t
42 * which collided with write() in shlib.
43 *
44 * 30 March 1992 ? at NeXT
45 * Created.
46 */
47
48 /*
49 * Format of the error code
50 * generated by the hardware
51 * for certain exceptions.
52 */
53
54 typedef union err_code {
55 struct err_code_normal {
56 unsigned int ext :1,
57 tbl :2,
58 #define ERR_GDT 0
59 #define ERR_IDT 1
60 #define ERR_LDT 2
61 index :13,
62 :16;
63 } normal;
64 struct err_code_pgfault {
65 unsigned int prot :1,
66 wrtflt :1,
67 user :1,
68 :29;
69 } pgfault;
70 } err_code_t;
71
72 #include <architecture/i386/sel.h>
73
74 /*
75 * The actual hardware exception frame
76 * is variable in size. An error code is
77 * only pushed for certain exceptions.
78 * Previous stack information is only
79 * pushed for exceptions that cause a
80 * change in privilege level. The dpl
81 * field of the saved CS selector can be
82 * used to determine whether this is the
83 * case. If the interrupted task was
84 * executing in v86 mode, then the data
85 * segment registers are also present in
86 * the exception frame (in addition to
87 * previous stack information). This
88 * case can be determined by examining
89 * eflags.
90 */
91
92 typedef struct except_frame {
93 err_code_t err;
94 unsigned int eip;
95 sel_t cs;
96 unsigned int :0;
97 unsigned int eflags;
98 unsigned int esp;
99 sel_t ss;
100 unsigned int :0;
101 unsigned short v_es;
102 unsigned int :0;
103 unsigned short v_ds;
104 unsigned int :0;
105 unsigned short v_fs;
106 unsigned int :0;
107 unsigned short v_gs;
108 unsigned int :0;
109 } except_frame_t;
110
111 /*
112 * Values in eflags.
113 */
114
115 #ifndef EFL_CF /* FIXME */
116 #define EFL_CF 0x00001
117 #define EFL_PF 0x00004
118 #define EFL_AF 0x00010
119 #define EFL_ZF 0x00040
120 #define EFL_SF 0x00080
121 #define EFL_TF 0x00100
122 #define EFL_IF 0x00200
123 #define EFL_DF 0x00400
124 #define EFL_OF 0x00800
125 #define EFL_IOPL 0x03000
126 #define EFL_NT 0x04000
127 #define EFL_RF 0x10000
128 #define EFL_VM 0x20000
129 #define EFL_AC 0x40000
130 #endif
131
132 #define EFL_CLR 0xfff88028
133 #define EFL_SET 0x00000002