1 | /* $Id: bs3kit-template-header.h 58628 2015-11-10 01:25:13Z 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 | /** @defgroup grp_bs3kit_tmpl BS3Kit Multi-Mode Code Templates
|
---|
30 | * @ingroup grp_bs3kit
|
---|
31 | *
|
---|
32 | * Multi-mode code templates avoid duplicating code for each of the CPU modes.
|
---|
33 | * Instead the code is compiled multiple times, either via multiple inclusions
|
---|
34 | * into a source files with different mode selectors defined or by multiple
|
---|
35 | * compiler invocations.
|
---|
36 | *
|
---|
37 | * In C/C++ code we're restricted to the compiler target bit count, whereas in
|
---|
38 | * assembly we can do everything in assembler run (with some 64-bit
|
---|
39 | * restrictions, that is).
|
---|
40 | *
|
---|
41 | * Before \#defining the next mode selector and including
|
---|
42 | * bs3kit-template-header.h again, include bs3kit-template-footer.h to undefine
|
---|
43 | * all the previous mode selectors and the macros defined by the header.
|
---|
44 | *
|
---|
45 | * @{
|
---|
46 | */
|
---|
47 |
|
---|
48 | #ifdef DOXYGEN_RUNNING
|
---|
49 | /** @name Template mode selectors.
|
---|
50 | *
|
---|
51 | * Exactly one of these are defined by the file including the
|
---|
52 | * bs3kit-template-header.h header file. When building the code libraries, the
|
---|
53 | * kBuild target defines this.
|
---|
54 | *
|
---|
55 | * @{ */
|
---|
56 | # define TMPL_RM /**< real mode. */
|
---|
57 | # define TMPL_PE16 /**< 16-bit protected mode, unpaged. */
|
---|
58 | # define TMPL_PE32 /**< 32-bit protected mode, unpaged. */
|
---|
59 | # define TMPL_PEV86 /**< virtual 8086 mode under protected mode, unpaged. */
|
---|
60 | # define TMPL_PP16 /**< 16-bit protected mode, paged. */
|
---|
61 | # define TMPL_PP32 /**< 32-bit protected mode, paged. */
|
---|
62 | # define TMPL_PPV86 /**< virtual 8086 mode under protected mode, paged. */
|
---|
63 | # define TMPL_PAE16 /**< 16-bit protected mode with PAE (paged). */
|
---|
64 | # define TMPL_PAE32 /**< 16-bit protected mode with PAE (paged). */
|
---|
65 | # define TMPL_PAEV86 /**< virtual 8086 mode under protected mode with PAE (paged). */
|
---|
66 | # define TMPL_LM16 /**< 16-bit long mode (paged). */
|
---|
67 | # define TMPL_LM32 /**< 32-bit long mode (paged). */
|
---|
68 | # define TMPL_LM64 /**< 64-bit long mode (paged). */
|
---|
69 | /** @} */
|
---|
70 |
|
---|
71 | /** @name Derived Indicators
|
---|
72 | * @{ */
|
---|
73 | # define TMPL_CMN_PE /**< TMPL_PE16 | TMPL_PE32 | TMPL_PEV86 */
|
---|
74 | # define TMPL_CMN_PP /**< TMPL_PP16 | TMPL_PP32 | TMPL_PPV86 */
|
---|
75 | # define TMPL_CMN_PAE /**< TMPL_PAE16 | TMPL_PAE32 | TMPL_PAEV86 */
|
---|
76 | # define TMPL_CMN_LM /**< TMPL_LM16 | TMPL_LM32 | TMPL_LM64 */
|
---|
77 | # define TMPL_CMN_V86 /**< TMPL_PEV86 | TMPL_PPV86 | TMPL_PAEV86 */
|
---|
78 | # define TMPL_CMN_R86 /**< TMPL_CMN_V86 | TMPL_RM */
|
---|
79 | /** @} */
|
---|
80 |
|
---|
81 | /** @def TMPL_NM
|
---|
82 | * Name mangling macro for the current mode.
|
---|
83 | *
|
---|
84 | * Example: TMPL_NM(PrintChr)
|
---|
85 | *
|
---|
86 | * @param Name The function or variable name to mangle.
|
---|
87 | */
|
---|
88 | # define TMPL_NM(Name) RT_CONCAT(Name,_mode)
|
---|
89 |
|
---|
90 | /** @def TMPL_MODE_STR
|
---|
91 | * Short mode description. */
|
---|
92 | # define TMPL_MODE_STR
|
---|
93 |
|
---|
94 | /** @def TMPL_HAVE_BIOS
|
---|
95 | * Indicates that we have direct access to the BIOS (only in real mode). */
|
---|
96 | # define TMPL_HAVE_BIOS
|
---|
97 |
|
---|
98 |
|
---|
99 | /** @name For ASM compatability
|
---|
100 | * @{ */
|
---|
101 | /** @def TMPL_16BIT
|
---|
102 | * For ASM compatibility - please use ARCH_BITS == 16. */
|
---|
103 | # define TMPL_16BIT
|
---|
104 | /** @def TMPL_32BIT
|
---|
105 | * For ASM compatibility - please use ARCH_BITS == 32. */
|
---|
106 | # define TMPL_32BIT
|
---|
107 | /** @def TMPL_64BIT
|
---|
108 | * For ASM compatibility - please use ARCH_BITS == 64. */
|
---|
109 | # define TMPL_64BIT
|
---|
110 |
|
---|
111 | /** @def TMPL_BITS
|
---|
112 | * For ASM compatibility - please use ARCH_BITS instead. */
|
---|
113 | # define TMPL_BITS ARCH_BITS
|
---|
114 | /** @} */
|
---|
115 |
|
---|
116 | #else /* !DOXYGEN_RUNNING */
|
---|
117 |
|
---|
118 | #ifdef TMPL_RM
|
---|
119 | # ifdef TMPL_PE16
|
---|
120 | # error "Both 'TMPL_RM' and 'TMPL_PE16' are defined."
|
---|
121 | # endif
|
---|
122 | # ifdef TMPL_PE32
|
---|
123 | # error "Both 'TMPL_RM' and 'TMPL_PE32' are defined."
|
---|
124 | # endif
|
---|
125 | # ifdef TMPL_PEV86
|
---|
126 | # error "Both 'TMPL_RM' and 'TMPL_PEV86' are defined."
|
---|
127 | # endif
|
---|
128 | # ifdef TMPL_PP16
|
---|
129 | # error "Both 'TMPL_RM' and 'TMPL_PP16' are defined."
|
---|
130 | # endif
|
---|
131 | # ifdef TMPL_PP32
|
---|
132 | # error "Both 'TMPL_RM' and 'TMPL_PP32' are defined."
|
---|
133 | # endif
|
---|
134 | # ifdef TMPL_PPV86
|
---|
135 | # error "Both 'TMPL_RM' and 'TMPL_PPV86' are defined."
|
---|
136 | # endif
|
---|
137 | # ifdef TMPL_PAE16
|
---|
138 | # error "Both 'TMPL_RM' and 'TMPL_PAE16' are defined."
|
---|
139 | # endif
|
---|
140 | # ifdef TMPL_PAE32
|
---|
141 | # error "Both 'TMPL_RM' and 'TMPL_PAE32' are defined."
|
---|
142 | # endif
|
---|
143 | # ifdef TMPL_PAEV86
|
---|
144 | # error "Both 'TMPL_RM' and 'TMPL_PAEV86' are defined."
|
---|
145 | # endif
|
---|
146 | # ifdef TMPL_LM16
|
---|
147 | # error "Both 'TMPL_RM' and 'TMPL_LM16' are defined."
|
---|
148 | # endif
|
---|
149 | # ifdef TMPL_LM32
|
---|
150 | # error "Both 'TMPL_RM' and 'TMPL_LM32' are defined."
|
---|
151 | # endif
|
---|
152 | # ifdef TMPL_LM64
|
---|
153 | # error "Both 'TMPL_RM' and 'TMPL_LM64' are defined."
|
---|
154 | # endif
|
---|
155 | # if ARCH_BITS != 16
|
---|
156 | # error "TMPL_RM requires ARCH_BITS to be 16."
|
---|
157 | # endif
|
---|
158 | # define TMPL_16BIT
|
---|
159 | # define TMPL_BITS 16
|
---|
160 | # define TMPL_NM(Name) RT_CONCAT(Name,_rm)
|
---|
161 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
|
---|
162 | # define TMPL_MODE_STR "real mode"
|
---|
163 | # define TMPL_HAVE_BIOS
|
---|
164 | # define TMPL_CMN_R86
|
---|
165 | #endif
|
---|
166 |
|
---|
167 | #ifdef TMPL_PE16
|
---|
168 | # ifdef TMPL_RM
|
---|
169 | # error "Both 'TMPL_PE16' and 'TMPL_RM' are defined."
|
---|
170 | # endif
|
---|
171 | # ifdef TMPL_PE32
|
---|
172 | # error "Both 'TMPL_PE16' and 'TMPL_PE32' are defined."
|
---|
173 | # endif
|
---|
174 | # ifdef TMPL_PEV86
|
---|
175 | # error "Both 'TMPL_RM' and 'TMPL_PEV86' are defined."
|
---|
176 | # endif
|
---|
177 | # ifdef TMPL_PP16
|
---|
178 | # error "Both 'TMPL_PE16' and 'TMPL_PP16' are defined."
|
---|
179 | # endif
|
---|
180 | # ifdef TMPL_PP32
|
---|
181 | # error "Both 'TMPL_PE16' and 'TMPL_PP32' are defined."
|
---|
182 | # endif
|
---|
183 | # ifdef TMPL_PPV86
|
---|
184 | # error "Both 'TMPL_PE16' and 'TMPL_PPV86' are defined."
|
---|
185 | # endif
|
---|
186 | # ifdef TMPL_PAE16
|
---|
187 | # error "Both 'TMPL_PE16' and 'TMPL_PAE16' are defined."
|
---|
188 | # endif
|
---|
189 | # ifdef TMPL_PAE32
|
---|
190 | # error "Both 'TMPL_PE16' and 'TMPL_PAE32' are defined."
|
---|
191 | # endif
|
---|
192 | # ifdef TMPL_PAEV86
|
---|
193 | # error "Both 'TMPL_PE32' and 'TMPL_PAEV86' are defined."
|
---|
194 | # endif
|
---|
195 | # ifdef TMPL_LM16
|
---|
196 | # error "Both 'TMPL_PE16' and 'TMPL_LM16' are defined."
|
---|
197 | # endif
|
---|
198 | # ifdef TMPL_LM32
|
---|
199 | # error "Both 'TMPL_PE16' and 'TMPL_LM32' are defined."
|
---|
200 | # endif
|
---|
201 | # ifdef TMPL_LM64
|
---|
202 | # error "Both 'TMPL_PE16' and 'TMPL_LM64' are defined."
|
---|
203 | # endif
|
---|
204 | # if ARCH_BITS != 16
|
---|
205 | # error "TMPL_PE16 requires ARCH_BITS to be 16."
|
---|
206 | # endif
|
---|
207 | # define TMPL_CMN_PE
|
---|
208 | # define TMPL_CMN_P16
|
---|
209 | # define TMPL_16BIT
|
---|
210 | # define TMPL_BITS 16
|
---|
211 | # define TMPL_NM(Name) RT_CONCAT(Name,_pe16)
|
---|
212 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
|
---|
213 | # define TMPL_MODE_STR "16-bit unpaged protected mode"
|
---|
214 | #endif
|
---|
215 |
|
---|
216 | #ifdef TMPL_PE32
|
---|
217 | # ifdef TMPL_RM
|
---|
218 | # error "Both 'TMPL_PE32' and 'TMPL_RM' are defined."
|
---|
219 | # endif
|
---|
220 | # ifdef TMPL_PE16
|
---|
221 | # error "Both 'TMPL_PE32' and 'TMPL_PE16' are defined."
|
---|
222 | # endif
|
---|
223 | # ifdef TMPL_PEV86
|
---|
224 | # error "Both 'TMPL_PE32' and 'TMPL_PEV86' are defined."
|
---|
225 | # endif
|
---|
226 | # ifdef TMPL_PP16
|
---|
227 | # error "Both 'TMPL_PE32' and 'TMPL_PP16' are defined."
|
---|
228 | # endif
|
---|
229 | # ifdef TMPL_PP32
|
---|
230 | # error "Both 'TMPL_PE32' and 'TMPL_PP32' are defined."
|
---|
231 | # endif
|
---|
232 | # ifdef TMPL_PPV86
|
---|
233 | # error "Both 'TMPL_PE32' and 'TMPL_PPV86' are defined."
|
---|
234 | # endif
|
---|
235 | # ifdef TMPL_PAE16
|
---|
236 | # error "Both 'TMPL_PE32' and 'TMPL_PAE16' are defined."
|
---|
237 | # endif
|
---|
238 | # ifdef TMPL_PAE32
|
---|
239 | # error "Both 'TMPL_PE32' and 'TMPL_PAE32' are defined."
|
---|
240 | # endif
|
---|
241 | # ifdef TMPL_PAE86
|
---|
242 | # error "Both 'TMPL_PE32' and 'TMPL_PPV86' are defined."
|
---|
243 | # endif
|
---|
244 | # ifdef TMPL_LM16
|
---|
245 | # error "Both 'TMPL_PE32' and 'TMPL_LM16' are defined."
|
---|
246 | # endif
|
---|
247 | # ifdef TMPL_LM32
|
---|
248 | # error "Both 'TMPL_PE32' and 'TMPL_LM32' are defined."
|
---|
249 | # endif
|
---|
250 | # ifdef TMPL_LM64
|
---|
251 | # error "Both 'TMPL_PE32' and 'TMPL_LM64' are defined."
|
---|
252 | # endif
|
---|
253 | # if ARCH_BITS != 32
|
---|
254 | # error "TMPL_PE32 requires ARCH_BITS to be 32."
|
---|
255 | # endif
|
---|
256 | # define TMPL_CMN_PE
|
---|
257 | # define TMPL_CMN_P32
|
---|
258 | # define TMPL_32BIT
|
---|
259 | # define TMPL_BITS 32
|
---|
260 | # define TMPL_NM(Name) RT_CONCAT(Name,_pe32)
|
---|
261 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c32)
|
---|
262 | # define TMPL_MODE_STR "32-bit unpaged protected mode"
|
---|
263 | #endif
|
---|
264 |
|
---|
265 | #ifdef TMPL_PEV86
|
---|
266 | # ifdef TMPL_RM
|
---|
267 | # error "Both 'TMPL_PEV86' and 'TMPL_RM' are defined."
|
---|
268 | # endif
|
---|
269 | # ifdef TMPL_PE16
|
---|
270 | # error "Both 'TMPL_PEV86' and 'TMPL_PE16' are defined."
|
---|
271 | # endif
|
---|
272 | # ifdef TMPL_PP32
|
---|
273 | # error "Both 'TMPL_PEV86' and 'TMPL_PP32' are defined."
|
---|
274 | # endif
|
---|
275 | # ifdef TMPL_PP16
|
---|
276 | # error "Both 'TMPL_PEV86' and 'TMPL_PP16' are defined."
|
---|
277 | # endif
|
---|
278 | # ifdef TMPL_PP32
|
---|
279 | # error "Both 'TMPL_PEV86' and 'TMPL_PP32' are defined."
|
---|
280 | # endif
|
---|
281 | # ifdef TMPL_PPV86
|
---|
282 | # error "Both 'TMPL_PEV86' and 'TMPL_PPV86' are defined."
|
---|
283 | # endif
|
---|
284 | # ifdef TMPL_PAE16
|
---|
285 | # error "Both 'TMPL_PEV86' and 'TMPL_PAE16' are defined."
|
---|
286 | # endif
|
---|
287 | # ifdef TMPL_PAE32
|
---|
288 | # error "Both 'TMPL_PEV86' and 'TMPL_PAE32' are defined."
|
---|
289 | # endif
|
---|
290 | # ifdef TMPL_PAE86
|
---|
291 | # error "Both 'TMPL_PEV86' and 'TMPL_PPV86' are defined."
|
---|
292 | # endif
|
---|
293 | # ifdef TMPL_LM16
|
---|
294 | # error "Both 'TMPL_PEV86' and 'TMPL_LM16' are defined."
|
---|
295 | # endif
|
---|
296 | # ifdef TMPL_LM32
|
---|
297 | # error "Both 'TMPL_PEV86' and 'TMPL_LM32' are defined."
|
---|
298 | # endif
|
---|
299 | # ifdef TMPL_LM64
|
---|
300 | # error "Both 'TMPL_PEV86' and 'TMPL_LM64' are defined."
|
---|
301 | # endif
|
---|
302 | # if ARCH_BITS != 16
|
---|
303 | # error "TMPL_PEV86 requires ARCH_BITS to be 16."
|
---|
304 | # endif
|
---|
305 | # define TMPL_CMN_PE
|
---|
306 | # define TMPL_CMN_V86
|
---|
307 | # define TMPL_CMN_R86
|
---|
308 | # define TMPL_16BIT
|
---|
309 | # define TMPL_BITS 16
|
---|
310 | # define TMPL_NM(Name) RT_CONCAT(Name,_pev86)
|
---|
311 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
|
---|
312 | # define TMPL_MODE_STR "v8086 unpaged protected mode"
|
---|
313 | #endif
|
---|
314 |
|
---|
315 | #ifdef TMPL_PP16
|
---|
316 | # ifdef TMPL_RM
|
---|
317 | # error "Both 'TMPL_PP16' and 'TMPL_RM' are defined."
|
---|
318 | # endif
|
---|
319 | # ifdef TMPL_PE16
|
---|
320 | # error "Both 'TMPL_PP16' and 'TMPL_PE16' are defined."
|
---|
321 | # endif
|
---|
322 | # ifdef TMPL_PE32
|
---|
323 | # error "Both 'TMPL_PP16' and 'TMPL_PE32' are defined."
|
---|
324 | # endif
|
---|
325 | # ifdef TMPL_PEV86
|
---|
326 | # error "Both 'TMPL_PP16' and 'TMPL_PEV86' are defined."
|
---|
327 | # endif
|
---|
328 | # ifdef TMPL_PP32
|
---|
329 | # error "Both 'TMPL_PP16' and 'TMPL_PP32' are defined."
|
---|
330 | # endif
|
---|
331 | # ifdef TMPL_PPV86
|
---|
332 | # error "Both 'TMPL_PP32' and 'TMPL_PPV86' are defined."
|
---|
333 | # endif
|
---|
334 | # ifdef TMPL_PAE16
|
---|
335 | # error "Both 'TMPL_PP16' and 'TMPL_PAE16' are defined."
|
---|
336 | # endif
|
---|
337 | # ifdef TMPL_PAE32
|
---|
338 | # error "Both 'TMPL_PP16' and 'TMPL_PAE32' are defined."
|
---|
339 | # endif
|
---|
340 | # ifdef TMPL_PAEV86
|
---|
341 | # error "Both 'TMPL_PP16' and 'TMPL_PAEV86' are defined."
|
---|
342 | # endif
|
---|
343 | # ifdef TMPL_LM16
|
---|
344 | # error "Both 'TMPL_PP16' and 'TMPL_LM16' are defined."
|
---|
345 | # endif
|
---|
346 | # ifdef TMPL_LM32
|
---|
347 | # error "Both 'TMPL_PP16' and 'TMPL_LM32' are defined."
|
---|
348 | # endif
|
---|
349 | # ifdef TMPL_LM64
|
---|
350 | # error "Both 'TMPL_PP16' and 'TMPL_LM64' are defined."
|
---|
351 | # endif
|
---|
352 | # if ARCH_BITS != 16
|
---|
353 | # error "TMPL_PP16 requires ARCH_BITS to be 16."
|
---|
354 | # endif
|
---|
355 | # define TMPL_CMN_PP
|
---|
356 | # define TMPL_CMN_P16
|
---|
357 | # define TMPL_16BIT
|
---|
358 | # define TMPL_BITS 16
|
---|
359 | # define TMPL_NM(Name) RT_CONCAT(Name,_pp16)
|
---|
360 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
|
---|
361 | # define TMPL_MODE_STR "16-bit paged protected mode"
|
---|
362 | #endif
|
---|
363 |
|
---|
364 | #ifdef TMPL_PP32
|
---|
365 | # ifdef TMPL_RM
|
---|
366 | # error "Both 'TMPL_PP32' and 'TMPL_RM' are defined."
|
---|
367 | # endif
|
---|
368 | # ifdef TMPL_PE16
|
---|
369 | # error "Both 'TMPL_PP32' and 'TMPL_PE16' are defined."
|
---|
370 | # endif
|
---|
371 | # ifdef TMPL_PE32
|
---|
372 | # error "Both 'TMPL_PP32' and 'TMPL_PE32' are defined."
|
---|
373 | # endif
|
---|
374 | # ifdef TMPL_PEV86
|
---|
375 | # error "Both 'TMPL_PP32' and 'TMPL_PEV86' are defined."
|
---|
376 | # endif
|
---|
377 | # ifdef TMPL_PP16
|
---|
378 | # error "Both 'TMPL_PP32' and 'TMPL_PP16' are defined."
|
---|
379 | # endif
|
---|
380 | # ifdef TMPL_PPV86
|
---|
381 | # error "Both 'TMPL_PP32' and 'TMPL_PPV86' are defined."
|
---|
382 | # endif
|
---|
383 | # ifdef TMPL_PAE16
|
---|
384 | # error "Both 'TMPL_PP32' and 'TMPL_PAE16' are defined."
|
---|
385 | # endif
|
---|
386 | # ifdef TMPL_PAE32
|
---|
387 | # error "Both 'TMPL_PP32' and 'TMPL_PAE32' are defined."
|
---|
388 | # endif
|
---|
389 | # ifdef TMPL_PAEV86
|
---|
390 | # error "Both 'TMPL_PP32' and 'TMPL_PAEV86' are defined."
|
---|
391 | # endif
|
---|
392 | # ifdef TMPL_LM16
|
---|
393 | # error "Both 'TMPL_PP32' and 'TMPL_LM16' are defined."
|
---|
394 | # endif
|
---|
395 | # ifdef TMPL_LM32
|
---|
396 | # error "Both 'TMPL_PP32' and 'TMPL_LM32' are defined."
|
---|
397 | # endif
|
---|
398 | # ifdef TMPL_LM64
|
---|
399 | # error "Both 'TMPL_PP32' and 'TMPL_LM64' are defined."
|
---|
400 | # endif
|
---|
401 | # if ARCH_BITS != 32
|
---|
402 | # error "TMPL_PP32 requires ARCH_BITS to be 32."
|
---|
403 | # endif
|
---|
404 | # define TMPL_CMN_PP
|
---|
405 | # define TMPL_CMN_P32
|
---|
406 | # define TMPL_32BIT
|
---|
407 | # define TMPL_BITS 32
|
---|
408 | # define TMPL_NM(Name) RT_CONCAT(Name,_pp32)
|
---|
409 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c32)
|
---|
410 | # define TMPL_MODE_STR "32-bit paged protected mode"
|
---|
411 | #endif
|
---|
412 |
|
---|
413 | #ifdef TMPL_PPV86
|
---|
414 | # ifdef TMPL_RM
|
---|
415 | # error "Both 'TMPL_PPV86' and 'TMPL_RM' are defined."
|
---|
416 | # endif
|
---|
417 | # ifdef TMPL_PE16
|
---|
418 | # error "Both 'TMPL_PPV86' and 'TMPL_PE16' are defined."
|
---|
419 | # endif
|
---|
420 | # ifdef TMPL_PE32
|
---|
421 | # error "Both 'TMPL_PPV86' and 'TMPL_PE32' are defined."
|
---|
422 | # endif
|
---|
423 | # ifdef TMPL_PEV86
|
---|
424 | # error "Both 'TMPL_PPV86' and 'TMPL_PEV86' are defined."
|
---|
425 | # endif
|
---|
426 | # ifdef TMPL_PP16
|
---|
427 | # error "Both 'TMPL_PPV86' and 'TMPL_PP16' are defined."
|
---|
428 | # endif
|
---|
429 | # ifdef TMPL_PP32
|
---|
430 | # error "Both 'TMPL_PPV86' and 'TMPL_PP32' are defined."
|
---|
431 | # endif
|
---|
432 | # ifdef TMPL_PAE16
|
---|
433 | # error "Both 'TMPL_PPV86' and 'TMPL_PAE16' are defined."
|
---|
434 | # endif
|
---|
435 | # ifdef TMPL_PAE32
|
---|
436 | # error "Both 'TMPL_PPV86' and 'TMPL_PAE32' are defined."
|
---|
437 | # endif
|
---|
438 | # ifdef TMPL_PAEV86
|
---|
439 | # error "Both 'TMPL_PPV86' and 'TMPL_PAEV86' are defined."
|
---|
440 | # endif
|
---|
441 | # ifdef TMPL_LM16
|
---|
442 | # error "Both 'TMPL_PPV86' and 'TMPL_LM16' are defined."
|
---|
443 | # endif
|
---|
444 | # ifdef TMPL_LM32
|
---|
445 | # error "Both 'TMPL_PPV86' and 'TMPL_LM32' are defined."
|
---|
446 | # endif
|
---|
447 | # ifdef TMPL_LM64
|
---|
448 | # error "Both 'TMPL_PPV86' and 'TMPL_LM64' are defined."
|
---|
449 | # endif
|
---|
450 | # if ARCH_BITS != 16
|
---|
451 | # error "TMPL_PPV86 requires ARCH_BITS to be 16."
|
---|
452 | # endif
|
---|
453 | # define TMPL_CMN_PP
|
---|
454 | # define TMPL_CMN_V86
|
---|
455 | # define TMPL_CMN_R86
|
---|
456 | # define TMPL_16BIT
|
---|
457 | # define TMPL_BITS 16
|
---|
458 | # define TMPL_NM(Name) RT_CONCAT(Name,_ppv86)
|
---|
459 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c86)
|
---|
460 | # define TMPL_MODE_STR "v8086 paged protected mode"
|
---|
461 | #endif
|
---|
462 |
|
---|
463 | #ifdef TMPL_PAE16
|
---|
464 | # ifdef TMPL_RM
|
---|
465 | # error "Both 'TMPL_PAE16' and 'TMPL_RM' are defined."
|
---|
466 | # endif
|
---|
467 | # ifdef TMPL_PE16
|
---|
468 | # error "Both 'TMPL_PAE16' and 'TMPL_PE16' are defined."
|
---|
469 | # endif
|
---|
470 | # ifdef TMPL_PE32
|
---|
471 | # error "Both 'TMPL_PAE16' and 'TMPL_PE32' are defined."
|
---|
472 | # endif
|
---|
473 | # ifdef TMPL_PEV86
|
---|
474 | # error "Both 'TMPL_PAE16' and 'TMPL_PEV86' are defined."
|
---|
475 | # endif
|
---|
476 | # ifdef TMPL_PP16
|
---|
477 | # error "Both 'TMPL_PAE16' and 'TMPL_PP16' are defined."
|
---|
478 | # endif
|
---|
479 | # ifdef TMPL_PP32
|
---|
480 | # error "Both 'TMPL_PAE16' and 'TMPL_PP32' are defined."
|
---|
481 | # endif
|
---|
482 | # ifdef TMPL_PPV86
|
---|
483 | # error "Both 'TMPL_PAE16' and 'TMPL_PPV86' are defined."
|
---|
484 | # endif
|
---|
485 | # ifdef TMPL_PAE32
|
---|
486 | # error "Both 'TMPL_PAE16' and 'TMPL_PAE32' are defined."
|
---|
487 | # endif
|
---|
488 | # ifdef TMPL_LM16
|
---|
489 | # error "Both 'TMPL_PAE16' and 'TMPL_LM16' are defined."
|
---|
490 | # endif
|
---|
491 | # ifdef TMPL_PAEV86
|
---|
492 | # error "Both 'TMPL_PAE16' and 'TMPL_PAEV86' are defined."
|
---|
493 | # endif
|
---|
494 | # ifdef TMPL_LM32
|
---|
495 | # error "Both 'TMPL_PAE16' and 'TMPL_LM32' are defined."
|
---|
496 | # endif
|
---|
497 | # ifdef TMPL_LM64
|
---|
498 | # error "Both 'TMPL_PAE16' and 'TMPL_LM64' are defined."
|
---|
499 | # endif
|
---|
500 | # if ARCH_BITS != 16
|
---|
501 | # error "TMPL_PAE16 requires ARCH_BITS to be 16."
|
---|
502 | # endif
|
---|
503 | # define TMPL_CMN_PAE
|
---|
504 | # define TMPL_16BIT
|
---|
505 | # define TMPL_CMN_P16
|
---|
506 | # define TMPL_BITS 16
|
---|
507 | # define TMPL_NM(Name) RT_CONCAT(Name,_pae16)
|
---|
508 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
|
---|
509 | # define TMPL_MODE_STR "16-bit pae protected mode"
|
---|
510 | #endif
|
---|
511 |
|
---|
512 | #ifdef TMPL_PAE32
|
---|
513 | # ifdef TMPL_RM
|
---|
514 | # error "Both 'TMPL_PAE32' and 'TMPL_RM' are defined."
|
---|
515 | # endif
|
---|
516 | # ifdef TMPL_PE16
|
---|
517 | # error "Both 'TMPL_PAE32' and 'TMPL_PE16' are defined."
|
---|
518 | # endif
|
---|
519 | # ifdef TMPL_PE32
|
---|
520 | # error "Both 'TMPL_PAE32' and 'TMPL_PE32' are defined."
|
---|
521 | # endif
|
---|
522 | # ifdef TMPL_PEV86
|
---|
523 | # error "Both 'TMPL_PAE32' and 'TMPL_PEV86' are defined."
|
---|
524 | # endif
|
---|
525 | # ifdef TMPL_PP16
|
---|
526 | # error "Both 'TMPL_PAE32' and 'TMPL_PP16' are defined."
|
---|
527 | # endif
|
---|
528 | # ifdef TMPL_PP32
|
---|
529 | # error "Both 'TMPL_PAE32' and 'TMPL_PP32' are defined."
|
---|
530 | # endif
|
---|
531 | # ifdef TMPL_PPV86
|
---|
532 | # error "Both 'TMPL_PAE32' and 'TMPL_PPV86' are defined."
|
---|
533 | # endif
|
---|
534 | # ifdef TMPL_PAE16
|
---|
535 | # error "Both 'TMPL_PAE32' and 'TMPL_PAE16' are defined."
|
---|
536 | # endif
|
---|
537 | # ifdef TMPL_PAEV86
|
---|
538 | # error "Both 'TMPL_PAE32' and 'TMPL_PAEV86' are defined."
|
---|
539 | # endif
|
---|
540 | # ifdef TMPL_LM16
|
---|
541 | # error "Both 'TMPL_PAE32' and 'TMPL_LM16' are defined."
|
---|
542 | # endif
|
---|
543 | # ifdef TMPL_LM32
|
---|
544 | # error "Both 'TMPL_PAE32' and 'TMPL_LM32' are defined."
|
---|
545 | # endif
|
---|
546 | # ifdef TMPL_LM64
|
---|
547 | # error "Both 'TMPL_PAE32' and 'TMPL_LM64' are defined."
|
---|
548 | # endif
|
---|
549 | # if ARCH_BITS != 32
|
---|
550 | # error "TMPL_PAE32 requires ARCH_BITS to be 32."
|
---|
551 | # endif
|
---|
552 | # define TMPL_CMN_PAE
|
---|
553 | # define TMPL_CMN_P32
|
---|
554 | # define TMPL_32BIT
|
---|
555 | # define TMPL_BITS 32
|
---|
556 | # define TMPL_NM(Name) RT_CONCAT(Name,_pae32)
|
---|
557 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c32)
|
---|
558 | # define TMPL_MODE_STR "32-bit pae protected mode"
|
---|
559 | #endif
|
---|
560 |
|
---|
561 | #ifdef TMPL_PAEV86
|
---|
562 | # ifdef TMPL_RM
|
---|
563 | # error "Both 'TMPL_PAEV86' and 'TMPL_RM' are defined."
|
---|
564 | # endif
|
---|
565 | # ifdef TMPL_PE16
|
---|
566 | # error "Both 'TMPL_PAEV86' and 'TMPL_PE16' are defined."
|
---|
567 | # endif
|
---|
568 | # ifdef TMPL_PE32
|
---|
569 | # error "Both 'TMPL_PAEV86' and 'TMPL_PE32' are defined."
|
---|
570 | # endif
|
---|
571 | # ifdef TMPL_PEV86
|
---|
572 | # error "Both 'TMPL_PAEV86' and 'TMPL_PEV86' are defined."
|
---|
573 | # endif
|
---|
574 | # ifdef TMPL_PP16
|
---|
575 | # error "Both 'TMPL_PAEV86' and 'TMPL_PP16' are defined."
|
---|
576 | # endif
|
---|
577 | # ifdef TMPL_PP32
|
---|
578 | # error "Both 'TMPL_PAEV86' and 'TMPL_PP32' are defined."
|
---|
579 | # endif
|
---|
580 | # ifdef TMPL_PPV86
|
---|
581 | # error "Both 'TMPL_PAEV86' and 'TMPL_PPV86' are defined."
|
---|
582 | # endif
|
---|
583 | # ifdef TMPL_PAE16
|
---|
584 | # error "Both 'TMPL_PAEV86' and 'TMPL_PAE16' are defined."
|
---|
585 | # endif
|
---|
586 | # ifdef TMPL_PAEV86
|
---|
587 | # error "Both 'TMPL_PAEV86' and 'TMPL_PAEV86' are defined."
|
---|
588 | # endif
|
---|
589 | # ifdef TMPL_LM16
|
---|
590 | # error "Both 'TMPL_PAEV86' and 'TMPL_LM16' are defined."
|
---|
591 | # endif
|
---|
592 | # ifdef TMPL_LM32
|
---|
593 | # error "Both 'TMPL_PAEV86' and 'TMPL_LM32' are defined."
|
---|
594 | # endif
|
---|
595 | # ifdef TMPL_LM64
|
---|
596 | # error "Both 'TMPL_PAEV86' and 'TMPL_LM64' are defined."
|
---|
597 | # endif
|
---|
598 | # if ARCH_BITS != 16
|
---|
599 | # error "TMPL_PAEV86 requires ARCH_BITS to be 16."
|
---|
600 | # endif
|
---|
601 | # define TMPL_CMN_PAE
|
---|
602 | # define TMPL_CMN_V86
|
---|
603 | # define TMPL_CMN_R86
|
---|
604 | # define TMPL_16BIT
|
---|
605 | # define TMPL_BITS 16
|
---|
606 | # define TMPL_NM(Name) RT_CONCAT(Name,_paev86)
|
---|
607 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c86)
|
---|
608 | # define TMPL_MODE_STR "v8086 pae protected mode"
|
---|
609 | #endif
|
---|
610 |
|
---|
611 | #ifdef TMPL_LM16
|
---|
612 | # ifdef TMPL_RM
|
---|
613 | # error "Both 'TMPL_LM16' and 'TMPL_RM' are defined."
|
---|
614 | # endif
|
---|
615 | # ifdef TMPL_PE16
|
---|
616 | # error "Both 'TMPL_LM16' and 'TMPL_PE16' are defined."
|
---|
617 | # endif
|
---|
618 | # ifdef TMPL_PE32
|
---|
619 | # error "Both 'TMPL_LM16' and 'TMPL_PE32' are defined."
|
---|
620 | # endif
|
---|
621 | # ifdef TMPL_PEV86
|
---|
622 | # error "Both 'TMPL_LM16' and 'TMPL_PEV86' are defined."
|
---|
623 | # endif
|
---|
624 | # ifdef TMPL_PP16
|
---|
625 | # error "Both 'TMPL_LM16' and 'TMPL_PP16' are defined."
|
---|
626 | # endif
|
---|
627 | # ifdef TMPL_PP32
|
---|
628 | # error "Both 'TMPL_LM16' and 'TMPL_PP32' are defined."
|
---|
629 | # endif
|
---|
630 | # ifdef TMPL_PPV86
|
---|
631 | # error "Both 'TMPL_LM16' and 'TMPL_PPV86' are defined."
|
---|
632 | # endif
|
---|
633 | # ifdef TMPL_PAE16
|
---|
634 | # error "Both 'TMPL_LM16' and 'TMPL_PAE16' are defined."
|
---|
635 | # endif
|
---|
636 | # ifdef TMPL_PAE32
|
---|
637 | # error "Both 'TMPL_LM16' and 'TMPL_PAE32' are defined."
|
---|
638 | # endif
|
---|
639 | # ifdef TMPL_PAEV86
|
---|
640 | # error "Both 'TMPL_LM16' and 'TMPL_PAEV86' are defined."
|
---|
641 | # endif
|
---|
642 | # ifdef TMPL_LM32
|
---|
643 | # error "Both 'TMPL_LM16' and 'TMPL_LM32' are defined."
|
---|
644 | # endif
|
---|
645 | # ifdef TMPL_LM64
|
---|
646 | # error "Both 'TMPL_LM16' and 'TMPL_LM64' are defined."
|
---|
647 | # endif
|
---|
648 | # if ARCH_BITS != 16
|
---|
649 | # error "TMPL_LM16 requires ARCH_BITS to be 16."
|
---|
650 | # endif
|
---|
651 | # define TMPL_CMN_LM
|
---|
652 | # define TMPL_CMN_P16
|
---|
653 | # define TMPL_16BIT
|
---|
654 | # define TMPL_BITS 16
|
---|
655 | # define TMPL_NM(Name) RT_CONCAT(Name,_lm16)
|
---|
656 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c16)
|
---|
657 | # define TMPL_MODE_STR "16-bit long mode"
|
---|
658 | #endif
|
---|
659 |
|
---|
660 | #ifdef TMPL_LM32
|
---|
661 | # ifdef TMPL_RM
|
---|
662 | # error "Both 'TMPL_LM32' and 'TMPL_RM' are defined."
|
---|
663 | # endif
|
---|
664 | # ifdef TMPL_PE16
|
---|
665 | # error "Both 'TMPL_LM32' and 'TMPL_PE16' are defined."
|
---|
666 | # endif
|
---|
667 | # ifdef TMPL_PE32
|
---|
668 | # error "Both 'TMPL_LM32' and 'TMPL_PE32' are defined."
|
---|
669 | # endif
|
---|
670 | # ifdef TMPL_PEV86
|
---|
671 | # error "Both 'TMPL_LM32' and 'TMPL_PEV86' are defined."
|
---|
672 | # endif
|
---|
673 | # ifdef TMPL_PP16
|
---|
674 | # error "Both 'TMPL_LM32' and 'TMPL_PP16' are defined."
|
---|
675 | # endif
|
---|
676 | # ifdef TMPL_PP32
|
---|
677 | # error "Both 'TMPL_LM32' and 'TMPL_PP32' are defined."
|
---|
678 | # endif
|
---|
679 | # ifdef TMPL_PPV86
|
---|
680 | # error "Both 'TMPL_LM32' and 'TMPL_PPV86' are defined."
|
---|
681 | # endif
|
---|
682 | # ifdef TMPL_PAE16
|
---|
683 | # error "Both 'TMPL_LM32' and 'TMPL_PAE16' are defined."
|
---|
684 | # endif
|
---|
685 | # ifdef TMPL_PAE32
|
---|
686 | # error "Both 'TMPL_LM32' and 'TMPL_PAE32' are defined."
|
---|
687 | # endif
|
---|
688 | # ifdef TMPL_PAEV86
|
---|
689 | # error "Both 'TMPL_LM32' and 'TMPL_PAEV86' are defined."
|
---|
690 | # endif
|
---|
691 | # ifdef TMPL_LM16
|
---|
692 | # error "Both 'TMPL_LM32' and 'TMPL_LM16' are defined."
|
---|
693 | # endif
|
---|
694 | # ifdef TMPL_LM64
|
---|
695 | # error "Both 'TMPL_LM32' and 'TMPL_LM64' are defined."
|
---|
696 | # endif
|
---|
697 | # if ARCH_BITS != 32
|
---|
698 | # error "TMPL_LM32 requires ARCH_BITS to be 32."
|
---|
699 | # endif
|
---|
700 | # define TMPL_CMN_LM
|
---|
701 | # define TMPL_CMN_P32
|
---|
702 | # define TMPL_32BIT
|
---|
703 | # define TMPL_BITS 32
|
---|
704 | # define TMPL_NM(Name) RT_CONCAT(Name,_lm32)
|
---|
705 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c32)
|
---|
706 | # define TMPL_MODE_STR "32-bit long mode"
|
---|
707 | #endif
|
---|
708 |
|
---|
709 | #ifdef TMPL_LM64
|
---|
710 | # ifdef TMPL_RM
|
---|
711 | # error ""Both 'TMPL_LM64' and 'TMPL_RM' are defined.""
|
---|
712 | # endif
|
---|
713 | # ifdef TMPL_PE16
|
---|
714 | # error "Both 'TMPL_LM64' and 'TMPL_PE16' are defined."
|
---|
715 | # endif
|
---|
716 | # ifdef TMPL_PE32
|
---|
717 | # error "Both 'TMPL_LM64' and 'TMPL_PE32' are defined."
|
---|
718 | # endif
|
---|
719 | # ifdef TMPL_PEV86
|
---|
720 | # error "Both 'TMPL_LM64' and 'TMPL_PEV86' are defined."
|
---|
721 | # endif
|
---|
722 | # ifdef TMPL_PP16
|
---|
723 | # error "Both 'TMPL_LM64' and 'TMPL_PP16' are defined."
|
---|
724 | # endif
|
---|
725 | # ifdef TMPL_PP32
|
---|
726 | # error "Both 'TMPL_LM64' and 'TMPL_PP32' are defined."
|
---|
727 | # endif
|
---|
728 | # ifdef TMPL_PPV86
|
---|
729 | # error "Both 'TMPL_LM64' and 'TMPL_PPV86' are defined."
|
---|
730 | # endif
|
---|
731 | # ifdef TMPL_PAE16
|
---|
732 | # error "Both 'TMPL_LM64' and 'TMPL_PAE16' are defined."
|
---|
733 | # endif
|
---|
734 | # ifdef TMPL_PAE32
|
---|
735 | # error "Both 'TMPL_LM64' and 'TMPL_PAE32' are defined."
|
---|
736 | # endif
|
---|
737 | # ifdef TMPL_PAEV86
|
---|
738 | # error "Both 'TMPL_LM64' and 'TMPL_PAEV86' are defined."
|
---|
739 | # endif
|
---|
740 | # ifdef TMPL_LM16
|
---|
741 | # error "Both 'TMPL_LM64' and 'TMPL_LM16' are defined."
|
---|
742 | # endif
|
---|
743 | # ifdef TMPL_LM32
|
---|
744 | # error "Both 'TMPL_LM64' and 'TMPL_LM32' are defined."
|
---|
745 | # endif
|
---|
746 | # if ARCH_BITS != 64
|
---|
747 | # error "TMPL_LM64 requires ARCH_BITS to be 64."
|
---|
748 | # endif
|
---|
749 | # define TMPL_CMN_LM
|
---|
750 | # define TMPL_CMN_P64
|
---|
751 | # define TMPL_64BIT
|
---|
752 | # define TMPL_BITS 64
|
---|
753 | # define TMPL_NM(Name) RT_CONCAT(Name,_lm64)
|
---|
754 | # define BS3_CMN_NM(Name) RT_CONCAT(Name,_c64)
|
---|
755 | # define TMPL_MODE_STR "64-bit long mode"
|
---|
756 | #endif
|
---|
757 |
|
---|
758 | #ifndef TMPL_MODE_STR
|
---|
759 | # error "internal error"
|
---|
760 | #endif
|
---|
761 |
|
---|
762 | #endif /* !DOXYGEN_RUNNING */
|
---|
763 | /** @} */
|
---|
764 |
|
---|