]> git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/architecture/i386/desc.h
xnu-344.49.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / architecture / i386 / desc.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: Segment descriptors.
29 *
30 * HISTORY
31 *
32 * 29 March 1992 ? at NeXT
33 * Created.
34 */
35
36 /*
37 * Code segment descriptor.
38 */
39
40 typedef struct code_desc {
41 unsigned short limit00;
42 unsigned short base00;
43 unsigned char base16;
44 unsigned char type :5,
45 #define DESC_CODE_EXEC 0x18
46 #define DESC_CODE_READ 0x1a
47 dpl :2,
48 present :1;
49 unsigned char limit16 :4,
50 :2,
51 opsz :1,
52 #define DESC_CODE_16B 0
53 #define DESC_CODE_32B 1
54 granular:1;
55 #define DESC_GRAN_BYTE 0
56 #define DESC_GRAN_PAGE 1
57 unsigned char base24;
58 } code_desc_t;
59
60 /*
61 * Data segment descriptor.
62 */
63
64 typedef struct data_desc {
65 unsigned short limit00;
66 unsigned short base00;
67 unsigned char base16;
68 unsigned char type :5,
69 #define DESC_DATA_RONLY 0x10
70 #define DESC_DATA_WRITE 0x12
71 dpl :2,
72 present :1;
73 unsigned char limit16 :4,
74 :2,
75 stksz :1,
76 #define DESC_DATA_16B 0
77 #define DESC_DATA_32B 1
78 granular:1;
79 unsigned char base24;
80 } data_desc_t;
81
82 /*
83 * LDT segment descriptor.
84 */
85
86 typedef struct ldt_desc {
87 unsigned short limit00;
88 unsigned short base00;
89 unsigned char base16;
90 unsigned char type :5,
91 #define DESC_LDT 0x02
92 :2,
93 present :1;
94 unsigned char limit16 :4,
95 :3,
96 granular:1;
97 unsigned char base24;
98 } ldt_desc_t;
99
100 #include <architecture/i386/sel.h>
101
102 /*
103 * Call gate descriptor.
104 */
105
106 typedef struct call_gate {
107 unsigned short offset00;
108 sel_t seg;
109 unsigned int argcnt :5,
110 :3,
111 type :5,
112 #define DESC_CALL_GATE 0x0c
113 dpl :2,
114 present :1,
115 offset16:16;
116 } call_gate_t;
117
118 /*
119 * Trap gate descriptor.
120 */
121
122 typedef struct trap_gate {
123 unsigned short offset00;
124 sel_t seg;
125 unsigned int :8,
126 type :5,
127 #define DESC_TRAP_GATE 0x0f
128 dpl :2,
129 present :1,
130 offset16:16;
131 } trap_gate_t;
132
133
134 /*
135 * Interrupt gate descriptor.
136 */
137
138 typedef struct intr_gate {
139 unsigned short offset00;
140 sel_t seg;
141 unsigned int :8,
142 type :5,
143 #define DESC_INTR_GATE 0x0e
144 dpl :2,
145 present :1,
146 offset16:16;
147 } intr_gate_t;