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