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