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