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