VirtualBox

source: vbox/trunk/include/iprt/asm-watcom-x86-32.h@ 77807

Last change on this file since 77807 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 17.1 KB
RevLine 
[58708]1/** @file
[58709]2 * IPRT - Assembly Functions, x86 32-bit Watcom C/C++ pragma aux.
[58708]3 */
4
5/*
[76553]6 * Copyright (C) 2006-2019 Oracle Corporation
[58708]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
[76557]26#ifndef IPRT_INCLUDED_asm_watcom_x86_32_h
27#define IPRT_INCLUDED_asm_watcom_x86_32_h
[76512]28/* no pragma once */
[76505]29
[76557]30#ifndef IPRT_INCLUDED_asm_h
[58708]31# error "Don't include this header directly."
32#endif
33
[58709]34#ifndef __FLAT__
35# error "Only works with flat pointers! (-mf)"
[58708]36#endif
37
38/*
[58749]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
[75131]42 * the watcom header at both the top and the bottom of asm.h file.
[58708]43 */
44
[58749]45#undef ASMCompilerBarrier
[75131]46#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
47# if 0 /* overkill version. */
48# pragma aux ASMCompilerBarrier = \
[58708]49 "nop" \
50 parm [] \
[58709]51 modify exact [eax ebx ecx edx es ds fs gs];
[75131]52# else
53# pragma aux ASMCompilerBarrier = \
[58708]54 "" \
55 parm [] \
56 modify exact [];
[75131]57# endif
[58708]58#endif
59
[58749]60#undef ASMNopPause
[75131]61#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]62#pragma aux ASMNopPause = \
63 ".686p" \
64 ".xmm2" \
65 "pause" \
66 parm [] nomemory \
67 modify exact [] nomemory;
[75131]68#endif
[58708]69
[58749]70#undef ASMAtomicXchgU8
[75131]71#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]72#pragma aux ASMAtomicXchgU8 = \
[58709]73 "xchg [ecx], al" \
74 parm [ecx] [al] \
[58708]75 value [al] \
76 modify exact [al];
[75131]77#endif
[58708]78
[58749]79#undef ASMAtomicXchgU16
[75131]80#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]81#pragma aux ASMAtomicXchgU16 = \
[58709]82 "xchg [ecx], ax" \
83 parm [ecx] [ax] \
[58708]84 value [ax] \
85 modify exact [ax];
[75131]86#endif
[58708]87
[58749]88#undef ASMAtomicXchgU32
[75131]89#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]90#pragma aux ASMAtomicXchgU32 = \
[58709]91 "xchg [ecx], eax" \
92 parm [ecx] [eax] \
93 value [eax] \
94 modify exact [eax];
[75131]95#endif
[58708]96
[58749]97#undef ASMAtomicXchgU64
[75131]98#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]99#pragma aux ASMAtomicXchgU64 = \
100 ".586" \
101 "try_again:" \
[58709]102 "lock cmpxchg8b [esi]" \
[58708]103 "jnz try_again" \
[58709]104 parm [esi] [ebx ecx] \
105 value [eax edx] \
106 modify exact [edx ecx ebx eax];
[75131]107#endif
[58708]108
[58749]109#undef ASMAtomicCmpXchgU8
[75131]110#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]111#pragma aux ASMAtomicCmpXchgU8 = \
112 ".486" \
[58709]113 "lock cmpxchg [edx], cl" \
[58708]114 "setz al" \
[58709]115 parm [edx] [cl] [al] \
[58708]116 value [al] \
117 modify exact [al];
[75131]118#endif
[58708]119
[58749]120#undef ASMAtomicCmpXchgU16
[75131]121#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]122#pragma aux ASMAtomicCmpXchgU16 = \
123 ".486" \
[58709]124 "lock cmpxchg [edx], cx" \
[58708]125 "setz al" \
[58709]126 parm [edx] [cx] [ax] \
[58708]127 value [al] \
128 modify exact [ax];
[75131]129#endif
[58708]130
[58749]131#undef ASMAtomicCmpXchgU32
[75131]132#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]133#pragma aux ASMAtomicCmpXchgU32 = \
134 ".486" \
[58709]135 "lock cmpxchg [edx], ecx" \
[58708]136 "setz al" \
[58709]137 parm [edx] [ecx] [eax] \
[58708]138 value [al] \
[58709]139 modify exact [eax];
[75131]140#endif
[58708]141
[58749]142#undef ASMAtomicCmpXchgU64
[75131]143#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58709]144#pragma aux ASMAtomicCmpXchgU64 = \
145 ".586" \
146 "lock cmpxchg8b [edi]" \
147 "setz al" \
148 parm [edi] [ebx ecx] [eax edx] \
149 value [al] \
150 modify exact [eax edx];
[75131]151#endif
[58708]152
[58749]153#undef ASMAtomicCmpXchgExU32
[75131]154#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58709]155#pragma aux ASMAtomicCmpXchgExU32 = \
156 ".586" \
157 "lock cmpxchg [edx], ecx" \
158 "mov [edi], eax" \
159 "setz al" \
160 parm [edx] [ecx] [eax] [edi] \
161 value [al] \
162 modify exact [eax];
[75131]163#endif
[58709]164
[58749]165#undef ASMAtomicCmpXchgExU64
[75131]166#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58709]167#pragma aux ASMAtomicCmpXchgExU64 = \
168 ".586" \
169 "lock cmpxchg8b [edi]" \
170 "mov [esi], eax" \
171 "mov [esi + 4], edx" \
172 "setz al" \
173 parm [edi] [ebx ecx] [eax edx] [esi] \
174 value [al] \
175 modify exact [eax edx];
[75131]176#endif
[58709]177
[59527]178#undef ASMSerializeInstructionCpuId
[75131]179#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[59527]180#pragma aux ASMSerializeInstructionCpuId = \
[58708]181 ".586" \
182 "xor eax, eax" \
183 "cpuid" \
184 parm [] \
[58709]185 modify exact [eax ebx ecx edx];
[75131]186#endif
[58708]187
[59527]188#undef ASMSerializeInstructionIRet
[75131]189#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[59527]190#pragma aux ASMSerializeInstructionIRet = \
191 "pushf" \
192 "push cs" \
193 "call foo" /* 'push offset done' doesn't work */ \
194 "jmp done" \
195 "foo:" \
196 "iret" \
197 "done:" \
198 parm [] \
199 modify exact [];
[75131]200#endif
[59527]201
202#undef ASMSerializeInstructionRdTscp
[75131]203#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[59527]204#pragma aux ASMSerializeInstructionRdTscp = \
205 0x0f 0x01 0xf9 \
206 parm [] \
207 modify exact [eax edx ecx];
[75131]208#endif
[59527]209
[58749]210#undef ASMAtomicReadU64
[75131]211#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]212#pragma aux ASMAtomicReadU64 = \
213 ".586" \
214 "xor eax, eax" \
[58709]215 "mov edx, eax" \
216 "mov ebx, eax" \
217 "mov ecx, eax" \
218 "lock cmpxchg8b [edi]" \
219 parm [edi] \
220 value [eax edx] \
221 modify exact [eax ebx ecx edx];
[75131]222#endif
[58708]223
[58749]224#undef ASMAtomicUoReadU64
[75131]225#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]226#pragma aux ASMAtomicUoReadU64 = \
227 ".586" \
228 "xor eax, eax" \
[58709]229 "mov edx, eax" \
230 "mov ebx, eax" \
231 "mov ecx, eax" \
232 "lock cmpxchg8b [edi]" \
233 parm [edi] \
234 value [eax edx] \
235 modify exact [eax ebx ecx edx];
[75131]236#endif
[58708]237
[58749]238#undef ASMAtomicAddU16
[75131]239#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]240#pragma aux ASMAtomicAddU16 = \
241 ".486" \
[58709]242 "lock xadd [ecx], ax" \
243 parm [ecx] [ax] \
[58708]244 value [ax] \
245 modify exact [ax];
[75131]246#endif
[58708]247
[58749]248#undef ASMAtomicAddU32
[75131]249#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]250#pragma aux ASMAtomicAddU32 = \
251 ".486" \
[58709]252 "lock xadd [ecx], eax" \
253 parm [ecx] [eax] \
254 value [eax] \
255 modify exact [eax];
[75131]256#endif
[58708]257
[58749]258#undef ASMAtomicIncU16
[75131]259#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]260#pragma aux ASMAtomicIncU16 = \
261 ".486" \
262 "mov ax, 1" \
[58709]263 "lock xadd [ecx], ax" \
[58708]264 "inc ax" \
[58709]265 parm [ecx] \
[58708]266 value [ax] \
267 modify exact [ax];
[75131]268#endif
[58708]269
[58749]270#undef ASMAtomicIncU32
[75131]271#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]272#pragma aux ASMAtomicIncU32 = \
273 ".486" \
[58709]274 "mov eax, 1" \
275 "lock xadd [ecx], eax" \
276 "inc eax" \
277 parm [ecx] \
278 value [eax] \
279 modify exact [eax];
[75131]280#endif
[58708]281
282/* ASMAtomicIncU64: Should be done by C inline or in external file. */
283
[58749]284#undef ASMAtomicDecU16
[75131]285#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]286#pragma aux ASMAtomicDecU16 = \
287 ".486" \
288 "mov ax, 0ffffh" \
[58709]289 "lock xadd [ecx], ax" \
[58708]290 "dec ax" \
[58709]291 parm [ecx] \
[58708]292 value [ax] \
293 modify exact [ax];
[75131]294#endif
[58708]295
[58749]296#undef ASMAtomicDecU32
[75131]297#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]298#pragma aux ASMAtomicDecU32 = \
299 ".486" \
[58709]300 "mov eax, 0ffffffffh" \
301 "lock xadd [ecx], eax" \
302 "dec eax" \
303 parm [ecx] \
304 value [eax] \
305 modify exact [eax];
[75131]306#endif
[58708]307
308/* ASMAtomicDecU64: Should be done by C inline or in external file. */
309
[58749]310#undef ASMAtomicOrU32
[75131]311#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]312#pragma aux ASMAtomicOrU32 = \
[58709]313 "lock or [ecx], eax" \
314 parm [ecx] [eax] \
315 modify exact [];
[75131]316#endif
[58708]317
318/* ASMAtomicOrU64: Should be done by C inline or in external file. */
319
[58749]320#undef ASMAtomicAndU32
[75131]321#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]322#pragma aux ASMAtomicAndU32 = \
[58709]323 "lock and [ecx], eax" \
324 parm [ecx] [eax] \
325 modify exact [];
[75131]326#endif
[58708]327
328/* ASMAtomicAndU64: Should be done by C inline or in external file. */
329
[58749]330#undef ASMAtomicUoOrU32
[75131]331#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]332#pragma aux ASMAtomicUoOrU32 = \
[58709]333 "or [ecx], eax" \
334 parm [ecx] [eax] \
335 modify exact [];
[75131]336#endif
[58708]337
338/* ASMAtomicUoOrU64: Should be done by C inline or in external file. */
339
[58749]340#undef ASMAtomicUoAndU32
[75131]341#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]342#pragma aux ASMAtomicUoAndU32 = \
[58709]343 "and [ecx], eax" \
344 parm [ecx] [eax] \
345 modify exact [];
[75131]346#endif
[58708]347
348/* ASMAtomicUoAndU64: Should be done by C inline or in external file. */
349
[58749]350#undef ASMAtomicUoIncU32
[75131]351#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]352#pragma aux ASMAtomicUoIncU32 = \
353 ".486" \
[58709]354 "xadd [ecx], eax" \
355 "inc eax" \
356 parm [ecx] \
357 value [eax] \
358 modify exact [eax];
[75131]359#endif
[58708]360
[58749]361#undef ASMAtomicUoDecU32
[75131]362#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]363#pragma aux ASMAtomicUoDecU32 = \
364 ".486" \
[58709]365 "mov eax, 0ffffffffh" \
366 "xadd [ecx], eax" \
367 "dec eax" \
368 parm [ecx] \
369 value [eax] \
370 modify exact [eax];
[75131]371#endif
[58708]372
[58749]373#undef ASMMemZeroPage
[75131]374#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]375#pragma aux ASMMemZeroPage = \
376 "mov ecx, 1024" \
377 "xor eax, eax" \
378 "rep stosd" \
[58709]379 parm [edi] \
380 modify exact [eax ecx edi];
[75131]381#endif
[58708]382
[58749]383#undef ASMMemZero32
[75131]384#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]385#pragma aux ASMMemZero32 = \
386 "shr ecx, 2" \
387 "xor eax, eax" \
388 "rep stosd" \
[58709]389 parm [edi] [ecx] \
390 modify exact [eax ecx edi];
[75131]391#endif
[58708]392
[58788]393#undef ASMMemFill32
[75131]394#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58788]395#pragma aux ASMMemFill32 = \
[58708]396 "shr ecx, 2" \
397 "rep stosd" \
[58709]398 parm [edi] [ecx] [eax]\
399 modify exact [ecx edi];
[75131]400#endif
[58708]401
[58749]402#undef ASMProbeReadByte
[75131]403#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]404#pragma aux ASMProbeReadByte = \
[58709]405 "mov al, [ecx]" \
406 parm [ecx] \
[58708]407 value [al] \
408 modify exact [al];
[75131]409#endif
[58708]410
[58749]411#undef ASMBitSet
[75131]412#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]413#pragma aux ASMBitSet = \
[58709]414 "bts [ecx], eax" \
415 parm [ecx] [eax] \
416 modify exact [];
[75131]417#endif
[58708]418
[58749]419#undef ASMAtomicBitSet
[75131]420#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]421#pragma aux ASMAtomicBitSet = \
[58709]422 "lock bts [ecx], eax" \
423 parm [ecx] [eax] \
424 modify exact [];
[75131]425#endif
[58708]426
[58749]427#undef ASMBitClear
[75131]428#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]429#pragma aux ASMBitClear = \
[58709]430 "btr [ecx], eax" \
431 parm [ecx] [eax] \
432 modify exact [];
[75131]433#endif
[58708]434
[58749]435#undef ASMAtomicBitClear
[75131]436#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]437#pragma aux ASMAtomicBitClear = \
[58709]438 "lock btr [ecx], eax" \
439 parm [ecx] [eax] \
440 modify exact [];
[75131]441#endif
[58708]442
[58749]443#undef ASMBitToggle
[75131]444#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]445#pragma aux ASMBitToggle = \
[58709]446 "btc [ecx], eax" \
447 parm [ecx] [eax] \
448 modify exact [];
[75131]449#endif
[58708]450
[58749]451#undef ASMAtomicBitToggle
[75131]452#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]453#pragma aux ASMAtomicBitToggle = \
[58709]454 "lock btc [ecx], eax" \
455 parm [ecx] [eax] \
456 modify exact [];
[75131]457#endif
[58709]458
459
[58749]460#undef ASMBitTestAndSet
[75131]461#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]462#pragma aux ASMBitTestAndSet = \
[58709]463 "bts [ecx], eax" \
[58708]464 "setc al" \
[58709]465 parm [ecx] [eax] \
[58708]466 value [al] \
[58709]467 modify exact [eax];
[75131]468#endif
[58708]469
[58749]470#undef ASMAtomicBitTestAndSet
[75131]471#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]472#pragma aux ASMAtomicBitTestAndSet = \
[58709]473 "lock bts [ecx], eax" \
[58708]474 "setc al" \
[58709]475 parm [ecx] [eax] \
[58708]476 value [al] \
[58709]477 modify exact [eax];
[75131]478#endif
[58708]479
[58749]480#undef ASMBitTestAndClear
[75131]481#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]482#pragma aux ASMBitTestAndClear = \
[58709]483 "btr [ecx], eax" \
[58708]484 "setc al" \
[58709]485 parm [ecx] [eax] \
[58708]486 value [al] \
[58709]487 modify exact [eax];
[75131]488#endif
[58708]489
[58749]490#undef ASMAtomicBitTestAndClear
[75131]491#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]492#pragma aux ASMAtomicBitTestAndClear = \
[58709]493 "lock btr [ecx], eax" \
[58708]494 "setc al" \
[58709]495 parm [ecx] [eax] \
[58708]496 value [al] \
[58709]497 modify exact [eax];
[75131]498#endif
[58708]499
[58749]500#undef ASMBitTestAndToggle
[75131]501#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]502#pragma aux ASMBitTestAndToggle = \
[58709]503 "btc [ecx], eax" \
[58708]504 "setc al" \
[58709]505 parm [ecx] [eax] \
[58708]506 value [al] \
[58709]507 modify exact [eax];
[75131]508#endif
[58708]509
[58749]510#undef ASMAtomicBitTestAndToggle
[75131]511#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]512#pragma aux ASMAtomicBitTestAndToggle = \
[58709]513 "lock btc [ecx], eax" \
[58708]514 "setc al" \
[58709]515 parm [ecx] [eax] \
[58708]516 value [al] \
[58709]517 modify exact [eax];
[75131]518#endif
[58708]519
[58788]520#undef ASMBitTest
[75131]521#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58788]522#pragma aux ASMBitTest = \
523 "bt [ecx], eax" \
524 "setc al" \
525 parm [ecx] [eax] nomemory \
526 value [al] \
527 modify exact [eax] nomemory;
[75131]528#endif
[58788]529
530#if 0
[58708]531/** @todo this is way to much inline assembly, better off in an external function. */
[58749]532#undef ASMBitFirstClear
[75131]533#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]534#pragma aux ASMBitFirstClear = \
[58709]535 "mov edx, edi" /* save start of bitmap for later */ \
[58708]536 "add ecx, 31" \
537 "shr ecx, 5" /* cDWord = RT_ALIGN_32(cBits, 32) / 32; */ \
538 "mov eax, 0ffffffffh" \
539 "repe scasd" \
540 "je done" \
[58709]541 "lea edi, [edi - 4]" /* rewind edi */ \
542 "xor eax, [edi]" /* load inverted bits */ \
543 "sub edi, edx" /* calc byte offset */ \
[58708]544 "shl edi, 3" /* convert byte to bit offset */ \
[58709]545 "mov edx, eax" \
546 "bsf eax, edx" \
547 "add eax, edi" \
[58708]548 "done:" \
[58709]549 parm [edi] [ecx] \
550 value [eax] \
551 modify exact [eax ecx edx edi];
[75131]552#endif
[58708]553
554/* ASMBitNextClear: Too much work, do when needed. */
555
556/** @todo this is way to much inline assembly, better off in an external function. */
[58749]557#undef ASMBitFirstSet
[75131]558#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]559#pragma aux ASMBitFirstSet = \
[58709]560 "mov edx, edi" /* save start of bitmap for later */ \
[58708]561 "add ecx, 31" \
562 "shr ecx, 5" /* cDWord = RT_ALIGN_32(cBits, 32) / 32; */ \
[58709]563 "mov eax, 0ffffffffh" \
[58708]564 "repe scasd" \
565 "je done" \
[58709]566 "lea edi, [edi - 4]" /* rewind edi */ \
567 "mov eax, [edi]" /* reload previous dword */ \
568 "sub edi, edx" /* calc byte offset */ \
[58708]569 "shl edi, 3" /* convert byte to bit offset */ \
[58709]570 "mov edx, eax" \
571 "bsf eax, edx" \
572 "add eax, edi" \
[58708]573 "done:" \
[58709]574 parm [edi] [ecx] \
575 value [eax] \
576 modify exact [eax ecx edx edi];
[75131]577#endif
[58708]578
579/* ASMBitNextSet: Too much work, do when needed. */
[58788]580#else
581/* ASMBitFirstClear: External file. */
582/* ASMBitNextClear: External file. */
583/* ASMBitFirstSet: External file. */
584/* ASMBitNextSet: External file. */
585#endif
[58708]586
[58749]587#undef ASMBitFirstSetU32
[75131]588#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]589#pragma aux ASMBitFirstSetU32 = \
[58709]590 "bsf eax, eax" \
[58708]591 "jz not_found" \
[58709]592 "inc eax" \
[58708]593 "jmp done" \
594 "not_found:" \
[58709]595 "xor eax, eax" \
[58708]596 "done:" \
[58709]597 parm [eax] nomemory \
598 value [eax] \
599 modify exact [eax] nomemory;
[75131]600#endif
[58708]601
[58771]602#undef ASMBitFirstSetU64
[75131]603#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58771]604#pragma aux ASMBitFirstSetU64 = \
605 "bsf eax, eax" \
606 "jz not_found_low" \
607 "inc eax" \
608 "jmp done" \
609 \
610 "not_found_low:" \
611 "bsf eax, edx" \
612 "jz not_found_high" \
613 "add eax, 33" \
614 "jmp done" \
615 \
616 "not_found_high:" \
617 "xor eax, eax" \
618 "done:" \
619 parm [eax edx] nomemory \
620 value [eax] \
621 modify exact [eax] nomemory;
[75131]622#endif
[58771]623
624#undef ASMBitFirstSetU16
[75131]625#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58771]626#pragma aux ASMBitFirstSetU16 = \
627 "movzx eax, ax" \
628 "bsf eax, eax" \
629 "jz not_found" \
630 "inc eax" \
631 "jmp done" \
632 "not_found:" \
633 "xor eax, eax" \
634 "done:" \
635 parm [ax] nomemory \
636 value [eax] \
637 modify exact [eax] nomemory;
[75131]638#endif
[58771]639
[58749]640#undef ASMBitLastSetU32
[75131]641#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]642#pragma aux ASMBitLastSetU32 = \
[58709]643 "bsr eax, eax" \
[58708]644 "jz not_found" \
[58709]645 "inc eax" \
[58708]646 "jmp done" \
647 "not_found:" \
[58709]648 "xor eax, eax" \
[58708]649 "done:" \
[58709]650 parm [eax] nomemory \
651 value [eax] \
652 modify exact [eax] nomemory;
[75131]653#endif
[58708]654
[58771]655#undef ASMBitLastSetU64
[75131]656#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58771]657#pragma aux ASMBitLastSetU64 = \
658 "bsf eax, eax" \
659 "jz not_found_low" \
660 "inc eax" \
661 "jmp done" \
662 \
663 "not_found_low:" \
664 "bsf eax, edx" \
665 "jz not_found_high" \
666 "add eax, 33" \
667 "jmp done" \
668 \
669 "not_found_high:" \
670 "xor eax, eax" \
671 "done:" \
672 parm [eax edx] nomemory \
673 value [eax] \
674 modify exact [eax] nomemory;
[75131]675#endif
[58771]676
677#undef ASMBitLastSetU16
[75131]678#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58771]679#pragma aux ASMBitLastSetU16 = \
680 "movzx eax, ax" \
681 "bsr eax, eax" \
682 "jz not_found" \
683 "inc eax" \
684 "jmp done" \
685 "not_found:" \
686 "xor eax, eax" \
687 "done:" \
688 parm [ax] nomemory \
689 value [eax] \
690 modify exact [eax] nomemory;
[75131]691#endif
[58771]692
[58749]693#undef ASMByteSwapU16
[75131]694#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]695#pragma aux ASMByteSwapU16 = \
696 "ror ax, 8" \
697 parm [ax] nomemory \
698 value [ax] \
699 modify exact [ax] nomemory;
[75131]700#endif
[58708]701
[58749]702#undef ASMByteSwapU32
[75131]703#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]704#pragma aux ASMByteSwapU32 = \
[58709]705 "bswap eax" \
706 parm [eax] nomemory \
707 value [eax] \
708 modify exact [eax] nomemory;
[75131]709#endif
[58708]710
[58749]711#undef ASMRotateLeftU32
[75131]712#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]713#pragma aux ASMRotateLeftU32 = \
[58709]714 "rol eax, cl" \
715 parm [eax] [ecx] nomemory \
716 value [eax] \
717 modify exact [eax] nomemory;
[75131]718#endif
[58708]719
[58749]720#undef ASMRotateRightU32
[75131]721#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
[58708]722#pragma aux ASMRotateRightU32 = \
[58709]723 "ror eax, cl" \
724 parm [eax] [ecx] nomemory \
725 value [eax] \
726 modify exact [eax] nomemory;
[75131]727#endif
[58708]728
[76585]729#endif /* !IPRT_INCLUDED_asm_watcom_x86_32_h */
[58709]730
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette