VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bootsector2-template-header.mac@ 97613

Last change on this file since 97613 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

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