Commit | Line | Data |
---|---|---|
15637ed4 | 1 | /* |
15637ed4 RG |
2 | * Mach Operating System |
3 | * Copyright (c) 1992, 1991 Carnegie Mellon University | |
4 | * All Rights Reserved. | |
5 | * | |
6 | * Permission to use, copy, modify and distribute this software and its | |
7 | * documentation is hereby granted, provided that both the copyright | |
8 | * notice and this permission notice appear in all copies of the | |
9 | * software, derivative works or modified versions, and any portions | |
10 | * thereof, and that both notices appear in supporting documentation. | |
11 | * | |
12 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
13 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
14 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
15 | * | |
16 | * Carnegie Mellon requests users of this software to return to | |
17 | * | |
18 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
19 | * School of Computer Science | |
20 | * Carnegie Mellon University | |
21 | * Pittsburgh PA 15213-3890 | |
22 | * | |
23 | * any improvements or extensions that they make and grant Carnegie Mellon | |
24 | * the rights to redistribute these changes. | |
a27f4645 | 25 | * |
e4270b63 RG |
26 | * from: Mach, Revision 2.2 92/04/04 11:36:43 rpd |
27 | * $Id$ | |
15637ed4 RG |
28 | */ |
29 | ||
30 | /* | |
31 | Copyright 1988, 1989, 1990, 1991, 1992 | |
32 | by Intel Corporation, Santa Clara, California. | |
33 | ||
34 | All Rights Reserved | |
35 | ||
36 | Permission to use, copy, modify, and distribute this software and | |
37 | its documentation for any purpose and without fee is hereby | |
38 | granted, provided that the above copyright notice appears in all | |
39 | copies and that both the copyright notice and this permission notice | |
40 | appear in supporting documentation, and that the name of Intel | |
41 | not be used in advertising or publicity pertaining to distribution | |
42 | of the software without specific, written prior permission. | |
43 | ||
44 | INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE | |
45 | INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, | |
46 | IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR | |
47 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
48 | LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, | |
49 | NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | |
50 | WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
51 | */ | |
52 | ||
15637ed4 RG |
53 | /* Segment Descriptor |
54 | * | |
55 | * 31 24 19 16 7 0 | |
56 | * ------------------------------------------------------------ | |
57 | * | | |B| |A| | | |1|0|E|W|A| | | |
58 | * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 | | |
59 | * | | |D| |L| 19..16| | |1|1|C|R|A| | | |
60 | * ------------------------------------------------------------ | |
61 | * | | | | |
62 | * | BASE 15..0 | LIMIT 15..0 | | |
63 | * | | | | |
64 | * ------------------------------------------------------------ | |
65 | */ | |
66 | ||
67 | struct seg_desc { | |
68 | unsigned short limit_15_0; | |
69 | unsigned short base_15_0; | |
70 | unsigned char base_23_16; | |
a27f4645 RM |
71 | unsigned char p_dpl_type; |
72 | unsigned char g_b_a_limit; | |
15637ed4 RG |
73 | unsigned char base_31_24; |
74 | }; | |
75 | ||
a27f4645 | 76 | #define RUN 0 /* not really 0, but filled in at boot time */ |
15637ed4 | 77 | |
a27f4645 | 78 | struct seg_desc Gdt[] = { |
15637ed4 RG |
79 | {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 0x0 : null */ |
80 | {0xFFFF, 0x0, 0x0, 0x9F, 0xCF, 0x0}, /* 0x08 : kernel code */ | |
a27f4645 | 81 | /* 0x9E? */ |
15637ed4 | 82 | {0xFFFF, 0x0, 0x0, 0x93, 0xCF, 0x0}, /* 0x10 : kernel data */ |
a27f4645 RM |
83 | /* 0x92? */ |
84 | {0xFFFF, RUN, RUN, 0x9E, 0x40, 0x0}, /* 0x18 : boot code */ | |
85 | {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* 0x20 : boot data */ | |
86 | {0xFFFF, RUN, RUN, 0x9E, 0x0, 0x0}, /* 0x28 : boot code, 16 bits */ | |
87 | /* More for bdb. */ | |
88 | {}, /* BIOS_CS_INDEX = 6 : null */ | |
89 | {}, /* BIOS_TMP_INDEX = 7 : null */ | |
90 | {}, /* TSS_INDEX = 8 : null */ | |
91 | {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* DS_286_INDEX = 9 */ | |
92 | {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* ES_286_INDEX = 10 */ | |
93 | {}, /* Unused = 11 : null */ | |
94 | {0x7FFF, 0x8000, 0xB, 0xB2, 0x40, 0x0}, /* COLOR_INDEX = 12 */ | |
95 | {0x7FFF, 0x0, 0xB, 0xB2, 0x40, 0x0}, /* MONO_INDEX = 13 */ | |
96 | {0xFFFF, RUN, RUN, 0x9A, 0x40, 0x0}, /* DB_CS_INDEX = 14 */ | |
97 | {0xFFFF, RUN, RUN, 0x9A, 0x0, 0x0}, /* DB_CS16_INDEX = 15 */ | |
98 | {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* DB_DS_INDEX = 16 */ | |
99 | {8*18-1, RUN, RUN, 0x92, 0x40, 0x0}, /* GDT_INDEX = 17 */ | |
100 | }; | |
101 | ||
102 | struct idt_desc { | |
103 | unsigned short entry_15_0; | |
104 | unsigned short selector; | |
105 | unsigned char padding; | |
106 | unsigned char p_dpl_type; | |
107 | unsigned short entry_31_16; | |
108 | }; | |
15637ed4 | 109 | |
a27f4645 RM |
110 | struct idt_desc Idt[] = { |
111 | {}, /* Null (int 0) */ | |
112 | {RUN, 0x70, 0, 0x8E, 0}, /* DEBUG_VECTOR = 1 */ | |
113 | {}, /* Null (int 2) */ | |
114 | {RUN, 0x70, 0, 0xEE, 0}, /* BREAKPOINT_VECTOR = 3 */ | |
115 | }; | |
15637ed4 RG |
116 | |
117 | struct pseudo_desc { | |
118 | unsigned short limit; | |
119 | unsigned short base_low; | |
120 | unsigned short base_high; | |
121 | }; | |
122 | ||
a27f4645 RM |
123 | struct pseudo_desc Gdtr = { sizeof Gdt - 1, RUN, RUN }; |
124 | struct pseudo_desc Idtr_prot = { sizeof Idt - 1, RUN, RUN }; | |
125 | struct pseudo_desc Idtr_real = { 0x400 - 1, 0x0, 0x0 }; |