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