VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.mac@ 59245

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

bs3kit: Implemented switching to long mode.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.7 KB
Line 
1; $Id: bs3kit-template-header.mac 59245 2016-01-04 01:57:26Z vboxsync $
2;; @file
3; BS3Kit header for multi-mode code templates.
4;
5
6;
7; Copyright (C) 2007-2015 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;
30; Check and expand the mode defines.
31; One of the following must be defined:
32; - TMPL_RM - real mode.
33; - TMPL_PE16 - 16-bit protected mode, unpaged.
34; - TMPL_PE32 - 32-bit protected mode, unpaged.
35; - TMPL_PEV86 - virtual 8086 mode under protected mode, unpaged.
36; - TMPL_PP16 - 16-bit protected mode, paged.
37; - TMPL_PP32 - 32-bit protected mode, paged.
38; - TMPL_PPV86 - virtual 8086 mode under protected mode, paged.
39; - TMPL_PAE16 - 16-bit protected mode with PAE (paged).
40; - TMPL_PAE32 - 16-bit protected mode with PAE (paged).
41; - TMPL_PAEV86- virtual 8086 mode under protected mode with PAE (paged).
42; - TMPL_LM16 - 16-bit long mode (paged).
43; - TMPL_LM32 - 32-bit long mode (paged).
44; - TMPL_LM64 - 64-bit long mode (paged).
45;
46; Derived indicators:
47; - TMPL_CMN_PE = TMPL_PE16 | TMPL_PE32 | TMPL_PEV86
48; - TMPL_CMN_PP = TMPL_PP16 | TMPL_PP32 | TMPL_PPV86
49; - TMPL_CMN_PAE = TMPL_PAE16 | TMPL_PAE32 | TMPL_PAEV86
50; - TMPL_CMN_LM = TMPL_LM16 | TMPL_LM32 | TMPL_LM64
51; - TMPL_CMN_V86 = TMPL_PEV86 | TMPL_PPV86 | TMPL_PAEV86
52; - TMPL_CMN_R86 = TMPL_CMN_V86 | TMPL_RM
53;
54%ifdef TMPL_RM
55 %ifdef TMPL_PE16
56 %error "Both 'TMPL_RM' and 'TMPL_PE16' are defined."
57 %endif
58 %ifdef TMPL_PE32
59 %error "Both 'TMPL_RM' and 'TMPL_PE32' are defined."
60 %endif
61 %ifdef TMPL_PEV86
62 %error "Both 'TMPL_RM' and 'TMPL_PEV86' are defined."
63 %endif
64 %ifdef TMPL_PP16
65 %error "Both 'TMPL_RM' and 'TMPL_PP16' are defined."
66 %endif
67 %ifdef TMPL_PP32
68 %error "Both 'TMPL_RM' and 'TMPL_PP32' are defined."
69 %endif
70 %ifdef TMPL_PPV86
71 %error "Both 'TMPL_RM' and 'TMPL_PPV86' are defined."
72 %endif
73 %ifdef TMPL_PAE16
74 %error "Both 'TMPL_RM' and 'TMPL_PAE16' are defined."
75 %endif
76 %ifdef TMPL_PAE32
77 %error "Both 'TMPL_RM' and 'TMPL_PAE32' are defined."
78 %endif
79 %ifdef TMPL_PAEV86
80 %error "Both 'TMPL_RM' and 'TMPL_PAEV86' are defined."
81 %endif
82 %ifdef TMPL_LM16
83 %error "Both 'TMPL_RM' and 'TMPL_LM16' are defined."
84 %endif
85 %ifdef TMPL_LM32
86 %error "Both 'TMPL_RM' and 'TMPL_LM32' are defined."
87 %endif
88 %ifdef TMPL_LM64
89 %error "Both 'TMPL_RM' and 'TMPL_LM64' are defined."
90 %endif
91 %define TMPL_16BIT
92 %define TMPL_BITS 16
93 %define TMPL_PTR_DEF dw
94 %define TMPL_NM(Name) _ %+ Name %+ _rm
95 %define BS3_CMN_NM(Name) _ %+ Name %+ _c16
96 %define TMPL_MODE_STR 'real mode'
97 %define TMPL_HAVE_BIOS
98 %define TMPL_CMN_R86
99%endif
100
101%ifdef TMPL_PE16
102 %ifdef TMPL_RM
103 %error "Both 'TMPL_PE16' and 'TMPL_RM' are defined."
104 %endif
105 %ifdef TMPL_PE32
106 %error "Both 'TMPL_PE16' and 'TMPL_PE32' are defined."
107 %endif
108 %ifdef TMPL_PEV86
109 %error "Both 'TMPL_RM' and 'TMPL_PEV86' are defined."
110 %endif
111 %ifdef TMPL_PP16
112 %error "Both 'TMPL_PE16' and 'TMPL_PP16' are defined."
113 %endif
114 %ifdef TMPL_PP32
115 %error "Both 'TMPL_PE16' and 'TMPL_PP32' are defined."
116 %endif
117 %ifdef TMPL_PPV86
118 %error "Both 'TMPL_PE16' and 'TMPL_PPV86' are defined."
119 %endif
120 %ifdef TMPL_PAE16
121 %error "Both 'TMPL_PE16' and 'TMPL_PAE16' are defined."
122 %endif
123 %ifdef TMPL_PAE32
124 %error "Both 'TMPL_PE16' and 'TMPL_PAE32' are defined."
125 %endif
126 %ifdef TMPL_PAEV86
127 %error "Both 'TMPL_PE32' and 'TMPL_PAEV86' are defined."
128 %endif
129 %ifdef TMPL_LM16
130 %error "Both 'TMPL_PE16' and 'TMPL_LM16' are defined."
131 %endif
132 %ifdef TMPL_LM32
133 %error "Both 'TMPL_PE16' and 'TMPL_LM32' are defined."
134 %endif
135 %ifdef TMPL_LM64
136 %error "Both 'TMPL_PE16' and 'TMPL_LM64' are defined."
137 %endif
138 %define TMPL_CMN_PE
139 %define TMPL_CMN_P16
140 %define TMPL_16BIT
141 %define TMPL_BITS 16
142 %define TMPL_PTR_DEF dw
143 %define TMPL_NM(Name) _ %+ Name %+ _pe16
144 %define BS3_CMN_NM(Name) _ %+ Name %+ _c16
145 %define TMPL_MODE_STR '16-bit unpaged protected mode'
146%endif
147
148%ifdef TMPL_PE32
149 %ifdef TMPL_RM
150 %error "Both 'TMPL_PE32' and 'TMPL_RM' are defined."
151 %endif
152 %ifdef TMPL_PE16
153 %error "Both 'TMPL_PE32' and 'TMPL_PE16' are defined."
154 %endif
155 %ifdef TMPL_PEV86
156 %error "Both 'TMPL_PE32' and 'TMPL_PEV86' are defined."
157 %endif
158 %ifdef TMPL_PP16
159 %error "Both 'TMPL_PE32' and 'TMPL_PP16' are defined."
160 %endif
161 %ifdef TMPL_PP32
162 %error "Both 'TMPL_PE32' and 'TMPL_PP32' are defined."
163 %endif
164 %ifdef TMPL_PPV86
165 %error "Both 'TMPL_PE32' and 'TMPL_PPV86' are defined."
166 %endif
167 %ifdef TMPL_PAE16
168 %error "Both 'TMPL_PE32' and 'TMPL_PAE16' are defined."
169 %endif
170 %ifdef TMPL_PAE32
171 %error "Both 'TMPL_PE32' and 'TMPL_PAE32' are defined."
172 %endif
173 %ifdef TMPL_PAE86
174 %error "Both 'TMPL_PE32' and 'TMPL_PPV86' are defined."
175 %endif
176 %ifdef TMPL_LM16
177 %error "Both 'TMPL_PE32' and 'TMPL_LM16' are defined."
178 %endif
179 %ifdef TMPL_LM32
180 %error "Both 'TMPL_PE32' and 'TMPL_LM32' are defined."
181 %endif
182 %ifdef TMPL_LM64
183 %error "Both 'TMPL_PE32' and 'TMPL_LM64' are defined."
184 %endif
185 %define TMPL_CMN_PE
186 %define TMPL_CMN_P32
187 %define TMPL_32BIT
188 %define TMPL_BITS 32
189 %define TMPL_PTR_DEF dd
190 %define TMPL_NM(Name) _ %+ Name %+ _pe32
191 %define BS3_CMN_NM(Name) _ %+ Name %+ _c32
192 %define TMPL_MODE_STR '32-bit unpaged protected mode'
193%endif
194
195%ifdef TMPL_PEV86
196 %ifdef TMPL_RM
197 %error "Both 'TMPL_PEV86' and 'TMPL_RM' are defined."
198 %endif
199 %ifdef TMPL_PE16
200 %error "Both 'TMPL_PEV86' and 'TMPL_PE16' are defined."
201 %endif
202 %ifdef TMPL_PP32
203 %error "Both 'TMPL_PEV86' and 'TMPL_PP32' are defined."
204 %endif
205 %ifdef TMPL_PP16
206 %error "Both 'TMPL_PEV86' and 'TMPL_PP16' are defined."
207 %endif
208 %ifdef TMPL_PP32
209 %error "Both 'TMPL_PEV86' and 'TMPL_PP32' are defined."
210 %endif
211 %ifdef TMPL_PPV86
212 %error "Both 'TMPL_PEV86' and 'TMPL_PPV86' are defined."
213 %endif
214 %ifdef TMPL_PAE16
215 %error "Both 'TMPL_PEV86' and 'TMPL_PAE16' are defined."
216 %endif
217 %ifdef TMPL_PAE32
218 %error "Both 'TMPL_PEV86' and 'TMPL_PAE32' are defined."
219 %endif
220 %ifdef TMPL_PAE86
221 %error "Both 'TMPL_PEV86' and 'TMPL_PPV86' are defined."
222 %endif
223 %ifdef TMPL_LM16
224 %error "Both 'TMPL_PEV86' and 'TMPL_LM16' are defined."
225 %endif
226 %ifdef TMPL_LM32
227 %error "Both 'TMPL_PEV86' and 'TMPL_LM32' are defined."
228 %endif
229 %ifdef TMPL_LM64
230 %error "Both 'TMPL_PEV86' and 'TMPL_LM64' are defined."
231 %endif
232 %define TMPL_CMN_PE
233 %define TMPL_CMN_V86
234 %define TMPL_CMN_R86
235 %define TMPL_16BIT
236 %define TMPL_BITS 16
237 %define TMPL_PTR_DEF dw
238 %define TMPL_NM(Name) _ %+ Name %+ _pev86
239 %define BS3_CMN_NM(Name) _ %+ Name %+ _c16
240 %define TMPL_MODE_STR 'v8086 unpaged protected mode'
241%endif
242
243%ifdef TMPL_PP16
244 %ifdef TMPL_RM
245 %error "Both 'TMPL_PP16' and 'TMPL_RM' are defined."
246 %endif
247 %ifdef TMPL_PE16
248 %error "Both 'TMPL_PP16' and 'TMPL_PE16' are defined."
249 %endif
250 %ifdef TMPL_PE32
251 %error "Both 'TMPL_PP16' and 'TMPL_PE32' are defined."
252 %endif
253 %ifdef TMPL_PEV86
254 %error "Both 'TMPL_PP16' and 'TMPL_PEV86' are defined."
255 %endif
256 %ifdef TMPL_PP32
257 %error "Both 'TMPL_PP16' and 'TMPL_PP32' are defined."
258 %endif
259 %ifdef TMPL_PPV86
260 %error "Both 'TMPL_PP32' and 'TMPL_PPV86' are defined."
261 %endif
262 %ifdef TMPL_PAE16
263 %error "Both 'TMPL_PP16' and 'TMPL_PAE16' are defined."
264 %endif
265 %ifdef TMPL_PAE32
266 %error "Both 'TMPL_PP16' and 'TMPL_PAE32' are defined."
267 %endif
268 %ifdef TMPL_PAEV86
269 %error "Both 'TMPL_PP16' and 'TMPL_PAEV86' are defined."
270 %endif
271 %ifdef TMPL_LM16
272 %error "Both 'TMPL_PP16' and 'TMPL_LM16' are defined."
273 %endif
274 %ifdef TMPL_LM32
275 %error "Both 'TMPL_PP16' and 'TMPL_LM32' are defined."
276 %endif
277 %ifdef TMPL_LM64
278 %error "Both 'TMPL_PP16' and 'TMPL_LM64' are defined."
279 %endif
280 %define TMPL_CMN_PP
281 %define TMPL_CMN_P16
282 %define TMPL_16BIT
283 %define TMPL_BITS 16
284 %define TMPL_PTR_DEF dw
285 %define TMPL_NM(Name) _ %+ Name %+ _pp16
286 %define BS3_CMN_NM(Name) _ %+ Name %+ _c16
287 %define TMPL_MODE_STR '16-bit paged protected mode'
288%endif
289
290%ifdef TMPL_PP32
291 %ifdef TMPL_RM
292 %error "Both 'TMPL_PP32' and 'TMPL_RM' are defined."
293 %endif
294 %ifdef TMPL_PE16
295 %error "Both 'TMPL_PP32' and 'TMPL_PE16' are defined."
296 %endif
297 %ifdef TMPL_PE32
298 %error "Both 'TMPL_PP32' and 'TMPL_PE32' are defined."
299 %endif
300 %ifdef TMPL_PEV86
301 %error "Both 'TMPL_PP32' and 'TMPL_PEV86' are defined."
302 %endif
303 %ifdef TMPL_PP16
304 %error "Both 'TMPL_PP32' and 'TMPL_PP16' are defined."
305 %endif
306 %ifdef TMPL_PPV86
307 %error "Both 'TMPL_PP32' and 'TMPL_PPV86' are defined."
308 %endif
309 %ifdef TMPL_PAE16
310 %error "Both 'TMPL_PP32' and 'TMPL_PAE16' are defined."
311 %endif
312 %ifdef TMPL_PAE32
313 %error "Both 'TMPL_PP32' and 'TMPL_PAE32' are defined."
314 %endif
315 %ifdef TMPL_PAEV86
316 %error "Both 'TMPL_PP32' and 'TMPL_PAEV86' are defined."
317 %endif
318 %ifdef TMPL_LM16
319 %error "Both 'TMPL_PP32' and 'TMPL_LM16' are defined."
320 %endif
321 %ifdef TMPL_LM32
322 %error "Both 'TMPL_PP32' and 'TMPL_LM32' are defined."
323 %endif
324 %ifdef TMPL_LM64
325 %error "Both 'TMPL_PP32' and 'TMPL_LM64' are defined."
326 %endif
327 %define TMPL_CMN_PP
328 %define TMPL_CMN_P32
329 %define TMPL_32BIT
330 %define TMPL_BITS 32
331 %define TMPL_PTR_DEF dd
332 %define TMPL_NM(Name) _ %+ Name %+ _pp32
333 %define BS3_CMN_NM(Name) _ %+ Name %+ _c32
334 %define TMPL_MODE_STR '32-bit paged protected mode'
335%endif
336
337%ifdef TMPL_PPV86
338 %ifdef TMPL_RM
339 %error "Both 'TMPL_PPV86' and 'TMPL_RM' are defined."
340 %endif
341 %ifdef TMPL_PE16
342 %error "Both 'TMPL_PPV86' and 'TMPL_PE16' are defined."
343 %endif
344 %ifdef TMPL_PE32
345 %error "Both 'TMPL_PPV86' and 'TMPL_PE32' are defined."
346 %endif
347 %ifdef TMPL_PEV86
348 %error "Both 'TMPL_PPV86' and 'TMPL_PEV86' are defined."
349 %endif
350 %ifdef TMPL_PP16
351 %error "Both 'TMPL_PPV86' and 'TMPL_PP16' are defined."
352 %endif
353 %ifdef TMPL_PP32
354 %error "Both 'TMPL_PPV86' and 'TMPL_PP32' are defined."
355 %endif
356 %ifdef TMPL_PAE16
357 %error "Both 'TMPL_PPV86' and 'TMPL_PAE16' are defined."
358 %endif
359 %ifdef TMPL_PAE32
360 %error "Both 'TMPL_PPV86' and 'TMPL_PAE32' are defined."
361 %endif
362 %ifdef TMPL_PAEV86
363 %error "Both 'TMPL_PPV86' and 'TMPL_PAEV86' are defined."
364 %endif
365 %ifdef TMPL_LM16
366 %error "Both 'TMPL_PPV86' and 'TMPL_LM16' are defined."
367 %endif
368 %ifdef TMPL_LM32
369 %error "Both 'TMPL_PPV86' and 'TMPL_LM32' are defined."
370 %endif
371 %ifdef TMPL_LM64
372 %error "Both 'TMPL_PPV86' and 'TMPL_LM64' are defined."
373 %endif
374 %define TMPL_CMN_PP
375 %define TMPL_CMN_V86
376 %define TMPL_CMN_R86
377 %define TMPL_16BIT
378 %define TMPL_BITS 16
379 %define TMPL_PTR_DEF dw
380 %define TMPL_NM(Name) Name %+ _ppv86
381 %define BS3_CMN_NM(Name) Name %+ _c86
382 %define TMPL_MODE_STR 'v8086 paged protected mode'
383%endif
384
385%ifdef TMPL_PAE16
386 %ifdef TMPL_RM
387 %error "Both 'TMPL_PAE16' and 'TMPL_RM' are defined."
388 %endif
389 %ifdef TMPL_PE16
390 %error "Both 'TMPL_PAE16' and 'TMPL_PE16' are defined."
391 %endif
392 %ifdef TMPL_PE32
393 %error "Both 'TMPL_PAE16' and 'TMPL_PE32' are defined."
394 %endif
395 %ifdef TMPL_PEV86
396 %error "Both 'TMPL_PAE16' and 'TMPL_PEV86' are defined."
397 %endif
398 %ifdef TMPL_PP16
399 %error "Both 'TMPL_PAE16' and 'TMPL_PP16' are defined."
400 %endif
401 %ifdef TMPL_PP32
402 %error "Both 'TMPL_PAE16' and 'TMPL_PP32' are defined."
403 %endif
404 %ifdef TMPL_PPV86
405 %error "Both 'TMPL_PAE16' and 'TMPL_PPV86' are defined."
406 %endif
407 %ifdef TMPL_PAE32
408 %error "Both 'TMPL_PAE16' and 'TMPL_PAE32' are defined."
409 %endif
410 %ifdef TMPL_LM16
411 %error "Both 'TMPL_PAE16' and 'TMPL_LM16' are defined."
412 %endif
413 %ifdef TMPL_PAEV86
414 %error "Both 'TMPL_PAE16' and 'TMPL_PAEV86' are defined."
415 %endif
416 %ifdef TMPL_LM32
417 %error "Both 'TMPL_PAE16' and 'TMPL_LM32' are defined."
418 %endif
419 %ifdef TMPL_LM64
420 %error "Both 'TMPL_PAE16' and 'TMPL_LM64' are defined."
421 %endif
422 %define TMPL_CMN_PAE
423 %define TMPL_16BIT
424 %define TMPL_CMN_P16
425 %define TMPL_BITS 16
426 %define TMPL_PTR_DEF dw
427 %define TMPL_NM(Name) _ %+ Name %+ _pae16
428 %define BS3_CMN_NM(Name) _ %+ Name %+ _c16
429 %define TMPL_MODE_STR '16-bit pae protected mode'
430%endif
431
432%ifdef TMPL_PAE32
433 %ifdef TMPL_RM
434 %error "Both 'TMPL_PAE32' and 'TMPL_RM' are defined."
435 %endif
436 %ifdef TMPL_PE16
437 %error "Both 'TMPL_PAE32' and 'TMPL_PE16' are defined."
438 %endif
439 %ifdef TMPL_PE32
440 %error "Both 'TMPL_PAE32' and 'TMPL_PE32' are defined."
441 %endif
442 %ifdef TMPL_PEV86
443 %error "Both 'TMPL_PAE32' and 'TMPL_PEV86' are defined."
444 %endif
445 %ifdef TMPL_PP16
446 %error "Both 'TMPL_PAE32' and 'TMPL_PP16' are defined."
447 %endif
448 %ifdef TMPL_PP32
449 %error "Both 'TMPL_PAE32' and 'TMPL_PP32' are defined."
450 %endif
451 %ifdef TMPL_PPV86
452 %error "Both 'TMPL_PAE32' and 'TMPL_PPV86' are defined."
453 %endif
454 %ifdef TMPL_PAE16
455 %error "Both 'TMPL_PAE32' and 'TMPL_PAE16' are defined."
456 %endif
457 %ifdef TMPL_PAEV86
458 %error "Both 'TMPL_PAE32' and 'TMPL_PAEV86' are defined."
459 %endif
460 %ifdef TMPL_LM16
461 %error "Both 'TMPL_PAE32' and 'TMPL_LM16' are defined."
462 %endif
463 %ifdef TMPL_LM32
464 %error "Both 'TMPL_PAE32' and 'TMPL_LM32' are defined."
465 %endif
466 %ifdef TMPL_LM64
467 %error "Both 'TMPL_PAE32' and 'TMPL_LM64' are defined."
468 %endif
469 %define TMPL_CMN_PAE
470 %define TMPL_CMN_P32
471 %define TMPL_32BIT
472 %define TMPL_BITS 32
473 %define TMPL_PTR_DEF dd
474 %define TMPL_NM(Name) _ %+ Name %+ _pae32
475 %define BS3_CMN_NM(Name) _ %+ Name %+ _c32
476 %define TMPL_MODE_STR '32-bit pae protected mode'
477%endif
478
479%ifdef TMPL_PAEV86
480 %ifdef TMPL_RM
481 %error "Both 'TMPL_PAEV86' and 'TMPL_RM' are defined."
482 %endif
483 %ifdef TMPL_PE16
484 %error "Both 'TMPL_PAEV86' and 'TMPL_PE16' are defined."
485 %endif
486 %ifdef TMPL_PE32
487 %error "Both 'TMPL_PAEV86' and 'TMPL_PE32' are defined."
488 %endif
489 %ifdef TMPL_PEV86
490 %error "Both 'TMPL_PAEV86' and 'TMPL_PEV86' are defined."
491 %endif
492 %ifdef TMPL_PP16
493 %error "Both 'TMPL_PAEV86' and 'TMPL_PP16' are defined."
494 %endif
495 %ifdef TMPL_PP32
496 %error "Both 'TMPL_PAEV86' and 'TMPL_PP32' are defined."
497 %endif
498 %ifdef TMPL_PPV86
499 %error "Both 'TMPL_PAEV86' and 'TMPL_PPV86' are defined."
500 %endif
501 %ifdef TMPL_PAE16
502 %error "Both 'TMPL_PAEV86' and 'TMPL_PAE16' are defined."
503 %endif
504 %ifdef TMPL_PAE32
505 %error "Both 'TMPL_PAEV86' and 'TMPL_PAE32' are defined."
506 %endif
507 %ifdef TMPL_LM16
508 %error "Both 'TMPL_PAEV86' and 'TMPL_LM16' are defined."
509 %endif
510 %ifdef TMPL_LM32
511 %error "Both 'TMPL_PAEV86' and 'TMPL_LM32' are defined."
512 %endif
513 %ifdef TMPL_LM64
514 %error "Both 'TMPL_PAEV86' and 'TMPL_LM64' are defined."
515 %endif
516 %define TMPL_CMN_PAE
517 %define TMPL_CMN_V86
518 %define TMPL_CMN_R86
519 %define TMPL_16BIT
520 %define TMPL_BITS 16
521 %define TMPL_PTR_DEF dw
522 %define TMPL_NM(Name) _ %+ Name %+ _paev86
523 %define BS3_CMN_NM(Name) _ %+ Name %+ _c86
524 %define TMPL_MODE_STR 'v8086 pae protected mode'
525%endif
526
527%ifdef TMPL_LM16
528 %ifdef TMPL_RM
529 %error "Both 'TMPL_LM16' and 'TMPL_RM' are defined."
530 %endif
531 %ifdef TMPL_PE16
532 %error "Both 'TMPL_LM16' and 'TMPL_PE16' are defined."
533 %endif
534 %ifdef TMPL_PE32
535 %error "Both 'TMPL_LM16' and 'TMPL_PE32' are defined."
536 %endif
537 %ifdef TMPL_PEV86
538 %error "Both 'TMPL_LM16' and 'TMPL_PEV86' are defined."
539 %endif
540 %ifdef TMPL_PP16
541 %error "Both 'TMPL_LM16' and 'TMPL_PP16' are defined."
542 %endif
543 %ifdef TMPL_PP32
544 %error "Both 'TMPL_LM16' and 'TMPL_PP32' are defined."
545 %endif
546 %ifdef TMPL_PPV86
547 %error "Both 'TMPL_LM16' and 'TMPL_PPV86' are defined."
548 %endif
549 %ifdef TMPL_PAE16
550 %error "Both 'TMPL_LM16' and 'TMPL_PAE16' are defined."
551 %endif
552 %ifdef TMPL_PAE32
553 %error "Both 'TMPL_LM16' and 'TMPL_PAE32' are defined."
554 %endif
555 %ifdef TMPL_PAEV86
556 %error "Both 'TMPL_LM16' and 'TMPL_PAEV86' are defined."
557 %endif
558 %ifdef TMPL_LM32
559 %error "Both 'TMPL_LM16' and 'TMPL_LM32' are defined."
560 %endif
561 %ifdef TMPL_LM64
562 %error "Both 'TMPL_LM16' and 'TMPL_LM64' are defined."
563 %endif
564 %define TMPL_CMN_LM
565 %define TMPL_CMN_P16
566 %define TMPL_16BIT
567 %define TMPL_BITS 16
568 %define TMPL_PTR_DEF dw
569 %define TMPL_NM(Name) _ %+ Name %+ _lm16
570 %define BS3_CMN_NM(Name) _ %+ Name %+ _c16
571 %define TMPL_MODE_STR '16-bit long mode'
572%endif
573
574%ifdef TMPL_LM32
575 %ifdef TMPL_RM
576 %error "Both 'TMPL_LM32' and 'TMPL_RM' are defined."
577 %endif
578 %ifdef TMPL_PE16
579 %error "Both 'TMPL_LM32' and 'TMPL_PE16' are defined."
580 %endif
581 %ifdef TMPL_PE32
582 %error "Both 'TMPL_LM32' and 'TMPL_PE32' are defined."
583 %endif
584 %ifdef TMPL_PEV86
585 %error "Both 'TMPL_LM32' and 'TMPL_PEV86' are defined."
586 %endif
587 %ifdef TMPL_PP16
588 %error "Both 'TMPL_LM32' and 'TMPL_PP16' are defined."
589 %endif
590 %ifdef TMPL_PP32
591 %error "Both 'TMPL_LM32' and 'TMPL_PP32' are defined."
592 %endif
593 %ifdef TMPL_PPV86
594 %error "Both 'TMPL_LM32' and 'TMPL_PPV86' are defined."
595 %endif
596 %ifdef TMPL_PAE16
597 %error "Both 'TMPL_LM32' and 'TMPL_PAE16' are defined."
598 %endif
599 %ifdef TMPL_PAE32
600 %error "Both 'TMPL_LM32' and 'TMPL_PAE32' are defined."
601 %endif
602 %ifdef TMPL_PAEV86
603 %error "Both 'TMPL_LM32' and 'TMPL_PAEV86' are defined."
604 %endif
605 %ifdef TMPL_LM16
606 %error "Both 'TMPL_LM32' and 'TMPL_LM16' are defined."
607 %endif
608 %ifdef TMPL_LM64
609 %error "Both 'TMPL_LM32' and 'TMPL_LM64' are defined."
610 %endif
611 %define TMPL_CMN_LM
612 %define TMPL_CMN_P32
613 %define TMPL_32BIT
614 %define TMPL_BITS 32
615 %define TMPL_PTR_DEF dd
616 %define TMPL_NM(Name) _ %+ Name %+ _lm32
617 %define BS3_CMN_NM(Name) _ %+ Name %+ _c32
618 %define TMPL_MODE_STR '32-bit long mode'
619%endif
620
621%ifdef TMPL_LM64
622 %ifdef TMPL_RM
623 %error ""Both 'TMPL_LM64' and 'TMPL_RM' are defined.""
624 %endif
625 %ifdef TMPL_PE16
626 %error "Both 'TMPL_LM64' and 'TMPL_PE16' are defined."
627 %endif
628 %ifdef TMPL_PE32
629 %error "Both 'TMPL_LM64' and 'TMPL_PE32' are defined."
630 %endif
631 %ifdef TMPL_PEV86
632 %error "Both 'TMPL_LM64' and 'TMPL_PEV86' are defined."
633 %endif
634 %ifdef TMPL_PP16
635 %error "Both 'TMPL_LM64' and 'TMPL_PP16' are defined."
636 %endif
637 %ifdef TMPL_PP32
638 %error "Both 'TMPL_LM64' and 'TMPL_PP32' are defined."
639 %endif
640 %ifdef TMPL_PPV86
641 %error "Both 'TMPL_LM64' and 'TMPL_PPV86' are defined."
642 %endif
643 %ifdef TMPL_PAE16
644 %error "Both 'TMPL_LM64' and 'TMPL_PAE16' are defined."
645 %endif
646 %ifdef TMPL_PAE32
647 %error "Both 'TMPL_LM64' and 'TMPL_PAE32' are defined."
648 %endif
649 %ifdef TMPL_PAEV86
650 %error "Both 'TMPL_LM64' and 'TMPL_PAEV86' are defined."
651 %endif
652 %ifdef TMPL_LM16
653 %error "Both 'TMPL_LM64' and 'TMPL_LM16' are defined."
654 %endif
655 %ifdef TMPL_LM32
656 %error "Both 'TMPL_LM64' and 'TMPL_LM32' are defined."
657 %endif
658 %define TMPL_CMN_LM
659 %define TMPL_CMN_P64
660 %define TMPL_64BIT
661 %define TMPL_BITS 64
662 %define TMPL_PTR_DEF dq
663 %define TMPL_NM(Name) Name %+ _lm64 ; No underscore (C/C++ compatibility).
664 %define BS3_CMN_NM(Name) Name %+ _c64 ; No underscore (C/C++ compatibility).
665 %define TMPL_MODE_STR '64-bit long mode'
666%endif
667
668%ifndef TMPL_MODE_STR
669 %error "internal error"
670%endif
671
672
673;
674; Register aliases.
675;
676%ifdef TMPL_64BIT
677 %define xCB 8
678 %define xDEF dq
679 %define xRES resq
680 %define xPRE qword
681 %define xSP rsp
682 %define xBP rbp
683 %define xAX rax
684 %define xBX rbx
685 %define xCX rcx
686 %define xDX rdx
687 %define xDI rdi
688 %define xSI rsi
689 %define xWrtRIP wrt rip
690 %define xPUSHF pushfq
691 %define xPOPF popfq
692 %define xRETF o64 retf
693%else
694 %ifdef TMPL_32BIT
695 %define xCB 4
696 %define xDEF dd
697 %define xRES resd
698 %define xPRE dword
699 %define xSP esp
700 %define xBP ebp
701 %define xAX eax
702 %define xBX ebx
703 %define xCX ecx
704 %define xDX edx
705 %define xDI edi
706 %define xSI esi
707 %define xWrtRIP
708 %define xPUSHF pushfd
709 %define xPOPF popfd
710 %define xRETF retf
711 %else
712 %ifndef TMPL_16BIT
713 %error "TMPL_XXBIT is not defined."
714 %endif
715 %define xCB 2
716 %define xDEF dw
717 %define xRES resw
718 %define xPRE word
719 %define xSP sp
720 %define xBP bp
721 %define xAX ax
722 %define xBX bx
723 %define xCX cx
724 %define xDX dx
725 %define xDI di
726 %define xSI si
727 %define xWrtRIP
728 %define xPUSHF pushf
729 %define xPOPF popf
730 %define xRETF retf
731 %endif
732%endif
733
734
735;
736; Register names corresponding to the max size for pop/push <reg>.
737;
738; 16-bit can push both 32-bit and 16-bit registers. This 's' prefixed variant
739; is used when 16-bit should use the 32-bit register.
740;
741%ifdef TMPL_64BIT
742 %define sCB 8
743 %define sDEF dq
744 %define sRES resq
745 %define sPRE qword
746 %define sSP rsp
747 %define sBP rbp
748 %define sAX rax
749 %define sBX rbx
750 %define sCX rcx
751 %define sDX rdx
752 %define sDI rdi
753 %define sSI rsi
754 %define sPUSHF pushfq
755 %define sPOPF popfq
756%else
757 %define sCB 4
758 %define sDEF dd
759 %define sRES resd
760 %define sPRE dword
761 %define sSP esp
762 %define sBP ebp
763 %define sAX eax
764 %define sBX ebx
765 %define sCX ecx
766 %define sDX edx
767 %define sDI edi
768 %define sSI esi
769 %define sPUSHF pushfd
770 %define sPOPF popfd
771%endif
772
773;; @def TMPL_WRT_FLAT
774; WRT flat when not in 16-bit modes.
775;
776%ifdef TMPL_16BIT
777 %define TMPL_WRT_FLAT
778%else
779 %define TMPL_WRT_FLAT wrt FLAT
780%endif
781
782;; @def TMPL_WRT_DATA16_OR_FLAT
783; WRT DATA16 in 16-bit mode, WRT FLAT in 32- and 64-bit modes.
784; This is important when accessing global variables.
785;
786%ifdef TMPL_16BIT
787 %define TMPL_WRT_DATA16_OR_FLAT wrt BS3DATA16
788%else
789 %define TMPL_WRT_DATA16_OR_FLAT wrt FLAT
790%endif
791
792;
793; Default code segment (changes BITS too).
794;
795%ifdef TMPL_64BIT
796 %define TMPL_BEGIN_TEXT BS3_BEGIN_TEXT64
797%elifdef TMPL_32BIT
798 %define TMPL_BEGIN_TEXT BS3_BEGIN_TEXT32
799%elifdef TMPL_16BIT
800 %define TMPL_BEGIN_TEXT BS3_BEGIN_TEXT16
801%else
802 %error "Missing TMPL_xxBIT!"
803%endif
804TMPL_BEGIN_TEXT
805
806
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