1 | /** @file
|
---|
2 | * IPRT - AMD64 and x86 Specific Assembly Functions, 16-bit Watcom C pragma aux.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef IPRT_INCLUDED_asm_amd64_x86_watcom_16_h
|
---|
37 | #define IPRT_INCLUDED_asm_amd64_x86_watcom_16_h
|
---|
38 | /* no pragma once */
|
---|
39 |
|
---|
40 | #ifndef IPRT_INCLUDED_asm_amd64_x86_h
|
---|
41 | # error "Don't include this header directly."
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * Turns out we cannot use 'ds' for segment stuff here because the compiler
|
---|
46 | * seems to insists on loading the DGROUP segment into 'ds' before calling
|
---|
47 | * stuff when using -ecc. Using 'es' instead as this seems to work fine.
|
---|
48 | *
|
---|
49 | * Note! The #undef that preceds the #pragma aux statements is for undoing
|
---|
50 | * the mangling, because the symbol in #pragma aux [symbol] statements
|
---|
51 | * doesn't get subjected to preprocessing. This is also why we include
|
---|
52 | * the watcom header at both the top and the bottom of asm-amd64-x86.h file.
|
---|
53 | */
|
---|
54 |
|
---|
55 | #undef ASMGetIDTR
|
---|
56 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
57 | #pragma aux ASMGetIDTR = \
|
---|
58 | ".286p" \
|
---|
59 | "sidt fword ptr es:[bx]" \
|
---|
60 | parm [es bx] \
|
---|
61 | modify exact [];
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | #undef ASMGetIdtrLimit
|
---|
65 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
66 | #pragma aux ASMGetIdtrLimit = \
|
---|
67 | ".286p" \
|
---|
68 | "sub sp, 8" \
|
---|
69 | "mov bx, sp" \
|
---|
70 | "sidt fword ptr ss:[bx]" \
|
---|
71 | "mov bx, ss:[bx]" \
|
---|
72 | "add sp, 8" \
|
---|
73 | parm [] \
|
---|
74 | value [bx] \
|
---|
75 | modify exact [bx];
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | #undef ASMSetIDTR
|
---|
79 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
80 | #pragma aux ASMSetIDTR = \
|
---|
81 | ".286p" \
|
---|
82 | "lidt fword ptr es:[bx]" \
|
---|
83 | parm [es bx] nomemory \
|
---|
84 | modify nomemory;
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | #undef ASMGetGDTR
|
---|
88 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
89 | #pragma aux ASMGetGDTR = \
|
---|
90 | ".286p" \
|
---|
91 | "sgdt fword ptr es:[bx]" \
|
---|
92 | parm [es bx] \
|
---|
93 | modify exact [];
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | #undef ASMSetGDTR
|
---|
97 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
98 | #pragma aux ASMSetGDTR = \
|
---|
99 | ".286p" \
|
---|
100 | "lgdt fword ptr es:[bx]" \
|
---|
101 | parm [es bx] nomemory \
|
---|
102 | modify exact [] nomemory;
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | #undef ASMGetCS
|
---|
106 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
107 | #pragma aux ASMGetCS = \
|
---|
108 | "mov ax, cs" \
|
---|
109 | parm [] nomemory \
|
---|
110 | value [ax] \
|
---|
111 | modify exact [ax] nomemory;
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | #undef ASMGetDS
|
---|
115 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
116 | #pragma aux ASMGetDS = \
|
---|
117 | "mov ax, ds" \
|
---|
118 | parm [] nomemory \
|
---|
119 | value [ax] \
|
---|
120 | modify exact [ax] nomemory;
|
---|
121 | #endif
|
---|
122 |
|
---|
123 | #undef ASMGetES
|
---|
124 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
125 | #pragma aux ASMGetES = \
|
---|
126 | "mov ax, es" \
|
---|
127 | parm [] nomemory \
|
---|
128 | value [ax] \
|
---|
129 | modify exact [ax] nomemory;
|
---|
130 | #endif
|
---|
131 |
|
---|
132 | #undef ASMGetFS
|
---|
133 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
134 | #pragma aux ASMGetFS = \
|
---|
135 | ".386" \
|
---|
136 | "mov ax, fs" \
|
---|
137 | parm [] nomemory \
|
---|
138 | value [ax] \
|
---|
139 | modify exact [ax] nomemory;
|
---|
140 | #endif
|
---|
141 |
|
---|
142 | #undef ASMGetGS
|
---|
143 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
144 | #pragma aux ASMGetGS = \
|
---|
145 | ".386" \
|
---|
146 | "mov ax, gs" \
|
---|
147 | parm [] nomemory \
|
---|
148 | value [ax] \
|
---|
149 | modify exact [ax] nomemory;
|
---|
150 | #endif
|
---|
151 |
|
---|
152 | #undef ASMGetSS
|
---|
153 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
154 | #pragma aux ASMGetSS = \
|
---|
155 | "mov ax, ss" \
|
---|
156 | parm [] nomemory \
|
---|
157 | value [ax] \
|
---|
158 | modify exact [ax] nomemory;
|
---|
159 | #endif
|
---|
160 |
|
---|
161 | #undef ASMGetTR
|
---|
162 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
163 | #pragma aux ASMGetTR = \
|
---|
164 | ".286" \
|
---|
165 | "str ax" \
|
---|
166 | parm [] nomemory \
|
---|
167 | value [ax] \
|
---|
168 | modify exact [ax] nomemory;
|
---|
169 | #endif
|
---|
170 |
|
---|
171 | #undef ASMGetLDTR
|
---|
172 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
173 | #pragma aux ASMGetLDTR = \
|
---|
174 | ".286" \
|
---|
175 | "sldt ax" \
|
---|
176 | parm [] nomemory \
|
---|
177 | value [ax] \
|
---|
178 | modify exact [ax] nomemory;
|
---|
179 | #endif
|
---|
180 |
|
---|
181 | /** @todo ASMGetSegAttr */
|
---|
182 |
|
---|
183 | #undef ASMGetFlags
|
---|
184 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
185 | #pragma aux ASMGetFlags = \
|
---|
186 | "pushf" \
|
---|
187 | "pop ax" \
|
---|
188 | parm [] nomemory \
|
---|
189 | value [ax] \
|
---|
190 | modify exact [ax] nomemory;
|
---|
191 | #endif
|
---|
192 |
|
---|
193 | #undef ASMSetFlags
|
---|
194 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
195 | #pragma aux ASMSetFlags = \
|
---|
196 | "push ax" \
|
---|
197 | "popf" \
|
---|
198 | parm [ax] nomemory \
|
---|
199 | modify exact [] nomemory;
|
---|
200 | #endif
|
---|
201 |
|
---|
202 | #undef ASMChangeFlags
|
---|
203 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
204 | #pragma aux ASMChangeFlags = \
|
---|
205 | "pushf" \
|
---|
206 | "pop ax" \
|
---|
207 | "and dx, ax" \
|
---|
208 | "or dx, cx" \
|
---|
209 | "push dx" \
|
---|
210 | "popf" \
|
---|
211 | parm [dx] [cx] nomemory \
|
---|
212 | value [ax] \
|
---|
213 | modify exact [dx] nomemory;
|
---|
214 | #endif
|
---|
215 |
|
---|
216 | #undef ASMAddFlags
|
---|
217 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
218 | #pragma aux ASMAddFlags = \
|
---|
219 | "pushf" \
|
---|
220 | "pop ax" \
|
---|
221 | "or dx, ax" \
|
---|
222 | "push dx" \
|
---|
223 | "popf" \
|
---|
224 | parm [dx] nomemory \
|
---|
225 | value [ax] \
|
---|
226 | modify exact [dx] nomemory;
|
---|
227 | #endif
|
---|
228 |
|
---|
229 | #undef ASMClearFlags
|
---|
230 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
231 | #pragma aux ASMClearFlags = \
|
---|
232 | "pushf" \
|
---|
233 | "pop ax" \
|
---|
234 | "and dx, ax" \
|
---|
235 | "push dx" \
|
---|
236 | "popf" \
|
---|
237 | parm [dx] nomemory \
|
---|
238 | value [ax] \
|
---|
239 | modify exact [dx] nomemory;
|
---|
240 | #endif
|
---|
241 |
|
---|
242 | /* Note! Must use the 64-bit integer return value convension.
|
---|
243 | The order of registers in the value [set] does not seem to mean anything. */
|
---|
244 | #undef ASMReadTSC
|
---|
245 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
246 | #pragma aux ASMReadTSC = \
|
---|
247 | ".586" \
|
---|
248 | "rdtsc" \
|
---|
249 | "mov ebx, edx" \
|
---|
250 | "mov ecx, eax" \
|
---|
251 | "shr ecx, 16" \
|
---|
252 | "xchg eax, edx" \
|
---|
253 | "shr eax, 16" \
|
---|
254 | parm [] nomemory \
|
---|
255 | value [dx cx bx ax] \
|
---|
256 | modify exact [ax bx cx dx] nomemory;
|
---|
257 | #endif
|
---|
258 |
|
---|
259 | /** @todo ASMReadTscWithAux if needed (rdtscp not recognized by compiler) */
|
---|
260 |
|
---|
261 |
|
---|
262 | /* ASMCpuId: Implemented externally, too many parameters. */
|
---|
263 | /* ASMCpuId_Idx_ECX: Implemented externally, too many parameters. */
|
---|
264 | /* ASMCpuIdExSlow: Always implemented externally. */
|
---|
265 | /* ASMCpuId_ECX_EDX: Implemented externally, too many parameters. */
|
---|
266 |
|
---|
267 | #undef ASMCpuId_EAX
|
---|
268 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
269 | #pragma aux ASMCpuId_EAX = \
|
---|
270 | ".586" \
|
---|
271 | "xchg ax, dx" \
|
---|
272 | "shl eax, 16" \
|
---|
273 | "mov ax, dx" \
|
---|
274 | "cpuid" \
|
---|
275 | "mov edx, eax" \
|
---|
276 | "shr edx, 16" \
|
---|
277 | parm [ax dx] \
|
---|
278 | value [ax dx] \
|
---|
279 | modify exact [ax bx cx dx];
|
---|
280 | #endif
|
---|
281 |
|
---|
282 | #undef ASMCpuId_EBX
|
---|
283 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
284 | #pragma aux ASMCpuId_EBX = \
|
---|
285 | ".586" \
|
---|
286 | "xchg ax, dx" \
|
---|
287 | "shl eax, 16" \
|
---|
288 | "mov ax, dx" \
|
---|
289 | "cpuid" \
|
---|
290 | "mov ax, bx" \
|
---|
291 | "shr ebx, 16" \
|
---|
292 | parm [ax dx] \
|
---|
293 | value [ax bx] \
|
---|
294 | modify exact [ax bx cx dx];
|
---|
295 | #endif
|
---|
296 |
|
---|
297 | #undef ASMCpuId_ECX
|
---|
298 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
299 | #pragma aux ASMCpuId_ECX = \
|
---|
300 | ".586" \
|
---|
301 | "xchg ax, dx" \
|
---|
302 | "shl eax, 16" \
|
---|
303 | "mov ax, dx" \
|
---|
304 | "cpuid" \
|
---|
305 | "mov ax, cx" \
|
---|
306 | "shr ecx, 16" \
|
---|
307 | parm [ax dx] \
|
---|
308 | value [ax cx] \
|
---|
309 | modify exact [ax bx cx dx];
|
---|
310 | #endif
|
---|
311 |
|
---|
312 | #undef ASMCpuId_EDX
|
---|
313 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
314 | #pragma aux ASMCpuId_EDX = \
|
---|
315 | ".586" \
|
---|
316 | "xchg ax, dx" \
|
---|
317 | "shl eax, 16" \
|
---|
318 | "mov ax, dx" \
|
---|
319 | "cpuid" \
|
---|
320 | "mov ax, dx" \
|
---|
321 | "shr edx, 16" \
|
---|
322 | parm [ax dx] \
|
---|
323 | value [ax dx] \
|
---|
324 | modify exact [ax bx cx dx];
|
---|
325 | #endif
|
---|
326 |
|
---|
327 | /* ASMHasCpuId: MSC inline in main source file. */
|
---|
328 | /* ASMGetApicId: Implemented externally, lazy bird. */
|
---|
329 |
|
---|
330 | /* Note! Again, when returning two registers, watcom have certain fixed ordering rules (low:high):
|
---|
331 | ax:bx, ax:cx, ax:dx, ax:si, ax:di
|
---|
332 | bx:cx, bx:dx, bx:si, bx:di
|
---|
333 | dx:cx, si:cx, di:cx
|
---|
334 | si:dx, di:dx
|
---|
335 | si:di
|
---|
336 | This ordering seems to apply to parameter values too. */
|
---|
337 | #undef ASMGetCR0
|
---|
338 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
339 | #pragma aux ASMGetCR0 = \
|
---|
340 | ".386" \
|
---|
341 | "mov eax, cr0" \
|
---|
342 | "mov edx, eax" \
|
---|
343 | "shr edx, 16" \
|
---|
344 | parm [] nomemory \
|
---|
345 | value [ax dx] \
|
---|
346 | modify exact [ax dx] nomemory;
|
---|
347 | #endif
|
---|
348 |
|
---|
349 | #undef ASMSetCR0
|
---|
350 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
351 | #pragma aux ASMSetCR0 = \
|
---|
352 | ".386" \
|
---|
353 | "shl edx, 16" \
|
---|
354 | "mov dx, ax" \
|
---|
355 | "mov cr0, edx" \
|
---|
356 | parm [ax dx] nomemory \
|
---|
357 | modify exact [dx] nomemory;
|
---|
358 | #endif
|
---|
359 |
|
---|
360 | #undef ASMGetCR2
|
---|
361 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
362 | #pragma aux ASMGetCR2 = \
|
---|
363 | ".386" \
|
---|
364 | "mov eax, cr2" \
|
---|
365 | "mov edx, eax" \
|
---|
366 | "shr edx, 16" \
|
---|
367 | parm [] nomemory \
|
---|
368 | value [ax dx] \
|
---|
369 | modify exact [ax dx] nomemory;
|
---|
370 | #endif
|
---|
371 |
|
---|
372 | #undef ASMSetCR2
|
---|
373 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
374 | #pragma aux ASMSetCR2 = \
|
---|
375 | ".386" \
|
---|
376 | "shl edx, 16" \
|
---|
377 | "mov dx, ax" \
|
---|
378 | "mov cr2, edx" \
|
---|
379 | parm [ax dx] nomemory \
|
---|
380 | modify exact [dx] nomemory;
|
---|
381 | #endif
|
---|
382 |
|
---|
383 | #undef ASMGetCR3
|
---|
384 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
385 | #pragma aux ASMGetCR3 = \
|
---|
386 | ".386" \
|
---|
387 | "mov eax, cr3" \
|
---|
388 | "mov edx, eax" \
|
---|
389 | "shr edx, 16" \
|
---|
390 | parm [] nomemory \
|
---|
391 | value [ax dx] \
|
---|
392 | modify exact [ax dx] nomemory;
|
---|
393 | #endif
|
---|
394 |
|
---|
395 | #undef ASMSetCR3
|
---|
396 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
397 | #pragma aux ASMSetCR3 = \
|
---|
398 | ".386" \
|
---|
399 | "shl edx, 16" \
|
---|
400 | "mov dx, ax" \
|
---|
401 | "mov cr3, edx" \
|
---|
402 | parm [ax dx] nomemory \
|
---|
403 | modify exact [dx] nomemory;
|
---|
404 | #endif
|
---|
405 |
|
---|
406 | #undef ASMReloadCR3
|
---|
407 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
408 | #pragma aux ASMReloadCR3 = \
|
---|
409 | ".386" \
|
---|
410 | "mov eax, cr3" \
|
---|
411 | "mov cr3, eax" \
|
---|
412 | parm [] nomemory \
|
---|
413 | modify exact [ax] nomemory;
|
---|
414 | #endif
|
---|
415 |
|
---|
416 | #undef ASMGetCR4
|
---|
417 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
418 | #pragma aux ASMGetCR4 = \
|
---|
419 | ".386" \
|
---|
420 | "mov eax, cr4" \
|
---|
421 | "mov edx, eax" \
|
---|
422 | "shr edx, 16" \
|
---|
423 | parm [] nomemory \
|
---|
424 | value [ax dx] \
|
---|
425 | modify exact [ax dx] nomemory;
|
---|
426 | #endif
|
---|
427 |
|
---|
428 | #undef ASMSetCR4
|
---|
429 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
430 | #pragma aux ASMSetCR4 = \
|
---|
431 | ".386" \
|
---|
432 | "shl edx, 16" \
|
---|
433 | "mov dx, ax" \
|
---|
434 | "mov cr4, edx" \
|
---|
435 | parm [ax dx] nomemory \
|
---|
436 | modify exact [dx] nomemory;
|
---|
437 | #endif
|
---|
438 |
|
---|
439 | /* ASMGetCR8: Don't bother for 16-bit. */
|
---|
440 | /* ASMSetCR8: Don't bother for 16-bit. */
|
---|
441 |
|
---|
442 | #undef ASMIntEnable
|
---|
443 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
444 | #pragma aux ASMIntEnable = \
|
---|
445 | "sti" \
|
---|
446 | parm [] nomemory \
|
---|
447 | modify exact [] nomemory;
|
---|
448 | #endif
|
---|
449 |
|
---|
450 | #undef ASMIntDisable
|
---|
451 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
452 | #pragma aux ASMIntDisable = \
|
---|
453 | "cli" \
|
---|
454 | parm [] nomemory \
|
---|
455 | modify exact [] nomemory;
|
---|
456 | #endif
|
---|
457 |
|
---|
458 | #undef ASMIntDisableFlags
|
---|
459 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
460 | #pragma aux ASMIntDisableFlags = \
|
---|
461 | "pushf" \
|
---|
462 | "cli" \
|
---|
463 | "pop ax" \
|
---|
464 | parm [] nomemory \
|
---|
465 | value [ax] \
|
---|
466 | modify exact [] nomemory;
|
---|
467 | #endif
|
---|
468 |
|
---|
469 | #undef ASMHalt
|
---|
470 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
471 | #pragma aux ASMHalt = \
|
---|
472 | "hlt" \
|
---|
473 | parm [] nomemory \
|
---|
474 | modify exact [] nomemory;
|
---|
475 | #endif
|
---|
476 |
|
---|
477 | #undef ASMRdMsr
|
---|
478 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
479 | #pragma aux ASMRdMsr = \
|
---|
480 | ".586" \
|
---|
481 | "shl ecx, 16" \
|
---|
482 | "mov cx, ax" \
|
---|
483 | "rdmsr" \
|
---|
484 | "mov ebx, edx" \
|
---|
485 | "mov ecx, eax" \
|
---|
486 | "shr ecx, 16" \
|
---|
487 | "xchg eax, edx" \
|
---|
488 | "shr eax, 16" \
|
---|
489 | parm [ax cx] nomemory \
|
---|
490 | value [dx cx bx ax] \
|
---|
491 | modify exact [ax bx cx dx] nomemory;
|
---|
492 | #endif
|
---|
493 |
|
---|
494 | /* ASMWrMsr: Implemented externally, lazy bird. */
|
---|
495 | /* ASMRdMsrEx: Implemented externally, lazy bird. */
|
---|
496 | /* ASMWrMsrEx: Implemented externally, lazy bird. */
|
---|
497 |
|
---|
498 | #undef ASMRdMsr_Low
|
---|
499 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
500 | #pragma aux ASMRdMsr_Low = \
|
---|
501 | ".586" \
|
---|
502 | "shl ecx, 16" \
|
---|
503 | "mov cx, ax" \
|
---|
504 | "rdmsr" \
|
---|
505 | "mov edx, eax" \
|
---|
506 | "shr edx, 16" \
|
---|
507 | parm [ax cx] nomemory \
|
---|
508 | value [ax dx] \
|
---|
509 | modify exact [ax bx cx dx] nomemory;
|
---|
510 | #endif
|
---|
511 |
|
---|
512 | #undef ASMRdMsr_High
|
---|
513 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
514 | #pragma aux ASMRdMsr_High = \
|
---|
515 | ".586" \
|
---|
516 | "shl ecx, 16" \
|
---|
517 | "mov cx, ax" \
|
---|
518 | "rdmsr" \
|
---|
519 | "mov eax, edx" \
|
---|
520 | "shr edx, 16" \
|
---|
521 | parm [ax cx] nomemory \
|
---|
522 | value [ax dx] \
|
---|
523 | modify exact [ax bx cx dx] nomemory;
|
---|
524 | #endif
|
---|
525 |
|
---|
526 |
|
---|
527 | #undef ASMGetDR0
|
---|
528 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
529 | #pragma aux ASMGetDR0 = \
|
---|
530 | ".386" \
|
---|
531 | "mov eax, dr0" \
|
---|
532 | "mov edx, eax" \
|
---|
533 | "shr edx, 16" \
|
---|
534 | parm [] nomemory \
|
---|
535 | value [ax dx] \
|
---|
536 | modify exact [ax dx] nomemory;
|
---|
537 | #endif
|
---|
538 |
|
---|
539 | #undef ASMGetDR1
|
---|
540 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
541 | #pragma aux ASMGetDR1 = \
|
---|
542 | ".386" \
|
---|
543 | "mov eax, dr1" \
|
---|
544 | "mov edx, eax" \
|
---|
545 | "shr edx, 16" \
|
---|
546 | parm [] nomemory \
|
---|
547 | value [ax dx] \
|
---|
548 | modify exact [ax dx] nomemory;
|
---|
549 | #endif
|
---|
550 |
|
---|
551 | #undef ASMGetDR2
|
---|
552 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
553 | #pragma aux ASMGetDR2 = \
|
---|
554 | ".386" \
|
---|
555 | "mov eax, dr2" \
|
---|
556 | "mov edx, eax" \
|
---|
557 | "shr edx, 16" \
|
---|
558 | parm [] nomemory \
|
---|
559 | value [ax dx] \
|
---|
560 | modify exact [ax dx] nomemory;
|
---|
561 | #endif
|
---|
562 |
|
---|
563 | #undef ASMGetDR3
|
---|
564 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
565 | #pragma aux ASMGetDR3 = \
|
---|
566 | ".386" \
|
---|
567 | "mov eax, dr3" \
|
---|
568 | "mov edx, eax" \
|
---|
569 | "shr edx, 16" \
|
---|
570 | parm [] nomemory \
|
---|
571 | value [ax dx] \
|
---|
572 | modify exact [ax dx] nomemory;
|
---|
573 | #endif
|
---|
574 |
|
---|
575 | #undef ASMGetDR6
|
---|
576 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
577 | #pragma aux ASMGetDR6 = \
|
---|
578 | ".386" \
|
---|
579 | "mov eax, dr6" \
|
---|
580 | "mov edx, eax" \
|
---|
581 | "shr edx, 16" \
|
---|
582 | parm [] nomemory \
|
---|
583 | value [ax dx] \
|
---|
584 | modify exact [ax dx] nomemory;
|
---|
585 | #endif
|
---|
586 |
|
---|
587 | #undef ASMGetAndClearDR6
|
---|
588 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
589 | #pragma aux ASMGetAndClearDR6 = \
|
---|
590 | ".386" \
|
---|
591 | "mov edx, 0ffff0ff0h" \
|
---|
592 | "mov eax, dr6" \
|
---|
593 | "mov dr6, edx" \
|
---|
594 | "mov edx, eax" \
|
---|
595 | "shr edx, 16" \
|
---|
596 | parm [] nomemory \
|
---|
597 | value [ax dx] \
|
---|
598 | modify exact [ax dx] nomemory;
|
---|
599 | #endif
|
---|
600 |
|
---|
601 | #undef ASMGetDR7
|
---|
602 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
603 | #pragma aux ASMGetDR7 = \
|
---|
604 | ".386" \
|
---|
605 | "mov eax, dr7" \
|
---|
606 | "mov edx, eax" \
|
---|
607 | "shr edx, 16" \
|
---|
608 | parm [] nomemory \
|
---|
609 | value [ax dx] \
|
---|
610 | modify exact [ax dx] nomemory;
|
---|
611 | #endif
|
---|
612 |
|
---|
613 | #undef ASMSetDR0
|
---|
614 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
615 | #pragma aux ASMSetDR0 = \
|
---|
616 | ".386" \
|
---|
617 | "shl edx, 16" \
|
---|
618 | "mov dx, ax" \
|
---|
619 | "mov dr0, edx" \
|
---|
620 | parm [ax dx] nomemory \
|
---|
621 | modify exact [dx] nomemory;
|
---|
622 | #endif
|
---|
623 |
|
---|
624 | #undef ASMSetDR1
|
---|
625 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
626 | #pragma aux ASMSetDR1 = \
|
---|
627 | ".386" \
|
---|
628 | "shl edx, 16" \
|
---|
629 | "mov dx, ax" \
|
---|
630 | "mov dr1, edx" \
|
---|
631 | parm [ax dx] nomemory \
|
---|
632 | modify exact [dx] nomemory;
|
---|
633 | #endif
|
---|
634 |
|
---|
635 | #undef ASMSetDR2
|
---|
636 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
637 | #pragma aux ASMSetDR2 = \
|
---|
638 | ".386" \
|
---|
639 | "shl edx, 16" \
|
---|
640 | "mov dx, ax" \
|
---|
641 | "mov dr2, edx" \
|
---|
642 | parm [ax dx] nomemory \
|
---|
643 | modify exact [dx] nomemory;
|
---|
644 | #endif
|
---|
645 |
|
---|
646 | #undef ASMSetDR3
|
---|
647 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
648 | #pragma aux ASMSetDR3 = \
|
---|
649 | ".386" \
|
---|
650 | "shl edx, 16" \
|
---|
651 | "mov dx, ax" \
|
---|
652 | "mov dr3, edx" \
|
---|
653 | parm [ax dx] nomemory \
|
---|
654 | modify exact [dx] nomemory;
|
---|
655 | #endif
|
---|
656 |
|
---|
657 | #undef ASMSetDR6
|
---|
658 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
659 | #pragma aux ASMSetDR6 = \
|
---|
660 | ".386" \
|
---|
661 | "shl edx, 16" \
|
---|
662 | "mov dx, ax" \
|
---|
663 | "mov dr6, edx" \
|
---|
664 | parm [ax dx] nomemory \
|
---|
665 | modify exact [dx] nomemory;
|
---|
666 | #endif
|
---|
667 |
|
---|
668 | #undef ASMSetDR7
|
---|
669 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
670 | #pragma aux ASMSetDR7 = \
|
---|
671 | ".386" \
|
---|
672 | "shl edx, 16" \
|
---|
673 | "mov dx, ax" \
|
---|
674 | "mov dr7, edx" \
|
---|
675 | parm [ax dx] nomemory \
|
---|
676 | modify exact [dx] nomemory;
|
---|
677 | #endif
|
---|
678 |
|
---|
679 | /* Yeah, could've used outp here, but this keeps the main file simpler. */
|
---|
680 | #undef ASMOutU8
|
---|
681 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
682 | #pragma aux ASMOutU8 = \
|
---|
683 | "out dx, al" \
|
---|
684 | parm [dx] [al] nomemory \
|
---|
685 | modify exact [] nomemory;
|
---|
686 | #endif
|
---|
687 |
|
---|
688 | #undef ASMInU8
|
---|
689 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
690 | #pragma aux ASMInU8 = \
|
---|
691 | "in al, dx" \
|
---|
692 | parm [dx] nomemory \
|
---|
693 | value [al] \
|
---|
694 | modify exact [] nomemory;
|
---|
695 | #endif
|
---|
696 |
|
---|
697 | #undef ASMOutU16
|
---|
698 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
699 | #pragma aux ASMOutU16 = \
|
---|
700 | "out dx, ax" \
|
---|
701 | parm [dx] [ax] nomemory \
|
---|
702 | modify exact [] nomemory;
|
---|
703 | #endif
|
---|
704 |
|
---|
705 | #undef ASMInU16
|
---|
706 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
707 | #pragma aux ASMInU16 = \
|
---|
708 | "in ax, dx" \
|
---|
709 | parm [dx] nomemory \
|
---|
710 | value [ax] \
|
---|
711 | modify exact [] nomemory;
|
---|
712 | #endif
|
---|
713 |
|
---|
714 | #undef ASMOutU32
|
---|
715 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
716 | #pragma aux ASMOutU32 = \
|
---|
717 | ".386" \
|
---|
718 | "shl ecx, 16" \
|
---|
719 | "mov cx, ax" \
|
---|
720 | "mov eax, ecx" \
|
---|
721 | "out dx, eax" \
|
---|
722 | parm [dx] [ax cx] nomemory \
|
---|
723 | modify exact [] nomemory;
|
---|
724 | #endif
|
---|
725 |
|
---|
726 | #undef ASMInU32
|
---|
727 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
728 | #pragma aux ASMInU32 = \
|
---|
729 | ".386" \
|
---|
730 | "in eax, dx" \
|
---|
731 | "mov ecx, eax" \
|
---|
732 | "shr ecx, 16" \
|
---|
733 | parm [dx] nomemory \
|
---|
734 | value [ax cx] \
|
---|
735 | modify exact [] nomemory;
|
---|
736 | #endif
|
---|
737 |
|
---|
738 | #undef ASMOutStrU8
|
---|
739 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
740 | #pragma aux ASMOutStrU8 = \
|
---|
741 | ".186" \
|
---|
742 | "mov ax, ds" \
|
---|
743 | "mov ds, di" \
|
---|
744 | "rep outsb" \
|
---|
745 | "mov ds, ax" \
|
---|
746 | parm [dx] [si di] [cx] nomemory \
|
---|
747 | modify exact [si cx ax] nomemory;
|
---|
748 | #endif
|
---|
749 |
|
---|
750 | #undef ASMInStrU8
|
---|
751 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
752 | #pragma aux ASMInStrU8 = \
|
---|
753 | ".186" \
|
---|
754 | "rep insb" \
|
---|
755 | parm [dx] [di es] [cx] \
|
---|
756 | modify exact [di cx];
|
---|
757 | #endif
|
---|
758 |
|
---|
759 | #undef ASMOutStrU16
|
---|
760 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
761 | #pragma aux ASMOutStrU16 = \
|
---|
762 | ".186" \
|
---|
763 | "mov ax, ds" \
|
---|
764 | "mov ds, di" \
|
---|
765 | "rep outsw" \
|
---|
766 | "mov ds, ax" \
|
---|
767 | parm [dx] [si di] [cx] nomemory \
|
---|
768 | modify exact [si cx ax] nomemory;
|
---|
769 | #endif
|
---|
770 |
|
---|
771 | #undef ASMInStrU16
|
---|
772 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
773 | #pragma aux ASMInStrU16 = \
|
---|
774 | ".186" \
|
---|
775 | "rep insw" \
|
---|
776 | parm [dx] [di es] [cx] \
|
---|
777 | modify exact [di cx];
|
---|
778 | #endif
|
---|
779 |
|
---|
780 | #undef ASMOutStrU32
|
---|
781 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
782 | #pragma aux ASMOutStrU32 = \
|
---|
783 | ".386" \
|
---|
784 | "mov ax, ds" \
|
---|
785 | "mov ds, di" \
|
---|
786 | "rep outsd" \
|
---|
787 | "mov ds, ax" \
|
---|
788 | parm [dx] [si di] [cx] nomemory \
|
---|
789 | modify exact [si cx ax] nomemory;
|
---|
790 | #endif
|
---|
791 |
|
---|
792 | #undef ASMInStrU32
|
---|
793 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
794 | #pragma aux ASMInStrU32 = \
|
---|
795 | ".386" \
|
---|
796 | "rep insd" \
|
---|
797 | parm [dx] [es di] [cx] \
|
---|
798 | modify exact [di cx];
|
---|
799 | #endif
|
---|
800 |
|
---|
801 | #undef ASMInvalidatePage
|
---|
802 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
803 | #pragma aux ASMInvalidatePage = \
|
---|
804 | ".486" \
|
---|
805 | "shl edx, 16" \
|
---|
806 | "mov dx, ax" \
|
---|
807 | "invlpg [edx]" \
|
---|
808 | parm [ax dx] \
|
---|
809 | modify exact [dx];
|
---|
810 | #endif
|
---|
811 |
|
---|
812 | #undef ASMWriteBackAndInvalidateCaches
|
---|
813 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
814 | #pragma aux ASMWriteBackAndInvalidateCaches = \
|
---|
815 | ".486" \
|
---|
816 | "wbinvd" \
|
---|
817 | parm [] nomemory \
|
---|
818 | modify exact [] nomemory;
|
---|
819 | #endif
|
---|
820 |
|
---|
821 | #undef ASMInvalidateInternalCaches
|
---|
822 | #ifdef IPRT_ASM_AMD64_X86_WATCOM_16_INSTANTIATE
|
---|
823 | #pragma aux ASMInvalidateInternalCaches = \
|
---|
824 | ".486" \
|
---|
825 | "invd" \
|
---|
826 | parm [] \
|
---|
827 | modify exact [];
|
---|
828 | #endif
|
---|
829 |
|
---|
830 | #endif /* !IPRT_INCLUDED_asm_amd64_x86_watcom_16_h */
|
---|
831 |
|
---|