VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-system-data.asm@ 60539

Last change on this file since 60539 was 60539, checked in by vboxsync, 9 years ago

bs3kit: Updates.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.1 KB
Line 
1; $Id: bs3-system-data.asm 60539 2016-04-18 14:09:39Z vboxsync $
2;; @file
3; BS3Kit - GDT
4;
5
6;
7; Copyright (C) 2007-2016 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26
27%include "bs3kit.mac"
28
29%define BS3_SYSTEM16_BASE_16_23 ((BS3_ADDR_BS3SYSTEM16 >> 16) & 0xff)
30%define BS3_SYSTEM16_BASE_LOW(a_DataSym) ((BS3_DATA_NM(a_DataSym) - StartSystem16) & 0xffff)
31
32;;
33; The GDT (X86DESCGENERIC).
34;
35BS3_BEGIN_SYSTEM16
36StartSystem16:
37 db 10, 13, 'eye-catcher: SYSTEM16.......', 10, 13 ; 32 bytes long
38BS3_GLOBAL_DATA Bs3Gdt, 4000h - 20h
39
40;; Macro for checking GDT offsets as we go along.
41;; @param %1 The expected current offset.
42%macro BS3GdtAssertOffset 1
43 %ifndef KBUILD_GENERATING_MAKEFILE_DEPENDENCIES
44 %if ($ - BS3_DATA_NM(Bs3Gdt)) != %1
45 %assign offActual ($ - BS3_DATA_NM(Bs3Gdt))
46 %error "BS3GdtAssertOffset: Bad offset: " %+ offActual %+ ", expected " %+ %1
47 %endif
48 %endif
49%endmacro
50
51 dw 00000h, 00000h, 00000h, 00000h ; null selector
52BS3GdtAssertOffset 8
53
54 ;
55 ; 008h..0f8h - System selectors and other stuff
56 ;
57 dw 00000h, 00000h, 00000h, 00000h ; Entry 008h - currently unused
58
59BS3_GLOBAL_DATA Bs3Gdte_Ldt, 16 ; Entry 010h
60 dw BS3_DATA_NM(Bs3LdtEnd) - BS3_DATA_NM(Bs3Ldt)
61 dw BS3_SYSTEM16_BASE_LOW(Bs3Ldt)
62 db BS3_SYSTEM16_BASE_16_23
63 db X86_SEL_TYPE_SYS_LDT | 0x80
64 dw 00000h
65 dw 00000h, 00000h, 00000h, 00000h ; zero for 64-bit mode.
66
67BS3_GLOBAL_DATA Bs3Gdte_Tss16, 8 ; Entry 020h
68 dw 0002bh ; 16-bit TSS.
69 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss16)
70 db BS3_SYSTEM16_BASE_16_23
71 db X86_SEL_TYPE_SYS_286_TSS_AVAIL | 0x80
72 dw 0
73
74BS3_GLOBAL_DATA Bs3Gdte_Tss16DoubleFault, 8 ; Entry 028h
75 dw 0002bh ; 16-bit TSS, double fault.
76 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss16DoubleFault)
77 db BS3_SYSTEM16_BASE_16_23
78 db X86_SEL_TYPE_SYS_286_TSS_AVAIL | 0x80
79 dw 0
80
81BS3_GLOBAL_DATA Bs3Gdte_Tss16Spare0, 8 ; Entry 030h
82 dw 0002bh ; 16-bit TSS, spare 0.
83 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss16Spare0)
84 db BS3_SYSTEM16_BASE_16_23
85 db X86_SEL_TYPE_SYS_286_TSS_AVAIL | 0x80
86 dw 0
87
88BS3_GLOBAL_DATA Bs3Gdte_Tss16Spare1, 8 ; Entry 038h
89 dw 0002bh ; 16-bit TSS, spare 0.
90 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss16Spare1)
91 db BS3_SYSTEM16_BASE_16_23
92 db X86_SEL_TYPE_SYS_286_TSS_AVAIL | 0x80
93 dw 0
94
95BS3_GLOBAL_DATA Bs3Gdte_Tss32, 8 ; Entry 040h
96 dw 00067h ; 32-bit TSS.
97 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss32)
98 db BS3_SYSTEM16_BASE_16_23
99 db X86_SEL_TYPE_SYS_386_TSS_AVAIL | 0x80
100 dw 0
101
102BS3_GLOBAL_DATA Bs3Gdte_Tss32DoubleFault, 8 ; Entry 048h
103 dw 00067h ; 32-bit TSS, double fault.
104 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss32DoubleFault)
105 db BS3_SYSTEM16_BASE_16_23
106 db X86_SEL_TYPE_SYS_386_TSS_AVAIL | 0x80
107 dw 0
108
109BS3_GLOBAL_DATA Bs3Gdte_Tss32Spare0, 8 ; Entry 050h
110 dw 00067h ; 32-bit TSS, spare 0.
111 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss32Spare0)
112 db BS3_SYSTEM16_BASE_16_23
113 db X86_SEL_TYPE_SYS_386_TSS_AVAIL | 0x80
114 dw 0
115
116BS3_GLOBAL_DATA Bs3Gdte_Tss32Spare1, 8 ; Entry 058h
117 dw 00067h ; 32-bit TSS, spare 1.
118 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss32Spare1)
119 db BS3_SYSTEM16_BASE_16_23
120 db X86_SEL_TYPE_SYS_386_TSS_AVAIL | 0x80
121 dw 0
122
123BS3_GLOBAL_DATA Bs3Gdte_Tss32IobpIntRedirBm, 8 ; Entry 060h
124 ; 32-bit TSS, with I/O permission & interrupt redirection bitmaps.
125 dw BS3_DATA_NM(Bs3SharedIobpEnd) - BS3_DATA_NM(Bs3Tss32WithIopb) - 1
126 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss32WithIopb)
127 db BS3_SYSTEM16_BASE_16_23
128 db X86_SEL_TYPE_SYS_386_TSS_AVAIL | 0x80
129 dw 0
130
131BS3_GLOBAL_DATA Bs3Gdte_Tss32IntRedirBm, 8 ; Entry 068h
132 ; 32-bit TSS, with interrupt redirection bitmap (IOBP stripped by limit).
133 dw BS3_DATA_NM(Bs3SharedIobp) - BS3_DATA_NM(Bs3Tss32WithIopb) - 1
134 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss32WithIopb)
135 db BS3_SYSTEM16_BASE_16_23
136 db X86_SEL_TYPE_SYS_386_TSS_AVAIL | 0x80
137 dw 0
138
139BS3_GLOBAL_DATA Bs3Gdte_Tss64, 8 ; Entry 070h
140 dw 00067h ; 64-bit TSS.
141 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss64)
142 db BS3_SYSTEM16_BASE_16_23
143 db AMD64_SEL_TYPE_SYS_TSS_AVAIL | 0x80
144 dw 0
145 dw 00000h, 00000h, 00000h, 00000h
146
147BS3_GLOBAL_DATA Bs3Gdte_Tss64Spare0, 8 ; Entry 080h
148 dw 00067h ; 64-bit TSS, spare 0.
149 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss64Spare0)
150 db BS3_SYSTEM16_BASE_16_23
151 db AMD64_SEL_TYPE_SYS_TSS_AVAIL | 0x80
152 dw 0
153 dw 00000h, 00000h, 00000h, 00000h
154
155BS3_GLOBAL_DATA Bs3Gdte_Tss64Spare1, 8 ; Entry 090h
156 dw 00067h ; 64-bit TSS, spare 1.
157 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss64Spare1)
158 db BS3_SYSTEM16_BASE_16_23
159 db AMD64_SEL_TYPE_SYS_TSS_AVAIL | 0x80
160 dw 0
161 dw 00000h, 00000h, 00000h, 00000h
162
163BS3_GLOBAL_DATA Bs3Gdte_Tss64Iobp, 8 ; Entry 0a0h
164 ; 64-bit TSS, with I/O permission bitmap
165 dw BS3_DATA_NM(Bs3SharedIobp) - BS3_DATA_NM(Bs3Tss64WithIopb) - 1
166 dw BS3_SYSTEM16_BASE_LOW(Bs3Tss64WithIopb)
167 db BS3_SYSTEM16_BASE_16_23
168 db AMD64_SEL_TYPE_SYS_TSS_AVAIL | 0x80
169 dw 0
170 dw 00000h, 00000h, 00000h, 00000h
171
172BS3GdtAssertOffset 0b0h
173 dw 00000h, 00000h, 00000h, 00000h ; Entry 0b0h - currently unused
174 dw 00000h, 00000h, 00000h, 00000h ; Entry 0b8h - currently unused
175 dw 00000h, 00000h, 00000h, 00000h ; Entry 0c0h - currently unused
176 dw 00000h, 00000h, 00000h, 00000h ; Entry 0c8h - currently unused
177 dw 00000h, 00000h, 00000h, 00000h ; Entry 0d0h - currently unused
178 dw 00000h, 00000h, 00000h, 00000h ; Entry 0d8h - currently unused
179 dw 00000h, 00000h, 00000h, 00000h ; Entry 0e0h - currently unused
180
181 ; Misc selectors.
182BS3_GLOBAL_DATA Bs3Gdte_X0TEXT16_CS, 8 ; Entry 0e8h
183 dw 0fffeh, 00000h ; 16-bit conforming code (read+exec) segment, accessed. Will be finalized at startup.
184 dw 09f00h, 00000h
185BS3_GLOBAL_DATA Bs3Gdte_X1TEXT16_CS, 8 ; Entry 0f0h
186 dw 0fffeh, 00000h ; 16-bit conforming code (read+exec) segment, accessed. Will be finalized at startup.
187 dw 09f00h, 00000h
188BS3_GLOBAL_DATA Bs3Gdte_R0_MMIO16, 8 ; Entry 0f8h
189 dw 0ffffh, 00000h, 09310h, 00000h ; 16-bit VMMDev MMIO segment with base 0100000h.
190BS3GdtAssertOffset 0100h
191
192
193;;
194; Macro that defines the selectors for ring-%1.
195;
196%macro BS3_GDT_RING_X_SELECTORS 1
197BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _First, 80h
198BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS16, 8 ; Entry 100h
199 dw 0ffffh, (0xffff & BS3_ADDR_BS3TEXT16) ; 16-bit code segment with base 010000h.
200 dw 09b01h | (%1 << 0dh) | (0xff & (BS3_ADDR_BS3TEXT16 >> 16)), 00000h | (0xff00 & (BS3_ADDR_BS3TEXT16 >> 16))
201
202BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _DS16, 8 ; Entry 108h
203 dw 0ffffh, (0xffff & BS3_ADDR_BS3DATA16) ; 16-bit data segment with base 029000h.
204 dw 09300h | (%1 << 0dh) | (0xff & (BS3_ADDR_BS3DATA16 >> 16)), 00000h | (0xff00 & (BS3_ADDR_BS3DATA16 >> 16))
205
206BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _SS16, 8 ; Entry 110h
207 dw 0ffffh, 00000h ; 16-bit stack segment with base 0.
208 dw 09300h | (%1 << 0dh), 00000h
209
210BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS32, 8 ; Entry 118h
211 dw 0ffffh, 00000h ; 32-bit flat code segment.
212 dw 09b00h | (%1 << 0dh), 000cfh
213
214BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _DS32, 8 ; Entry 120h
215 dw 0ffffh, 00000h ; 32-bit flat data segment.
216 dw 09300h | (%1 << 0dh), 000cfh
217
218BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _SS32, 8 ; Entry 128h
219 dw 0ffffh, 00000h ; 32-bit flat stack segment.
220 dw 09300h | (%1 << 0dh), 000cfh
221
222BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS64, 8 ; Entry 130h
223 dw 0ffffh, 00000h ; 64-bit code segment.
224 dw 09a00h | (%1 << 0dh), 000afh
225
226BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _DS64, 8 ; Entry 138h (also SS64)
227 dw 0ffffh, 00000h ; 64-bit stack and data segment.
228 dw 09300h | (%1 << 0dh), 000afh
229
230BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS16_EO, 8 ; Entry 140h
231 dw 0ffffh, (0xffff & BS3_ADDR_BS3TEXT16) ; 16-bit code segment with base 01000h, not accessed, execute only, short limit.
232 dw 09800h | (%1 << 0dh) | (0xff & (BS3_ADDR_BS3TEXT16 >> 16)), 00000h | (0xff00 & (BS3_ADDR_BS3TEXT16 >> 16))
233
234BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS16_CNF, 8 ; Entry 148h
235 dw 0ffffh, (0xffff & BS3_ADDR_BS3TEXT16) ; 16-bit code segment with base 01000h, not accessed, execute only, short limit.
236 dw 09e00h | (%1 << 0dh) | (0xff & (BS3_ADDR_BS3TEXT16 >> 16)), 00000h | (0xff00 & (BS3_ADDR_BS3TEXT16 >> 16))
237
238BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS16_CND_EO, 8 ; Entry 150h
239 dw 0fffeh, 00000h ; 16-bit conforming code segment with base 0, not accessed, execute only, short limit.
240 dw 09c00h | (%1 << 0dh), 000cfh
241
242BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS32_EO, 8 ; Entry 158h
243 dw 0ffffh, 00000h ; 32-bit flat code segment, not accessed, execute only.
244 dw 09800h | (%1 << 0dh), 000cfh
245
246BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS32_CNF, 8 ; Entry 160h
247 dw 0ffffh, 00000h ; 32-bit flat conforming code segment, not accessed.
248 dw 09e00h | (%1 << 0dh), 000cfh
249
250BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS32_CNF_EO, 8 ; Entry 168h
251 dw 0ffffh, 00000h ; 32-bit flat conforming code segment, not accessed, execute only.
252 dw 09c00h | (%1 << 0dh), 000cfh
253
254BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS64_EO, 8 ; Entry 170h
255 dw 0ffffh, 00000h ; 64-bit code segment, not accessed, execute only.
256 dw 09800h | (%1 << 0dh), 000afh
257
258BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS64_CNF, 8 ; Entry 178h
259 dw 0ffffh, 00000h ; 64-bit conforming code segment, not accessed.
260 dw 09e00h | (%1 << 0dh), 000afh
261
262BS3_GLOBAL_DATA Bs3Gdte_R %+ %1 %+ _CS64_CNF_EO, 8 ; Entry 180h
263 dw 0ffffh, 00000h ; 64-bit conforming code segment, execute only, not accessed.
264 dw 09c00h | (%1 << 0dh), 000afh
265
266;; @todo expand down segments.
267 dw 00000h, 00000h, 00000h, 00000h ; Entry 188h - unused.
268 dw 00000h, 00000h, 00000h, 00000h ; Entry 190h - unused.
269 dw 00000h, 00000h, 00000h, 00000h ; Entry 198h - unused.
270 dw 00000h, 00000h, 00000h, 00000h ; Entry 1a0h - unused.
271 dw 00000h, 00000h, 00000h, 00000h ; Entry 1a8h - unused.
272 dw 00000h, 00000h, 00000h, 00000h ; Entry 1b0h - unused.
273 dw 00000h, 00000h, 00000h, 00000h ; Entry 1b8h - unused.
274 dw 00000h, 00000h, 00000h, 00000h ; Entry 1c0h - unused.
275 dw 00000h, 00000h, 00000h, 00000h ; Entry 1c8h - unused.
276 dw 00000h, 00000h, 00000h, 00000h ; Entry 1d0h - unused.
277 dw 00000h, 00000h, 00000h, 00000h ; Entry 1d8h - unused.
278 dw 00000h, 00000h, 00000h, 00000h ; Entry 1e0h - unused.
279 dw 00000h, 00000h, 00000h, 00000h ; Entry 1e8h - unused.
280 dw 00000h, 00000h, 00000h, 00000h ; Entry 1f0h - unused.
281 dw 00000h, 00000h, 00000h, 00000h ; Entry 1f8h - unused.
282%endmacro
283
284 ;
285 ; 100h..1f8h - Ring-0 selectors.
286 ;
287 BS3_GDT_RING_X_SELECTORS 0
288
289 ;
290 ; 200h..2f8h - Ring-1 selectors.
291 ;
292 BS3_GDT_RING_X_SELECTORS 1
293
294 ;
295 ; 300h..3f8h - Ring-2 selectors.
296 ;
297 BS3_GDT_RING_X_SELECTORS 2
298
299 ;
300 ; 400h..4f8h - Ring-3 selectors.
301 ;
302 BS3_GDT_RING_X_SELECTORS 3
303
304 ;
305 ; 500..5f8h - Named spare GDT entries.
306 ;
307BS3GdtAssertOffset 0500h
308BS3_GLOBAL_DATA Bs3GdteSpare00, 8 ; Entry 500h
309 dq 0
310BS3_GLOBAL_DATA Bs3GdteSpare01, 8 ; Entry 508h
311 dq 0
312BS3_GLOBAL_DATA Bs3GdteSpare02, 8 ; Entry 510h
313 dq 0
314BS3_GLOBAL_DATA Bs3GdteSpare03, 8 ; Entry 518h
315 dq 0
316BS3_GLOBAL_DATA Bs3GdteSpare04, 8 ; Entry 520h
317 dq 0
318BS3_GLOBAL_DATA Bs3GdteSpare05, 8 ; Entry 528h
319 dq 0
320BS3_GLOBAL_DATA Bs3GdteSpare06, 8 ; Entry 530h
321 dq 0
322BS3_GLOBAL_DATA Bs3GdteSpare07, 8 ; Entry 538h
323 dq 0
324BS3_GLOBAL_DATA Bs3GdteSpare08, 8 ; Entry 540h
325 dq 0
326BS3_GLOBAL_DATA Bs3GdteSpare09, 8 ; Entry 548h
327 dq 0
328BS3_GLOBAL_DATA Bs3GdteSpare0a, 8 ; Entry 550h
329 dq 0
330BS3_GLOBAL_DATA Bs3GdteSpare0b, 8 ; Entry 558h
331 dq 0
332BS3_GLOBAL_DATA Bs3GdteSpare0c, 8 ; Entry 560h
333 dq 0
334BS3_GLOBAL_DATA Bs3GdteSpare0d, 8 ; Entry 568h
335 dq 0
336BS3_GLOBAL_DATA Bs3GdteSpare0e, 8 ; Entry 570h
337 dq 0
338BS3_GLOBAL_DATA Bs3GdteSpare0f, 8 ; Entry 578h
339 dq 0
340BS3_GLOBAL_DATA Bs3GdteSpare10, 8 ; Entry 580h
341 dq 0
342BS3_GLOBAL_DATA Bs3GdteSpare11, 8 ; Entry 588h
343 dq 0
344BS3_GLOBAL_DATA Bs3GdteSpare12, 8 ; Entry 590h
345 dq 0
346BS3_GLOBAL_DATA Bs3GdteSpare13, 8 ; Entry 598h
347 dq 0
348BS3_GLOBAL_DATA Bs3GdteSpare14, 8 ; Entry 5a0h
349 dq 0
350BS3_GLOBAL_DATA Bs3GdteSpare15, 8 ; Entry 5a8h
351 dq 0
352BS3_GLOBAL_DATA Bs3GdteSpare16, 8 ; Entry 5b0h
353 dq 0
354BS3_GLOBAL_DATA Bs3GdteSpare17, 8 ; Entry 5b8h
355 dq 0
356BS3_GLOBAL_DATA Bs3GdteSpare18, 8 ; Entry 5c0h
357 dq 0
358BS3_GLOBAL_DATA Bs3GdteSpare19, 8 ; Entry 5c8h
359 dq 0
360BS3_GLOBAL_DATA Bs3GdteSpare1a, 8 ; Entry 5d0h
361 dq 0
362BS3_GLOBAL_DATA Bs3GdteSpare1b, 8 ; Entry 5d8h
363 dq 0
364BS3_GLOBAL_DATA Bs3GdteSpare1c, 8 ; Entry 5e0h
365 dq 0
366BS3_GLOBAL_DATA Bs3GdteSpare1d, 8 ; Entry 5e8h
367 dq 0
368BS3_GLOBAL_DATA Bs3GdteSpare1e, 8 ; Entry 5f0h
369 dq 0
370BS3_GLOBAL_DATA Bs3GdteSpare1f, 8 ; Entry 5f8h
371 dq 0
372
373 ;
374 ; 600..df8h - 16-bit DPL=3 data segments covering the first 16MB of memory.
375 ;
376BS3_GLOBAL_DATA Bs3GdteTiled, 8 ; Entry 600h
377%assign u8HighBase 0
378%rep 256
379 dw 0ffffh, 00000h, 0f300h | u8HighBase, 00000h
380%assign u8HighBase u8HighBase + 1
381%endrep
382 ;
383 ; e00..ff8h - Free GDTEs.
384 ;
385BS3GdtAssertOffset 0e00h
386BS3_GLOBAL_DATA Bs3GdteFreePart1, 200h
387 times 200h db 0
388
389 ;
390 ; 1000h - the real mode segment number for BS3TEXT16. DPL=0. BASE=0x10000h
391 ;
392BS3GdtAssertOffset 01000h
393BS3_GLOBAL_DATA Bs3Gdte_CODE16, 8h
394 dw 0ffffh, 00000h, 09b01h, 00000h
395
396 ;
397 ; 1008..17f8h - Free GDTEs.
398 ;
399BS3GdtAssertOffset 01008h
400BS3_GLOBAL_DATA Bs3GdteFreePart2, 07f8h
401 times 07f8h db 0
402
403 ;
404 ; 1800..1ff8h - 16-bit DPL=0 data/stack segments covering the first 16MB of memory.
405 ;
406BS3GdtAssertOffset 01800h
407BS3_GLOBAL_DATA Bs3GdteTiledR0, 8 ; Entry 1800h
408%assign u8HighBase 0
409%rep 256
410 dw 0ffffh, 00000h, 09300h | u8HighBase, 00000h
411%assign u8HighBase u8HighBase + 1
412%endrep
413
414 ;
415 ; 2000h - the real mode segment number for BS3SYSTEM. DPL=3. BASE=0x20000h
416 ;
417BS3GdtAssertOffset 02000h
418BS3_GLOBAL_DATA Bs3Gdte_SYSTEM16, 8h
419 dw 0ffffh, 00000h, 0f302h, 00000h
420
421 ;
422 ; 2008..28f8h - Free GDTEs.
423 ;
424BS3_GLOBAL_DATA Bs3GdteFreePart3, 08f8h
425 times 08f8h db 0
426
427 ;
428 ; 2900h - the real mode segment number for BS3KIT_GRPNM_DATA16. DPL=3. BASE=0x29000h
429 ;
430BS3GdtAssertOffset 02900h
431BS3_GLOBAL_DATA Bs3Gdte_DATA16, 8h
432 dw 0ffffh, 09000h, 0f302h, 00000h
433
434 ;
435 ; 2908..2f98h - Free GDTEs.
436 ;
437BS3GdtAssertOffset 02908h
438BS3_GLOBAL_DATA Bs3GdteFreePart4, 698h
439 times 698h db 0
440
441 ;
442 ; 2be0..2fe0h - 8 spare entries preceeding the test page which we're free
443 ; to mess with page table protection.
444 ;
445BS3GdtAssertOffset 02fa0h
446BS3_GLOBAL_DATA Bs3GdtePreTestPage08, 8
447 dq 0
448BS3_GLOBAL_DATA Bs3GdtePreTestPage07, 8
449 dq 0
450BS3_GLOBAL_DATA Bs3GdtePreTestPage06, 8
451 dq 0
452BS3_GLOBAL_DATA Bs3GdtePreTestPage05, 8
453 dq 0
454BS3_GLOBAL_DATA Bs3GdtePreTestPage04, 8
455 dq 0
456BS3_GLOBAL_DATA Bs3GdtePreTestPage03, 8
457 dq 0
458BS3_GLOBAL_DATA Bs3GdtePreTestPage02, 8
459 dq 0
460BS3_GLOBAL_DATA Bs3GdtePreTestPage01, 8
461 dq 0
462
463 ;
464 ; 2fe0..3fd8h - 16 Test entries at the start of the page where we're free
465 ; to mess with page table protection.
466 ;
467BS3GdtAssertOffset 02fe0h
468AssertCompile(($ - $$) == 0x3000)
469BS3_GLOBAL_DATA Bs3GdteTestPage, 0
470BS3_GLOBAL_DATA Bs3GdteTestPage00, 8
471 dq 0
472BS3_GLOBAL_DATA Bs3GdteTestPage01, 8
473 dq 0
474BS3_GLOBAL_DATA Bs3GdteTestPage02, 8
475 dq 0
476BS3_GLOBAL_DATA Bs3GdteTestPage03, 8
477 dq 0
478BS3_GLOBAL_DATA Bs3GdteTestPage04, 8
479 dq 0
480BS3_GLOBAL_DATA Bs3GdteTestPage05, 8
481 dq 0
482BS3_GLOBAL_DATA Bs3GdteTestPage06, 8
483 dq 0
484BS3_GLOBAL_DATA Bs3GdteTestPage07, 8
485 dq 0
486BS3GdtAssertOffset 3020h
487 times 0fb8h db 0
488BS3GdtAssertOffset 3fd8h
489BS3_GLOBAL_DATA Bs3GdtEnd, 0
490 db 10, 13, 'GDTE', 10, 13 ; alignment padding (next address on 16 byte boundrary).
491BS3GdtAssertOffset 4000h - 20h ; We're at a page boundrary here! Only GDT and eyecatchers on page starting at 3000h!
492AssertCompile(($ - $$) == 0x4000)
493
494
495
496;;
497; The 16-bit TSS.
498;
499BS3_GLOBAL_DATA Bs3Tss16, X86TSS16_size
500istruc X86TSS16
501 at X86TSS16.selPrev, dw 0
502 at X86TSS16.sp0, dw BS3_ADDR_STACK_R0
503 at X86TSS16.ss0, dw BS3_SEL_R0_SS16
504 at X86TSS16.sp1, dw BS3_ADDR_STACK_R1
505 at X86TSS16.ss1, dw BS3_SEL_R1_SS16
506 at X86TSS16.sp2, dw BS3_ADDR_STACK_R2
507 at X86TSS16.ss2, dw BS3_SEL_R2_SS16
508 at X86TSS16.ip, dw 0
509 at X86TSS16.flags, dw 0
510 at X86TSS16.ax, dw 0
511 at X86TSS16.cx, dw 0
512 at X86TSS16.dx, dw 0
513 at X86TSS16.bx, dw 0
514 at X86TSS16.sp, dw 0
515 at X86TSS16.bp, dw 0
516 at X86TSS16.si, dw 0
517 at X86TSS16.di, dw 0
518 at X86TSS16.es, dw 0
519 at X86TSS16.cs, dw 0
520 at X86TSS16.ss, dw 0
521 at X86TSS16.ds, dw 0
522 at X86TSS16.selLdt, dw 0
523iend
524
525;;
526; 16-bit TSS for (trying to) handle double faults.
527BS3_GLOBAL_DATA Bs3Tss16DoubleFault, X86TSS16_size
528istruc X86TSS16
529 at X86TSS16.selPrev, dw 0
530 at X86TSS16.sp0, dw BS3_ADDR_STACK_R0
531 at X86TSS16.ss0, dw BS3_SEL_R0_SS16
532 at X86TSS16.sp1, dw BS3_ADDR_STACK_R1
533 at X86TSS16.ss1, dw BS3_SEL_R1_SS16
534 at X86TSS16.sp2, dw BS3_ADDR_STACK_R2
535 at X86TSS16.ss2, dw BS3_SEL_R2_SS16
536 at X86TSS16.ip, dw 0 ; Will be filled in by routine setting up 16-bit mode w/ traps++.
537 at X86TSS16.flags, dw X86_EFL_1
538 at X86TSS16.ax, dw 0
539 at X86TSS16.cx, dw 0
540 at X86TSS16.dx, dw 0
541 at X86TSS16.bx, dw 0
542 at X86TSS16.sp, dw BS3_ADDR_STACK_R0_IST1
543 at X86TSS16.bp, dw 0
544 at X86TSS16.si, dw 0
545 at X86TSS16.di, dw 0
546 at X86TSS16.es, dw BS3_SEL_R0_DS16
547 at X86TSS16.cs, dw BS3_SEL_R0_CS16
548 at X86TSS16.ss, dw BS3_SEL_R0_SS16
549 at X86TSS16.ds, dw BS3_SEL_R0_DS16
550 at X86TSS16.selLdt, dw 0
551iend
552
553;;
554; A spare 16-bit TSS for testcases to play around with.
555BS3_GLOBAL_DATA Bs3Tss16Spare0, X86TSS16_size
556istruc X86TSS16
557 at X86TSS16.selPrev, dw 0
558 at X86TSS16.sp0, dw BS3_ADDR_STACK_R0
559 at X86TSS16.ss0, dw BS3_SEL_R0_SS16
560 at X86TSS16.sp1, dw BS3_ADDR_STACK_R1
561 at X86TSS16.ss1, dw BS3_SEL_R1_SS16
562 at X86TSS16.sp2, dw BS3_ADDR_STACK_R2
563 at X86TSS16.ss2, dw BS3_SEL_R2_SS16
564 at X86TSS16.ip, dw 0 ; Will be filled in by routine setting up 16-bit mode w/ traps++.
565 at X86TSS16.flags, dw X86_EFL_1
566 at X86TSS16.ax, dw 0
567 at X86TSS16.cx, dw 0
568 at X86TSS16.dx, dw 0
569 at X86TSS16.bx, dw 0
570 at X86TSS16.sp, dw BS3_ADDR_STACK_R0_IST2
571 at X86TSS16.bp, dw 0
572 at X86TSS16.si, dw 0
573 at X86TSS16.di, dw 0
574 at X86TSS16.es, dw BS3_SEL_R0_DS16
575 at X86TSS16.cs, dw BS3_SEL_R0_CS16
576 at X86TSS16.ss, dw BS3_SEL_R0_SS16
577 at X86TSS16.ds, dw BS3_SEL_R0_DS16
578 at X86TSS16.selLdt, dw 0
579iend
580
581;;
582; A spare 16-bit TSS for testcases to play around with.
583BS3_GLOBAL_DATA Bs3Tss16Spare1, X86TSS16_size
584istruc X86TSS16
585 at X86TSS16.selPrev, dw 0
586 at X86TSS16.sp0, dw BS3_ADDR_STACK_R0
587 at X86TSS16.ss0, dw BS3_SEL_R0_SS16
588 at X86TSS16.sp1, dw BS3_ADDR_STACK_R1
589 at X86TSS16.ss1, dw BS3_SEL_R1_SS16
590 at X86TSS16.sp2, dw BS3_ADDR_STACK_R2
591 at X86TSS16.ss2, dw BS3_SEL_R2_SS16
592 at X86TSS16.ip, dw 0 ; Will be filled in by routine setting up 16-bit mode w/ traps++.
593 at X86TSS16.flags, dw X86_EFL_1
594 at X86TSS16.ax, dw 0
595 at X86TSS16.cx, dw 0
596 at X86TSS16.dx, dw 0
597 at X86TSS16.bx, dw 0
598 at X86TSS16.sp, dw BS3_ADDR_STACK_R0_IST4
599 at X86TSS16.bp, dw 0
600 at X86TSS16.si, dw 0
601 at X86TSS16.di, dw 0
602 at X86TSS16.es, dw BS3_SEL_R0_DS16
603 at X86TSS16.cs, dw BS3_SEL_R0_CS16
604 at X86TSS16.ss, dw BS3_SEL_R0_SS16
605 at X86TSS16.ds, dw BS3_SEL_R0_DS16
606 at X86TSS16.selLdt, dw 0
607iend
608
609
610;;
611; The 32-bit TSS.
612;
613BS3_GLOBAL_DATA Bs3Tss32, X86TSS32_size
614istruc X86TSS32
615 at X86TSS32.selPrev, dw 0
616 at X86TSS32.padding1, dw 0
617 at X86TSS32.esp0, dd BS3_ADDR_STACK_R0
618 at X86TSS32.ss0, dw BS3_SEL_R0_SS32
619 at X86TSS32.padding_ss0, dw 1
620 at X86TSS32.esp1, dd 1
621 at X86TSS32.ss1, dw BS3_SEL_R1_SS32
622 at X86TSS32.padding_ss1, dw 1
623 at X86TSS32.esp2, dd 1
624 at X86TSS32.ss2, dw BS3_SEL_R2_SS32
625 at X86TSS32.padding_ss2, dw 1
626 at X86TSS32.cr3, dd 0
627 at X86TSS32.eip, dd 0
628 at X86TSS32.eflags, dd X86_EFL_1
629 at X86TSS32.eax, dd 0
630 at X86TSS32.ecx, dd 0
631 at X86TSS32.edx, dd 0
632 at X86TSS32.ebx, dd 0
633 at X86TSS32.esp, dd 0
634 at X86TSS32.ebp, dd 0
635 at X86TSS32.esi, dd 0
636 at X86TSS32.edi, dd 0
637 at X86TSS32.es, dw 0
638 at X86TSS32.padding_es, dw 0
639 at X86TSS32.cs, dw 0
640 at X86TSS32.padding_cs, dw 0
641 at X86TSS32.ss, dw 0
642 at X86TSS32.padding_ss, dw 0
643 at X86TSS32.ds, dw 0
644 at X86TSS32.padding_ds, dw 0
645 at X86TSS32.fs, dw 0
646 at X86TSS32.padding_fs, dw 0
647 at X86TSS32.gs, dw 0
648 at X86TSS32.padding_gs, dw 0
649 at X86TSS32.selLdt, dw 0
650 at X86TSS32.padding_ldt, dw 0
651 at X86TSS32.fDebugTrap, dw 0
652 at X86TSS32.offIoBitmap, dw (BS3_DATA_NM(Bs3SharedIobp) - BS3_DATA_NM(Bs3Tss32WithIopb))
653iend
654
655;;
656; The 32-bit TSS for handling double faults.
657BS3_GLOBAL_DATA Bs3Tss32DoubleFault, X86TSS32_size
658istruc X86TSS32
659 at X86TSS32.selPrev, dw 0
660 at X86TSS32.padding1, dw 0
661 at X86TSS32.esp0, dd BS3_ADDR_STACK_R0
662 at X86TSS32.ss0, dw BS3_SEL_R0_SS32
663 at X86TSS32.padding_ss0, dw 1
664 at X86TSS32.esp1, dd 1
665 at X86TSS32.ss1, dw BS3_SEL_R1_SS32
666 at X86TSS32.padding_ss1, dw 1
667 at X86TSS32.esp2, dd 1
668 at X86TSS32.ss2, dw BS3_SEL_R2_SS32
669 at X86TSS32.padding_ss2, dw 1
670 at X86TSS32.cr3, dd 0 ; Will be filled in by routine setting up paged 32-bit mode w/ traps++.
671 at X86TSS32.eip, dd 0 ; Will be filled in by routine setting up 32-bit mode w/ traps++.
672 at X86TSS32.eflags, dd X86_EFL_1
673 at X86TSS32.eax, dd 0
674 at X86TSS32.ecx, dd 0
675 at X86TSS32.edx, dd 0
676 at X86TSS32.ebx, dd 0
677 at X86TSS32.esp, dd BS3_ADDR_STACK_R0_IST1
678 at X86TSS32.ebp, dd 0
679 at X86TSS32.esi, dd 0
680 at X86TSS32.edi, dd 0
681 at X86TSS32.es, dw BS3_SEL_R0_DS32
682 at X86TSS32.padding_es, dw 0
683 at X86TSS32.cs, dw BS3_SEL_R0_CS32
684 at X86TSS32.padding_cs, dw 0
685 at X86TSS32.ss, dw BS3_SEL_R0_SS32
686 at X86TSS32.padding_ss, dw 0
687 at X86TSS32.ds, dw BS3_SEL_R0_DS32
688 at X86TSS32.padding_ds, dw 0
689 at X86TSS32.fs, dw BS3_SEL_R0_DS32
690 at X86TSS32.padding_fs, dw 0
691 at X86TSS32.gs, dw BS3_SEL_R0_DS32
692 at X86TSS32.padding_gs, dw 0
693 at X86TSS32.selLdt, dw 0
694 at X86TSS32.padding_ldt, dw 0
695 at X86TSS32.fDebugTrap, dw 0
696 at X86TSS32.offIoBitmap, dw 0
697iend
698
699;;
700; A spare 32-bit TSS testcases to play around with.
701BS3_GLOBAL_DATA Bs3Tss32Spare0, X86TSS32_size
702istruc X86TSS32
703 at X86TSS32.selPrev, dw 0
704 at X86TSS32.padding1, dw 0
705 at X86TSS32.esp0, dd BS3_ADDR_STACK_R0
706 at X86TSS32.ss0, dw BS3_SEL_R0_SS32
707 at X86TSS32.padding_ss0, dw 1
708 at X86TSS32.esp1, dd 1
709 at X86TSS32.ss1, dw BS3_SEL_R1_SS32
710 at X86TSS32.padding_ss1, dw 1
711 at X86TSS32.esp2, dd 1
712 at X86TSS32.ss2, dw BS3_SEL_R2_SS32
713 at X86TSS32.padding_ss2, dw 1
714 at X86TSS32.cr3, dd 0 ; Will be filled in by routine setting up paged 32-bit mode w/ traps++.
715 at X86TSS32.eip, dd 0 ; Will be filled in by routine setting up 32-bit mode w/ traps++.
716 at X86TSS32.eflags, dd X86_EFL_1
717 at X86TSS32.eax, dd 0
718 at X86TSS32.ecx, dd 0
719 at X86TSS32.edx, dd 0
720 at X86TSS32.ebx, dd 0
721 at X86TSS32.esp, dd BS3_ADDR_STACK_R0_IST2
722 at X86TSS32.ebp, dd 0
723 at X86TSS32.esi, dd 0
724 at X86TSS32.edi, dd 0
725 at X86TSS32.es, dw BS3_SEL_R0_DS32
726 at X86TSS32.padding_es, dw 0
727 at X86TSS32.cs, dw BS3_SEL_R0_CS32
728 at X86TSS32.padding_cs, dw 0
729 at X86TSS32.ss, dw BS3_SEL_R0_SS32
730 at X86TSS32.padding_ss, dw 0
731 at X86TSS32.ds, dw BS3_SEL_R0_DS32
732 at X86TSS32.padding_ds, dw 0
733 at X86TSS32.fs, dw BS3_SEL_R0_DS32
734 at X86TSS32.padding_fs, dw 0
735 at X86TSS32.gs, dw BS3_SEL_R0_DS32
736 at X86TSS32.padding_gs, dw 0
737 at X86TSS32.selLdt, dw 0
738 at X86TSS32.padding_ldt, dw 0
739 at X86TSS32.fDebugTrap, dw 0
740 at X86TSS32.offIoBitmap, dw 0
741iend
742
743;;
744; A spare 32-bit TSS testcases to play around with.
745BS3_GLOBAL_DATA Bs3Tss32Spare1, X86TSS32_size
746istruc X86TSS32
747 at X86TSS32.selPrev, dw 0
748 at X86TSS32.padding1, dw 0
749 at X86TSS32.esp0, dd BS3_ADDR_STACK_R0
750 at X86TSS32.ss0, dw BS3_SEL_R0_SS32
751 at X86TSS32.padding_ss0, dw 1
752 at X86TSS32.esp1, dd 1
753 at X86TSS32.ss1, dw BS3_SEL_R1_SS32
754 at X86TSS32.padding_ss1, dw 1
755 at X86TSS32.esp2, dd 1
756 at X86TSS32.ss2, dw BS3_SEL_R2_SS32
757 at X86TSS32.padding_ss2, dw 1
758 at X86TSS32.cr3, dd 0 ; Will be filled in by routine setting up paged 32-bit mode w/ traps++.
759 at X86TSS32.eip, dd 0 ; Will be filled in by routine setting up 32-bit mode w/ traps++.
760 at X86TSS32.eflags, dd X86_EFL_1
761 at X86TSS32.eax, dd 0
762 at X86TSS32.ecx, dd 0
763 at X86TSS32.edx, dd 0
764 at X86TSS32.ebx, dd 0
765 at X86TSS32.esp, dd BS3_ADDR_STACK_R0_IST4
766 at X86TSS32.ebp, dd 0
767 at X86TSS32.esi, dd 0
768 at X86TSS32.edi, dd 0
769 at X86TSS32.es, dw BS3_SEL_R0_DS32
770 at X86TSS32.padding_es, dw 0
771 at X86TSS32.cs, dw BS3_SEL_R0_CS32
772 at X86TSS32.padding_cs, dw 0
773 at X86TSS32.ss, dw BS3_SEL_R0_SS32
774 at X86TSS32.padding_ss, dw 0
775 at X86TSS32.ds, dw BS3_SEL_R0_DS32
776 at X86TSS32.padding_ds, dw 0
777 at X86TSS32.fs, dw BS3_SEL_R0_DS32
778 at X86TSS32.padding_fs, dw 0
779 at X86TSS32.gs, dw BS3_SEL_R0_DS32
780 at X86TSS32.padding_gs, dw 0
781 at X86TSS32.selLdt, dw 0
782 at X86TSS32.padding_ldt, dw 0
783 at X86TSS32.fDebugTrap, dw 0
784 at X86TSS32.offIoBitmap, dw 0
785iend
786
787
788
789;;
790; 64-bit TSS
791BS3_GLOBAL_DATA Bs3Tss64, X86TSS64_size
792istruc X86TSS64
793 at X86TSS64.u32Reserved, dd 0
794 at X86TSS64.rsp0, dq BS3_ADDR_STACK_R0
795 at X86TSS64.rsp1, dq BS3_ADDR_STACK_R1
796 at X86TSS64.rsp2, dq BS3_ADDR_STACK_R2
797 at X86TSS64.u32Reserved2, dd 0
798 at X86TSS64.ist1, dq BS3_ADDR_STACK_R0_IST1
799 at X86TSS64.ist2, dq BS3_ADDR_STACK_R0_IST2
800 at X86TSS64.ist3, dq BS3_ADDR_STACK_R0_IST3
801 at X86TSS64.ist4, dq BS3_ADDR_STACK_R0_IST4
802 at X86TSS64.ist5, dq BS3_ADDR_STACK_R0_IST5
803 at X86TSS64.ist6, dq BS3_ADDR_STACK_R0_IST6
804 at X86TSS64.ist7, dq BS3_ADDR_STACK_R0_IST7
805 at X86TSS64.u16Reserved, dw 0
806 at X86TSS64.offIoBitmap, dw 0
807iend
808
809;;
810; A spare TSS for testcases to play around with.
811BS3_GLOBAL_DATA Bs3Tss64Spare0, X86TSS64_size
812istruc X86TSS64
813 at X86TSS64.u32Reserved, dd 0
814 at X86TSS64.rsp0, dq BS3_ADDR_STACK_R0
815 at X86TSS64.rsp1, dq BS3_ADDR_STACK_R1
816 at X86TSS64.rsp2, dq BS3_ADDR_STACK_R2
817 at X86TSS64.u32Reserved2, dd 0
818 at X86TSS64.ist1, dq BS3_ADDR_STACK_R0_IST1
819 at X86TSS64.ist2, dq BS3_ADDR_STACK_R0_IST2
820 at X86TSS64.ist3, dq BS3_ADDR_STACK_R0_IST3
821 at X86TSS64.ist4, dq BS3_ADDR_STACK_R0_IST4
822 at X86TSS64.ist5, dq BS3_ADDR_STACK_R0_IST5
823 at X86TSS64.ist6, dq BS3_ADDR_STACK_R0_IST6
824 at X86TSS64.ist7, dq BS3_ADDR_STACK_R0_IST7
825 at X86TSS64.u16Reserved, dw 0
826 at X86TSS64.offIoBitmap, dw 0
827iend
828
829;;
830; A spare TSS for testcases to play around with.
831BS3_GLOBAL_DATA Bs3Tss64Spare1, X86TSS64_size
832istruc X86TSS64
833 at X86TSS64.u32Reserved, dd 0
834 at X86TSS64.rsp0, dq BS3_ADDR_STACK_R0
835 at X86TSS64.rsp1, dq BS3_ADDR_STACK_R1
836 at X86TSS64.rsp2, dq BS3_ADDR_STACK_R2
837 at X86TSS64.u32Reserved2, dd 0
838 at X86TSS64.ist1, dq BS3_ADDR_STACK_R0_IST1
839 at X86TSS64.ist2, dq BS3_ADDR_STACK_R0_IST2
840 at X86TSS64.ist3, dq BS3_ADDR_STACK_R0_IST3
841 at X86TSS64.ist4, dq BS3_ADDR_STACK_R0_IST4
842 at X86TSS64.ist5, dq BS3_ADDR_STACK_R0_IST5
843 at X86TSS64.ist6, dq BS3_ADDR_STACK_R0_IST6
844 at X86TSS64.ist7, dq BS3_ADDR_STACK_R0_IST7
845 at X86TSS64.u16Reserved, dw 0
846 at X86TSS64.offIoBitmap, dw 0
847iend
848
849
850
851;;
852; 64-bit TSS sharing an I/O permission bitmap (Bs3SharedIobp) with a 32-bit TSS.
853;
854BS3_GLOBAL_DATA Bs3Tss64WithIopb, X86TSS64_size
855istruc X86TSS64
856 at X86TSS64.u32Reserved, dd 0
857 at X86TSS64.rsp0, dq BS3_ADDR_STACK_R0
858 at X86TSS64.rsp1, dq BS3_ADDR_STACK_R1
859 at X86TSS64.rsp2, dq BS3_ADDR_STACK_R2
860 at X86TSS64.u32Reserved2, dd 0
861 at X86TSS64.ist1, dq BS3_ADDR_STACK_R0_IST1
862 at X86TSS64.ist2, dq BS3_ADDR_STACK_R0_IST2
863 at X86TSS64.ist3, dq BS3_ADDR_STACK_R0_IST3
864 at X86TSS64.ist4, dq BS3_ADDR_STACK_R0_IST4
865 at X86TSS64.ist5, dq BS3_ADDR_STACK_R0_IST5
866 at X86TSS64.ist6, dq BS3_ADDR_STACK_R0_IST6
867 at X86TSS64.ist7, dq BS3_ADDR_STACK_R0_IST7
868 at X86TSS64.u16Reserved, dw 0
869 at X86TSS64.offIoBitmap, dw (BS3_DATA_NM(Bs3SharedIobp) - BS3_DATA_NM(Bs3Tss64WithIopb))
870iend
871
872;;
873; 32-bit TSS sharing an I/O permission bitmap (Bs3SharedIobp) with a 64-bit TSS,
874; and sporting an interrupt redirection bitmap (Bs3SharedIntRedirBm).
875BS3_GLOBAL_DATA Bs3Tss32WithIopb, X86TSS32_size
876istruc X86TSS32
877 at X86TSS32.selPrev, dw 0
878 at X86TSS32.padding1, dw 0
879 at X86TSS32.esp0, dd BS3_ADDR_STACK_R0
880 at X86TSS32.ss0, dw BS3_SEL_R0_SS32
881 at X86TSS32.padding_ss0, dw 1
882 at X86TSS32.esp1, dd 1
883 at X86TSS32.ss1, dw BS3_SEL_R1_SS32
884 at X86TSS32.padding_ss1, dw 1
885 at X86TSS32.esp2, dd 1
886 at X86TSS32.ss2, dw BS3_SEL_R2_SS32
887 at X86TSS32.padding_ss2, dw 1
888 at X86TSS32.cr3, dd 0 ; Will be filled in by routine setting up paged 32-bit mode w/ traps++.
889 at X86TSS32.eip, dd 0 ; Will be filled in by routine setting up 32-bit mode w/ traps++.
890 at X86TSS32.eflags, dd X86_EFL_1
891 at X86TSS32.eax, dd 0
892 at X86TSS32.ecx, dd 0
893 at X86TSS32.edx, dd 0
894 at X86TSS32.ebx, dd 0
895 at X86TSS32.esp, dd 0
896 at X86TSS32.ebp, dd 0
897 at X86TSS32.esi, dd 0
898 at X86TSS32.edi, dd 0
899 at X86TSS32.es, dw 0
900 at X86TSS32.padding_es, dw 0
901 at X86TSS32.cs, dw 0
902 at X86TSS32.padding_cs, dw 0
903 at X86TSS32.ss, dw 0
904 at X86TSS32.padding_ss, dw 0
905 at X86TSS32.ds, dw 0
906 at X86TSS32.padding_ds, dw 0
907 at X86TSS32.fs, dw 0
908 at X86TSS32.padding_fs, dw 0
909 at X86TSS32.gs, dw 0
910 at X86TSS32.padding_gs, dw 0
911 at X86TSS32.selLdt, dw 0
912 at X86TSS32.padding_ldt, dw 0
913 at X86TSS32.fDebugTrap, dw 0
914 at X86TSS32.offIoBitmap, dw (BS3_DATA_NM(Bs3SharedIobp) - BS3_DATA_NM(Bs3Tss32WithIopb))
915iend
916
917;
918; We insert 6 bytes before the interrupt redirection bitmap just to make sure
919; we've all got the same idea about where it starts (i.e. 32 bytes before IOBP).
920;
921 times 6 db 0ffh
922
923;;
924; Interrupt redirection bitmap (used by 32-bit TSS).
925BS3_GLOBAL_DATA Bs3SharedIntRedirBm, 32
926 times 32 db 00h
927
928;;
929; Shared I/O permission bitmap used both by Bs3Tss64WithIopb and Bs3Tss32WithIopb.
930BS3_GLOBAL_DATA Bs3SharedIobp, 8192+2
931 times 8192+2 db 0ffh
932BS3_GLOBAL_DATA Bs3SharedIobpEnd, 0
933
934
935align 128
936
937;;
938; 16-bit IDT.
939; This requires manual setup by code fielding traps, so we'll just reserve the
940; memory here.
941;
942BS3_GLOBAL_DATA Bs3Idt16, 256*8
943 times 256 dq 0
944
945;;
946; 32-bit IDT.
947; This requires manual setup by code fielding traps, so we'll just reserve the
948; memory here.
949;
950BS3_GLOBAL_DATA Bs3Idt32, 256*8
951 times 256 dq 0
952
953;;
954; 64-bit IDT.
955; This requires manual setup by code fielding traps, so we'll just reserve the
956; memory here.
957;
958BS3_GLOBAL_DATA Bs3Idt64, 256*16
959 times 256 dq 0, 0
960
961
962 times 6 db 0 ; Pad the first LIDT correctly.
963
964;;
965; LIDT structure for the 16-bit IDT (8-byte aligned on offset).
966BS3_GLOBAL_DATA Bs3Lidt_Idt16, 2+8
967 dw 256*8 - 1 ; limit
968 dw BS3_SYSTEM16_BASE_LOW(Bs3Idt16) ; low offset
969 dw (BS3_ADDR_BS3SYSTEM16 >> 16) ; high offset
970 dd 0 ; top32 offset
971
972 times 4 db 0 ; padding the start of the next
973
974;;
975; LIDT structure for the 32-bit IDT (8-byte aligned on offset).
976BS3_GLOBAL_DATA Bs3Lidt_Idt32, 2+8
977 dw 256*8 - 1 ; limit
978 dw BS3_SYSTEM16_BASE_LOW(Bs3Idt32) ; low offset
979 dw (BS3_ADDR_BS3SYSTEM16 >> 16) ; high offset
980 dd 0 ; top32 offset
981
982 times 4 db 0 ; padding the start of the next
983
984;;
985; LIDT structure for the 64-bit IDT (8-byte aligned on offset).
986BS3_GLOBAL_DATA Bs3Lidt_Idt64, 2+8
987 dw 256*16 - 1 ; limit
988 dw BS3_SYSTEM16_BASE_LOW(Bs3Idt64) ; low offset
989 dw (BS3_ADDR_BS3SYSTEM16 >> 16) ; high offset
990 dd 0 ; top32 offset
991
992 times 4 db 0 ; padding the start of the next
993
994;;
995; LIDT structure for the real mode IVT at address 0x00000000 (8-byte aligned on offset).
996BS3_GLOBAL_DATA Bs3Lidt_Ivt, 2+8
997 dw 256*4 - 1 ; limit
998 dw 0 ; low offset
999 dw 0 ; high offset
1000 dd 0 ; top32 offset
1001
1002 times 4 db 0 ; padding the start of the next
1003
1004;;
1005; LGDT structure for the GDT (8-byte aligned on offset).
1006BS3_GLOBAL_DATA Bs3Lgdt_Gdt, 2+8
1007 dw BS3_DATA_NM(Bs3GdtEnd) - BS3_DATA_NM(Bs3Gdt) - 1 ; limit
1008 dw BS3_SYSTEM16_BASE_LOW(Bs3Gdt) ; low offset
1009 dw (BS3_ADDR_BS3SYSTEM16 >> 16) ; high offset
1010 dd 0 ; top32 offset
1011
1012
1013
1014align 16
1015;;
1016; LDT filling up the rest of the segment.
1017;
1018; Currently this starts at 0x84d0, which leaves us with 0xb30 bytes. We'll use
1019; the last 32 of those for an eye catcher.
1020;
1021BS3_GLOBAL_DATA Bs3Ldt, 0b30h - 32
1022 times (0b30h - 32) db 0
1023BS3_GLOBAL_DATA Bs3LdtEnd, 0
1024 db 10, 13, 'eye-catcher: SYSTEM16 END', 10, 13, 0, 0, 0 ; 32 bytes long
1025
1026;
1027; Check the segment size.
1028;
1029%ifndef KBUILD_GENERATING_MAKEFILE_DEPENDENCIES
1030 %if ($ - $$) != 09000h
1031 %assign offActual ($ - $$)
1032 %error "Bad BS3SYSTEM16 segment size: " %+ offActual %+ ", expected 0x9000 (36864)"
1033 %endif
1034%endif
1035
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette