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