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