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