1 | ; $Id: bs3kit-template-header.mac 82968 2020-02-04 10:35:17Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit header for multi-mode code templates.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2020 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 | ; - TMPL_CMN_PAGING = TMPL_CMN_PP | TMPL_CMN_PAE | TMPL_CMN_LM
|
---|
54 | ;
|
---|
55 |
|
---|
56 |
|
---|
57 | ;
|
---|
58 | ; Convert TMPL_XXX to TMPL_MODE.
|
---|
59 | ;
|
---|
60 | %ifndef TMPL_MODE
|
---|
61 | %ifdef TMPL_RM
|
---|
62 | %define TMPL_MODE BS3_MODE_RM
|
---|
63 | %elifdef TMPL_PE16
|
---|
64 | %define TMPL_MODE BS3_MODE_PE16
|
---|
65 | %elifdef TMPL_PE16_32
|
---|
66 | %define TMPL_MODE BS3_MODE_PE16_32
|
---|
67 | %elifdef TMPL_PE16_V86
|
---|
68 | %define TMPL_MODE BS3_MODE_PE16_V86
|
---|
69 | %elifdef TMPL_PE32
|
---|
70 | %define TMPL_MODE BS3_MODE_PE32
|
---|
71 | %elifdef TMPL_PE32_16
|
---|
72 | %define TMPL_MODE BS3_MODE_PE32_16
|
---|
73 | %elifdef TMPL_PEV86
|
---|
74 | %define TMPL_MODE BS3_MODE_PEV86
|
---|
75 | %elifdef TMPL_PP16
|
---|
76 | %define TMPL_MODE BS3_MODE_PP16
|
---|
77 | %elifdef TMPL_PP16_32
|
---|
78 | %define TMPL_MODE BS3_MODE_PP16_32
|
---|
79 | %elifdef TMPL_PP16_V86
|
---|
80 | %define TMPL_MODE BS3_MODE_PP16_V86
|
---|
81 | %elifdef TMPL_PP32
|
---|
82 | %define TMPL_MODE BS3_MODE_PP32
|
---|
83 | %elifdef TMPL_PP32_16
|
---|
84 | %define TMPL_MODE BS3_MODE_PP32_16
|
---|
85 | %elifdef TMPL_PPV86
|
---|
86 | %define TMPL_MODE BS3_MODE_PPV86
|
---|
87 | %elifdef TMPL_PAE16
|
---|
88 | %define TMPL_MODE BS3_MODE_PAE16
|
---|
89 | %elifdef TMPL_PAE16_32
|
---|
90 | %define TMPL_MODE BS3_MODE_PAE16_32
|
---|
91 | %elifdef TMPL_PAE16_V86
|
---|
92 | %define TMPL_MODE BS3_MODE_PAE16_V86
|
---|
93 | %elifdef TMPL_PAE32
|
---|
94 | %define TMPL_MODE BS3_MODE_PAE32
|
---|
95 | %elifdef TMPL_PAE32_16
|
---|
96 | %define TMPL_MODE BS3_MODE_PAE32_16
|
---|
97 | %elifdef TMPL_PAEV86
|
---|
98 | %define TMPL_MODE BS3_MODE_PAEV86
|
---|
99 | %elifdef TMPL_LM16
|
---|
100 | %define TMPL_MODE BS3_MODE_LM16
|
---|
101 | %elifdef TMPL_LM32
|
---|
102 | %define TMPL_MODE BS3_MODE_LM32
|
---|
103 | %elifdef TMPL_LM64
|
---|
104 | %define TMPL_MODE BS3_MODE_LM64
|
---|
105 | %else
|
---|
106 | %error "Unable to to figure out the template mode."
|
---|
107 | %endif
|
---|
108 | %endif
|
---|
109 |
|
---|
110 | ;
|
---|
111 | ; Check the code bitness and set TMPL_XXBITS, TMPL_BITS, BS3_CMN_NM
|
---|
112 | ;
|
---|
113 | %if (TMPL_MODE & BS3_MODE_CODE_MASK) == BS3_MODE_CODE_16
|
---|
114 | %define TMPL_16BIT
|
---|
115 | %define TMPL_BITS 16
|
---|
116 | %define TMPL_PTR_DEF dw
|
---|
117 | %define TMPL_UNDERSCORE _
|
---|
118 | %define BS3_CMN_NM(Name) _ %+ Name %+ _c16
|
---|
119 |
|
---|
120 | %elif (TMPL_MODE & BS3_MODE_CODE_MASK) == BS3_MODE_CODE_32
|
---|
121 | %define TMPL_32BIT
|
---|
122 | %define TMPL_BITS 32
|
---|
123 | %define TMPL_PTR_DEF dd
|
---|
124 | %define TMPL_UNDERSCORE _
|
---|
125 | %define BS3_CMN_NM(Name) _ %+ Name %+ _c32
|
---|
126 |
|
---|
127 | %elif (TMPL_MODE & BS3_MODE_CODE_MASK) == BS3_MODE_CODE_V86
|
---|
128 | %define TMPL_16BIT
|
---|
129 | %define TMPL_BITS 16
|
---|
130 | %define TMPL_UNDERSCORE _
|
---|
131 | %define BS3_CMN_NM(Name) _ %+ Name %+ _c16
|
---|
132 | %define TMPL_CMN_R86
|
---|
133 | %define TMPL_CMN_V86
|
---|
134 |
|
---|
135 | %elif (TMPL_MODE & BS3_MODE_CODE_MASK) == BS3_MODE_CODE_64
|
---|
136 | %define TMPL_64BIT
|
---|
137 | %define TMPL_BITS 64
|
---|
138 | %define TMPL_PTR_DEF dq
|
---|
139 | %define TMPL_UNDERSCORE _
|
---|
140 | %define BS3_CMN_NM(Name) _ %+ Name %+ _c64
|
---|
141 |
|
---|
142 | %else
|
---|
143 | %error "Invalid TMPL_MODE value!"
|
---|
144 | %endif
|
---|
145 |
|
---|
146 | ;
|
---|
147 | ; Check the system specific mask and set derived values.
|
---|
148 | ;
|
---|
149 | %if (TMPL_MODE & BS3_MODE_SYS_MASK) == BS3_MODE_SYS_RM
|
---|
150 | %define TMPL_HAVE_BIOS
|
---|
151 | %define TMPL_CMN_R86
|
---|
152 |
|
---|
153 | %elif (TMPL_MODE & BS3_MODE_SYS_MASK) == BS3_MODE_SYS_PE16
|
---|
154 | %define TMPL_SYS_PE16
|
---|
155 | %define TMPL_CMN_PE
|
---|
156 |
|
---|
157 | %elif (TMPL_MODE & BS3_MODE_SYS_MASK) == BS3_MODE_SYS_PE32
|
---|
158 | %define TMPL_SYS_PE32
|
---|
159 | %define TMPL_CMN_PE
|
---|
160 |
|
---|
161 | %elif (TMPL_MODE & BS3_MODE_SYS_MASK) == BS3_MODE_SYS_PP16
|
---|
162 | %define TMPL_SYS_PP16
|
---|
163 | %define TMPL_CMN_PP
|
---|
164 | %define TMPL_CMN_PAGING
|
---|
165 |
|
---|
166 | %elif (TMPL_MODE & BS3_MODE_SYS_MASK) == BS3_MODE_SYS_PP32
|
---|
167 | %define TMPL_SYS_PP32
|
---|
168 | %define TMPL_CMN_PP
|
---|
169 | %define TMPL_CMN_PAGING
|
---|
170 |
|
---|
171 | %elif (TMPL_MODE & BS3_MODE_SYS_MASK) == BS3_MODE_SYS_PAE16
|
---|
172 | %define TMPL_SYS_PAE16
|
---|
173 | %define TMPL_CMN_PAE
|
---|
174 | %define TMPL_CMN_PAGING
|
---|
175 |
|
---|
176 | %elif (TMPL_MODE & BS3_MODE_SYS_MASK) == BS3_MODE_SYS_PAE32
|
---|
177 | %define TMPL_SYS_PAE32
|
---|
178 | %define TMPL_CMN_PAE
|
---|
179 | %define TMPL_CMN_PAGING
|
---|
180 |
|
---|
181 | %elif (TMPL_MODE & BS3_MODE_SYS_MASK) == BS3_MODE_SYS_LM
|
---|
182 | %define TMPL_SYS_LM
|
---|
183 | %define TMPL_CMN_LM
|
---|
184 | %define TMPL_CMN_PAGING
|
---|
185 |
|
---|
186 | %else
|
---|
187 | %error "Invalid TMPL_MODE value!"
|
---|
188 | %endif
|
---|
189 |
|
---|
190 |
|
---|
191 | ;
|
---|
192 | ; Mode specific stuff.
|
---|
193 | ;
|
---|
194 | %if TMPL_MODE == BS3_MODE_RM
|
---|
195 | %define TMPL_RM
|
---|
196 | %define TMPL_MODE_STR "real mode"
|
---|
197 | %define TMPL_NM(Name) _ %+ Name %+ _rm
|
---|
198 | %define TMPL_MODE_LNAME rm
|
---|
199 | %define TMPL_MODE_UNAME RM
|
---|
200 |
|
---|
201 |
|
---|
202 | %elif TMPL_MODE == BS3_MODE_PE16
|
---|
203 | %define TMPL_PE16
|
---|
204 | %define TMPL_MODE_STR "16-bit prot, 16-bit"
|
---|
205 | %define TMPL_NM(Name) _ %+ Name %+ _pe16
|
---|
206 | %define TMPL_MODE_LNAME pe16
|
---|
207 | %define TMPL_MODE_UNAME PE16
|
---|
208 |
|
---|
209 | %elif TMPL_MODE == BS3_MODE_PE16_32
|
---|
210 | %define TMPL_PE16_32
|
---|
211 | %define TMPL_MODE_STR "16-bit prot, 32-bit"
|
---|
212 | %define TMPL_NM(Name) _ %+ Name %+ _pe16_32
|
---|
213 | %define TMPL_MODE_LNAME pe16_32
|
---|
214 | %define TMPL_MODE_UNAME PE16_32
|
---|
215 | %define TMPL_CMN_WEIRD
|
---|
216 |
|
---|
217 | %elif TMPL_MODE == BS3_MODE_PE16_V86
|
---|
218 | %define TMPL_PE16_V86
|
---|
219 | %define TMPL_MODE_STR "16-bit prot, v8086"
|
---|
220 | %define TMPL_NM(Name) _ %+ Name %+ _pe16_v86
|
---|
221 | %define TMPL_MODE_LNAME pe16_v86
|
---|
222 | %define TMPL_MODE_UNAME PE16_v86
|
---|
223 | %define TMPL_CMN_WEIRD
|
---|
224 | %define TMPL_CMN_WEIRD_V86
|
---|
225 |
|
---|
226 |
|
---|
227 | %elif TMPL_MODE == BS3_MODE_PE32
|
---|
228 | %define TMPL_PE32
|
---|
229 | %define TMPL_MODE_STR "32-bit prot, 32-bit"
|
---|
230 | %define TMPL_NM(Name) _ %+ Name %+ _pe32
|
---|
231 | %define TMPL_MODE_LNAME pe32
|
---|
232 | %define TMPL_MODE_UNAME PE32
|
---|
233 |
|
---|
234 | %elif TMPL_MODE == BS3_MODE_PE32_16
|
---|
235 | %define TMPL_PE32_16
|
---|
236 | %define TMPL_MODE_STR "32-bit prot, 16-bit"
|
---|
237 | %define TMPL_NM(Name) _ %+ Name %+ _pe32_16
|
---|
238 | %define TMPL_MODE_LNAME pe32_16
|
---|
239 | %define TMPL_MODE_UNAME PE32_16
|
---|
240 | %define TMPL_CMN_WEIRD
|
---|
241 |
|
---|
242 | %elif TMPL_MODE == BS3_MODE_PEV86
|
---|
243 | %define TMPL_PEV86
|
---|
244 | %define TMPL_MODE_STR "32-bit prot, v8086"
|
---|
245 | %define TMPL_NM(Name) _ %+ Name %+ _pev86
|
---|
246 | %define TMPL_MODE_LNAME pev86
|
---|
247 | %define TMPL_MODE_UNAME PEV86
|
---|
248 |
|
---|
249 |
|
---|
250 | %elif TMPL_MODE == BS3_MODE_PP16
|
---|
251 | %define TMPL_PP16
|
---|
252 | %define TMPL_MODE_STR "16-bit paged, 16-bit"
|
---|
253 | %define TMPL_NM(Name) _ %+ Name %+ _pp16
|
---|
254 | %define TMPL_MODE_LNAME pp16
|
---|
255 | %define TMPL_MODE_UNAME PP16
|
---|
256 |
|
---|
257 | %elif TMPL_MODE == BS3_MODE_PP16_32
|
---|
258 | %define TMPL_PP16_32
|
---|
259 | %define TMPL_MODE_STR "16-bit paged, 32-bit"
|
---|
260 | %define TMPL_NM(Name) _ %+ Name %+ _pp16_32
|
---|
261 | %define TMPL_MODE_LNAME pp16_32
|
---|
262 | %define TMPL_MODE_UNAME PP16_32
|
---|
263 | %define TMPL_CMN_WEIRD
|
---|
264 |
|
---|
265 | %elif TMPL_MODE == BS3_MODE_PP16_V86
|
---|
266 | %define TMPL_PP16_V86
|
---|
267 | %define TMPL_MODE_STR "16-bit paged, v8086"
|
---|
268 | %define TMPL_NM(Name) _ %+ Name %+ _pp16_v86
|
---|
269 | %define TMPL_MODE_LNAME pp16_v86
|
---|
270 | %define TMPL_MODE_UNAME PP16_v86
|
---|
271 | %define TMPL_CMN_WEIRD
|
---|
272 | %define TMPL_CMN_WEIRD_V86
|
---|
273 |
|
---|
274 |
|
---|
275 | %elif TMPL_MODE == BS3_MODE_PP32
|
---|
276 | %define TMPL_PP32
|
---|
277 | %define TMPL_MODE_STR "32-bit paged, 32-bit"
|
---|
278 | %define TMPL_NM(Name) _ %+ Name %+ _pp32
|
---|
279 | %define TMPL_MODE_LNAME pp32
|
---|
280 | %define TMPL_MODE_UNAME PP32
|
---|
281 |
|
---|
282 | %elif TMPL_MODE == BS3_MODE_PP32_16
|
---|
283 | %define TMPL_PP32_16
|
---|
284 | %define TMPL_MODE_STR "32-bit paged, 16-bit"
|
---|
285 | %define TMPL_NM(Name) _ %+ Name %+ _pp32_16
|
---|
286 | %define TMPL_MODE_LNAME pp32_16
|
---|
287 | %define TMPL_MODE_UNAME PP32_16
|
---|
288 | %define TMPL_CMN_WEIRD
|
---|
289 |
|
---|
290 | %elif TMPL_MODE == BS3_MODE_PPV86
|
---|
291 | %define TMPL_PPV86
|
---|
292 | %define TMPL_MODE_STR "32-bit paged, v8086"
|
---|
293 | %define TMPL_NM(Name) _ %+ Name %+ _ppv86
|
---|
294 | %define TMPL_MODE_LNAME ppv86
|
---|
295 | %define TMPL_MODE_UNAME PPV86
|
---|
296 |
|
---|
297 |
|
---|
298 | %elif TMPL_MODE == BS3_MODE_PAE16
|
---|
299 | %define TMPL_PAE16
|
---|
300 | %define TMPL_MODE_STR "16-bit pae, 16-bit"
|
---|
301 | %define TMPL_NM(Name) _ %+ Name %+ _pae16
|
---|
302 | %define TMPL_MODE_LNAME pae16
|
---|
303 | %define TMPL_MODE_UNAME PAE16
|
---|
304 |
|
---|
305 | %elif TMPL_MODE == BS3_MODE_PAE16_32
|
---|
306 | %define TMPL_PAE16_32
|
---|
307 | %define TMPL_MODE_STR "16-bit pae, 32-bit"
|
---|
308 | %define TMPL_NM(Name) _ %+ Name %+ _pae16_32
|
---|
309 | %define TMPL_MODE_LNAME pae16_32
|
---|
310 | %define TMPL_MODE_UNAME PAE16_32
|
---|
311 | %define TMPL_CMN_WEIRD
|
---|
312 |
|
---|
313 | %elif TMPL_MODE == BS3_MODE_PAE16_V86
|
---|
314 | %define TMPL_PAE16_V86
|
---|
315 | %define TMPL_MODE_STR "16-bit pae, v8086"
|
---|
316 | %define TMPL_NM(Name) _ %+ Name %+ _pae16_v86
|
---|
317 | %define TMPL_MODE_LNAME pae16_v86
|
---|
318 | %define TMPL_MODE_UNAME PAE16_v86
|
---|
319 | %define TMPL_CMN_WEIRD
|
---|
320 | %define TMPL_CMN_WEIRD_V86
|
---|
321 |
|
---|
322 |
|
---|
323 | %elif TMPL_MODE == BS3_MODE_PAE32
|
---|
324 | %define TMPL_PAE32
|
---|
325 | %define TMPL_MODE_STR "32-bit pae, 32-bit"
|
---|
326 | %define TMPL_NM(Name) _ %+ Name %+ _pae32
|
---|
327 | %define TMPL_MODE_LNAME pae32
|
---|
328 | %define TMPL_MODE_UNAME PAE32
|
---|
329 |
|
---|
330 | %elif TMPL_MODE == BS3_MODE_PAE32_16
|
---|
331 | %define TMPL_PAE32_16
|
---|
332 | %define TMPL_MODE_STR "32-bit pae, 16-bit"
|
---|
333 | %define TMPL_NM(Name) _ %+ Name %+ _pae32_16
|
---|
334 | %define TMPL_MODE_LNAME pae32_16
|
---|
335 | %define TMPL_MODE_UNAME PAE32_16
|
---|
336 | %define TMPL_CMN_WEIRD
|
---|
337 |
|
---|
338 | %elif TMPL_MODE == BS3_MODE_PAEV86
|
---|
339 | %define TMPL_PAEV86
|
---|
340 | %define TMPL_MODE_STR "32-bit pae, v8086 pae"
|
---|
341 | %define TMPL_NM(Name) _ %+ Name %+ _paev86
|
---|
342 | %define TMPL_MODE_LNAME paev86
|
---|
343 | %define TMPL_MODE_UNAME PAEV86
|
---|
344 |
|
---|
345 |
|
---|
346 | %elif TMPL_MODE == BS3_MODE_LM16
|
---|
347 | %define TMPL_LM16
|
---|
348 | %define TMPL_MODE_STR "long, 16-bit"
|
---|
349 | %define TMPL_NM(Name) _ %+ Name %+ _lm16
|
---|
350 | %define TMPL_MODE_LNAME lm16
|
---|
351 | %define TMPL_MODE_UNAME LM16
|
---|
352 |
|
---|
353 | %elif TMPL_MODE == BS3_MODE_LM32
|
---|
354 | %define TMPL_LM32
|
---|
355 | %define TMPL_MODE_STR "long, 32-bit"
|
---|
356 | %define TMPL_NM(Name) _ %+ Name %+ _lm32
|
---|
357 | %define TMPL_MODE_LNAME lm32
|
---|
358 | %define TMPL_MODE_UNAME LM32
|
---|
359 |
|
---|
360 | %elif TMPL_MODE == BS3_MODE_LM64
|
---|
361 | %define TMPL_LM64
|
---|
362 | %define TMPL_MODE_STR "long, 64-bit"
|
---|
363 | %define TMPL_NM(Name) _ %+ Name %+ _lm64
|
---|
364 | %define TMPL_MODE_LNAME lm64
|
---|
365 | %define TMPL_MODE_UNAME LM64
|
---|
366 |
|
---|
367 | %else
|
---|
368 | %error "Invalid TMPL_MODE value!!"
|
---|
369 | %endif
|
---|
370 |
|
---|
371 | %ifnidn TMPL_UNDERSCORE,_; RT_CONCAT3 doesn't work with TMPL_UNDERSCORE being empty. duh.
|
---|
372 | %ifidn RT_CONCAT(TestName_,TMPL_MODE_LNAME),TMPL_NM(TestName)
|
---|
373 | %else
|
---|
374 | %error internal error: RT_CONCAT(TestName_,TMPL_MODE_LNAME) vs TMPL_NM(TestName)
|
---|
375 | %endif
|
---|
376 | %else
|
---|
377 | %ifidn RT_CONCAT3(TMPL_UNDERSCORE,TestName_,TMPL_MODE_LNAME),TMPL_NM(TestName)
|
---|
378 | %else
|
---|
379 | %error internal error: RT_CONCAT3(TMPL_UNDERSCORE,TestName_,TMPL_MODE_LNAME) vs TMPL_NM(TestName)
|
---|
380 | %endif
|
---|
381 | %endif
|
---|
382 |
|
---|
383 | ; TMPL_NM version with uppercased suffix and no underscore separating them.
|
---|
384 | %define TMPL_NM_U(Name) TMPL_UNDERSCORE %+ Name %+ TMPL_MODE_UNAME
|
---|
385 |
|
---|
386 | ; TMPL_FAR_NM
|
---|
387 | %if TMPL_MODE & (BS3_MODE_CODE_16 | BS3_MODE_CODE_V86)
|
---|
388 | %define TMPL_FAR_NM(Name) TMPL_NM(Name) %+ _far
|
---|
389 | %else
|
---|
390 | %define TMPL_FAR_NM(Name) TMPL_NM(Name)
|
---|
391 | %endif
|
---|
392 |
|
---|
393 |
|
---|
394 | ;; @def TMPL_WRT_FLAT
|
---|
395 | ; WRT flat when not in 16-bit modes.
|
---|
396 | ;
|
---|
397 | %ifdef TMPL_16BIT
|
---|
398 | %define TMPL_WRT_FLAT
|
---|
399 | %else
|
---|
400 | %define TMPL_WRT_FLAT wrt FLAT
|
---|
401 | %endif
|
---|
402 |
|
---|
403 | ;; @def TMPL_WRT_DATA16_OR_FLAT
|
---|
404 | ; WRT DATA16 in 16-bit mode, WRT FLAT in 32- and 64-bit modes.
|
---|
405 | ; This is important when accessing global variables.
|
---|
406 | ;
|
---|
407 | %ifdef TMPL_16BIT
|
---|
408 | %define TMPL_WRT_DATA16_OR_FLAT wrt BS3KIT_GRPNM_DATA16
|
---|
409 | %else
|
---|
410 | %define TMPL_WRT_DATA16_OR_FLAT wrt FLAT
|
---|
411 | %endif
|
---|
412 |
|
---|
413 | ;; @def TMPL_DATA16_WRT
|
---|
414 | ; WRT DATA16 in 16-bit mode, WRT FLAT in 32- and 64-bit modes.
|
---|
415 | ; This is important when accessing global variables.
|
---|
416 | ;
|
---|
417 | %if TMPL_BITS == 16
|
---|
418 | %define TMPL_DATA16_WRT(a_Var) a_Var wrt BS3KIT_GRPNM_DATA16
|
---|
419 | %elif TMPL_BITS == 32
|
---|
420 | %define TMPL_DATA16_WRT(a_Var) a_Var wrt FLAT
|
---|
421 | %elif TMPL_BITS == 64
|
---|
422 | %define TMPL_DATA16_WRT(a_Var) rel a_Var wrt FLAT
|
---|
423 | %else
|
---|
424 | %error TMPL_BITS
|
---|
425 | %endif
|
---|
426 |
|
---|
427 | ;; @def TMPL_WRT_SYSTEM16_OR_FLAT
|
---|
428 | ; WRT BS3SYSTEM16 in 16-bit mode, WRT FLAT in 32- and 64-bit modes.
|
---|
429 | ; This is important when accessing global variables in the BS3SYSTEM16 segment.
|
---|
430 | %ifdef TMPL_16BIT
|
---|
431 | %define TMPL_WRT_SYSTEM16_OR_FLAT wrt BS3SYSTEM16
|
---|
432 | %else
|
---|
433 | %define TMPL_WRT_SYSTEM16_OR_FLAT wrt FLAT
|
---|
434 | %endif
|
---|
435 |
|
---|
436 | ;; @def TONLY16
|
---|
437 | ; Version of BONLY16 that follows the code template.
|
---|
438 | ; Like BONLY16 this normally goes in column 1.
|
---|
439 | %if TMPL_BITS == 16
|
---|
440 | %macro TONLY16 1+
|
---|
441 | %1
|
---|
442 | %endmacro
|
---|
443 | %else
|
---|
444 | %macro TONLY16 1+
|
---|
445 | %endmacro
|
---|
446 | %endif
|
---|
447 |
|
---|
448 | ;; @def TONLY32
|
---|
449 | ; Version of BONLY32 that follows the code template.
|
---|
450 | ; Like BONLY32 this normally goes in column 1.
|
---|
451 | %if TMPL_BITS == 32
|
---|
452 | %macro TONLY32 1+
|
---|
453 | %1
|
---|
454 | %endmacro
|
---|
455 | %else
|
---|
456 | %macro TONLY32 1+
|
---|
457 | %endmacro
|
---|
458 | %endif
|
---|
459 |
|
---|
460 | ;; @def TONLY64
|
---|
461 | ; Version of BONLY64 that follows the code template.
|
---|
462 | ; Like BONLY64 this normally goes in column 1.
|
---|
463 | %if TMPL_BITS == 64
|
---|
464 | %macro TONLY64 1+
|
---|
465 | %1
|
---|
466 | %endmacro
|
---|
467 | %else
|
---|
468 | %macro TONLY64 1+
|
---|
469 | %endmacro
|
---|
470 | %endif
|
---|
471 |
|
---|
472 | ;; @def TNOT16
|
---|
473 | ; Version of BNOT16 that follows the code template.
|
---|
474 | ; Like BNOT16 this normally goes in column 1.
|
---|
475 | %if TMPL_BITS == 16
|
---|
476 | %macro TNOT16 1+
|
---|
477 | %endmacro
|
---|
478 | %else
|
---|
479 | %macro TNOT16 1+
|
---|
480 | %1
|
---|
481 | %endmacro
|
---|
482 | %endif
|
---|
483 |
|
---|
484 | ;; @def TNOT32
|
---|
485 | ; Version of BNOT32 that follows the code template.
|
---|
486 | ; Like BNOT32 this normally goes in column 1.
|
---|
487 | %if TMPL_BITS == 32
|
---|
488 | %macro TNOT32 1+
|
---|
489 | %endmacro
|
---|
490 | %else
|
---|
491 | %macro TNOT32 1+
|
---|
492 | %1
|
---|
493 | %endmacro
|
---|
494 | %endif
|
---|
495 |
|
---|
496 | ;; @def TNOT64
|
---|
497 | ; Version of BNOT64 that follows the code template.
|
---|
498 | ; Like BNOT64 this normally goes in column 1.
|
---|
499 | %if TMPL_BITS == 64
|
---|
500 | %macro TNOT64 1+
|
---|
501 | %endmacro
|
---|
502 | %else
|
---|
503 | %macro TNOT64 1+
|
---|
504 | %1
|
---|
505 | %endmacro
|
---|
506 | %endif
|
---|
507 |
|
---|
508 |
|
---|
509 | ;
|
---|
510 | ; Default code segment (changes BITS too).
|
---|
511 | ;
|
---|
512 | %ifdef TMPL_64BIT
|
---|
513 | %define TMPL_BEGIN_TEXT BS3_BEGIN_TEXT64
|
---|
514 | %elifdef TMPL_32BIT
|
---|
515 | %define TMPL_BEGIN_TEXT BS3_BEGIN_TEXT32
|
---|
516 | %elifdef TMPL_16BIT
|
---|
517 | %define TMPL_BEGIN_TEXT BS3_BEGIN_TEXT16
|
---|
518 | %else
|
---|
519 | %error "Missing TMPL_xxBIT!"
|
---|
520 | %endif
|
---|
521 | TMPL_BEGIN_TEXT
|
---|
522 |
|
---|