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