Changeset 58709 in vbox for trunk/include/iprt/asm-watcom-x86-32.h
- Timestamp:
- Nov 16, 2015 10:49:31 PM (9 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm-watcom-x86-32.h
r58708 r58709 1 1 /** @file 2 * IPRT - Assembly Functions, x86 16-bit Watcom C/C++ pragma aux.2 * IPRT - Assembly Functions, x86 32-bit Watcom C/C++ pragma aux. 3 3 */ 4 4 … … 27 27 # error "Don't include this header directly." 28 28 #endif 29 #ifndef ___iprt_asm_watcom_x86_ 16_h30 #define ___iprt_asm_watcom_x86_ 16_h31 32 #if !RT_FAR_DATA33 # error "Only works with f ar data pointers!"29 #ifndef ___iprt_asm_watcom_x86_32_h 30 #define ___iprt_asm_watcom_x86_32_h 31 32 #ifndef __FLAT__ 33 # error "Only works with flat pointers! (-mf)" 34 34 #endif 35 35 … … 44 44 "nop" \ 45 45 parm [] \ 46 modify exact [ ax bx cx dx es ds];46 modify exact [eax ebx ecx edx es ds fs gs]; 47 47 #else 48 48 # pragma aux ASMCompilerBarrier = \ … … 60 60 61 61 #pragma aux ASMAtomicXchgU8 = \ 62 "xchg es:[bx], al" \63 parm [e s bx] [al] \62 "xchg [ecx], al" \ 63 parm [ecx] [al] \ 64 64 value [al] \ 65 65 modify exact [al]; 66 66 67 67 #pragma aux ASMAtomicXchgU16 = \ 68 "xchg es:[bx], ax" \69 parm [e s bx] [ax] \68 "xchg [ecx], ax" \ 69 parm [ecx] [ax] \ 70 70 value [ax] \ 71 71 modify exact [ax]; 72 72 73 73 #pragma aux ASMAtomicXchgU32 = \ 74 "shl ecx, 16" \ 75 "mov cx, ax" \ 76 "xchg es:[bx], ecx" \ 77 "mov eax, ecx" \ 78 "shr ecx, 16" \ 79 parm [es bx] [ax cx] \ 80 value [ax cx] \ 81 modify exact [ax cx]; 74 "xchg [ecx], eax" \ 75 parm [ecx] [eax] \ 76 value [eax] \ 77 modify exact [eax]; 82 78 83 79 #pragma aux ASMAtomicXchgU64 = \ 84 80 ".586" \ 85 "shl eax, 16" \86 "mov ax, bx" /* eax = high dword */ \87 "shl ecx, 16" \88 "mov cx, dx" /* ecx = low dword */ \89 "mov ebx, ecx" /* ebx = low */ \90 "mov ecx, eax" /* ecx = high */ \91 81 "try_again:" \ 92 "lock cmpxchg8b es:[si]" \82 "lock cmpxchg8b [esi]" \ 93 83 "jnz try_again" \ 94 "xchg eax, edx" \ 95 "mov ebx, eax" \ 96 "shr eax, 16" \ 97 "mov ecx, edx" \ 98 "shr ecx, 16" \ 99 parm [es si] [dx cx bx ax] \ 100 value [dx cx bx ax] \ 101 modify exact [dx cx bx ax]; 84 parm [esi] [ebx ecx] \ 85 value [eax edx] \ 86 modify exact [edx ecx ebx eax]; 102 87 103 88 #pragma aux ASMAtomicCmpXchgU8 = \ 104 89 ".486" \ 105 "lock cmpxchg es:[bx], cl" \106 "setz al" \ 107 parm [e s bx] [cl] [al] \90 "lock cmpxchg [edx], cl" \ 91 "setz al" \ 92 parm [edx] [cl] [al] \ 108 93 value [al] \ 109 94 modify exact [al]; … … 111 96 #pragma aux ASMAtomicCmpXchgU16 = \ 112 97 ".486" \ 113 "lock cmpxchg es:[bx], cx" \114 "setz al" \ 115 parm [e s bx] [cx] [ax] \98 "lock cmpxchg [edx], cx" \ 99 "setz al" \ 100 parm [edx] [cx] [ax] \ 116 101 value [al] \ 117 102 modify exact [ax]; … … 119 104 #pragma aux ASMAtomicCmpXchgU32 = \ 120 105 ".486" \ 121 "shl ecx, 16" \ 122 "mov cx, dx" \ 123 "shl eax, 16" \ 124 "mov ax, di" \ 125 "rol eax, 16" \ 126 "lock cmpxchg es:[bx], ecx" \ 127 "setz al" \ 128 parm [es bx] [cx dx] [ax di] \ 129 value [al] \ 130 modify exact [ax cx]; 131 132 /* ASMAtomicCmpXchgU64: External assembly implementation, too few registers for parameters. */ 133 /* ASMAtomicCmpXchgExU32: External assembly implementation, too few registers for parameters. */ 134 /* ASMAtomicCmpXchgExU64: External assembly implementation, too few registers for parameters. */ 106 "lock cmpxchg [edx], ecx" \ 107 "setz al" \ 108 parm [edx] [ecx] [eax] \ 109 value [al] \ 110 modify exact [eax]; 111 112 #pragma aux ASMAtomicCmpXchgU64 = \ 113 ".586" \ 114 "lock cmpxchg8b [edi]" \ 115 "setz al" \ 116 parm [edi] [ebx ecx] [eax edx] \ 117 value [al] \ 118 modify exact [eax edx]; 119 120 #pragma aux ASMAtomicCmpXchgExU32 = \ 121 ".586" \ 122 "lock cmpxchg [edx], ecx" \ 123 "mov [edi], eax" \ 124 "setz al" \ 125 parm [edx] [ecx] [eax] [edi] \ 126 value [al] \ 127 modify exact [eax]; 128 129 #pragma aux ASMAtomicCmpXchgExU64 = \ 130 ".586" \ 131 "lock cmpxchg8b [edi]" \ 132 "mov [esi], eax" \ 133 "mov [esi + 4], edx" \ 134 "setz al" \ 135 parm [edi] [ebx ecx] [eax edx] [esi] \ 136 value [al] \ 137 modify exact [eax edx]; 135 138 136 139 #pragma aux ASMSerializeInstruction = \ … … 139 142 "cpuid" \ 140 143 parm [] \ 141 modify exact [ ax bx cxdx];144 modify exact [eax ebx ecx edx]; 142 145 143 146 #pragma aux ASMAtomicReadU64 = \ 144 147 ".586" \ 145 148 "xor eax, eax" \ 146 "xor edx, edx" \ 147 "xor ebx, ebx" \ 148 "xor ecx, ecx" \ 149 "lock cmpxchg8b es:[si]" \ 150 "xchg eax, edx" \ 151 "mov ebx, eax" \ 152 "shr eax, 16" \ 153 "mov ecx, edx" \ 154 "shr ecx, 16" \ 155 parm [es si] [dx cx bx ax] \ 156 value [dx cx bx ax] \ 157 modify exact [dx cx bx ax]; 149 "mov edx, eax" \ 150 "mov ebx, eax" \ 151 "mov ecx, eax" \ 152 "lock cmpxchg8b [edi]" \ 153 parm [edi] \ 154 value [eax edx] \ 155 modify exact [eax ebx ecx edx]; 158 156 159 157 #pragma aux ASMAtomicUoReadU64 = \ 160 158 ".586" \ 161 159 "xor eax, eax" \ 162 "xor edx, edx" \ 163 "xor ebx, ebx" \ 164 "xor ecx, ecx" \ 165 "lock cmpxchg8b es:[si]" \ 166 "xchg eax, edx" \ 167 "mov ebx, eax" \ 168 "shr eax, 16" \ 169 "mov ecx, edx" \ 170 "shr ecx, 16" \ 171 parm [es si] [dx cx bx ax] \ 172 value [dx cx bx ax] \ 173 modify exact [dx cx bx ax]; 160 "mov edx, eax" \ 161 "mov ebx, eax" \ 162 "mov ecx, eax" \ 163 "lock cmpxchg8b [edi]" \ 164 parm [edi] \ 165 value [eax edx] \ 166 modify exact [eax ebx ecx edx]; 174 167 175 168 #pragma aux ASMAtomicAddU16 = \ 176 169 ".486" \ 177 "lock xadd es:[bx], ax" \178 parm [e s bx] [ax] \170 "lock xadd [ecx], ax" \ 171 parm [ecx] [ax] \ 179 172 value [ax] \ 180 173 modify exact [ax]; … … 182 175 #pragma aux ASMAtomicAddU32 = \ 183 176 ".486" \ 184 "shl edx, 16" \ 185 "mov dx, ax" \ 186 "lock xadd es:[bx], edx" \ 187 "mov ax, dx" \ 188 "shr edx, 16" \ 189 parm [es bx] [ax dx] \ 190 value [ax dx] \ 191 modify exact [ax dx]; 177 "lock xadd [ecx], eax" \ 178 parm [ecx] [eax] \ 179 value [eax] \ 180 modify exact [eax]; 192 181 193 182 #pragma aux ASMAtomicIncU16 = \ 194 183 ".486" \ 195 184 "mov ax, 1" \ 196 "lock xadd es:[bx], ax" \185 "lock xadd [ecx], ax" \ 197 186 "inc ax" \ 198 parm [e s bx] \187 parm [ecx] \ 199 188 value [ax] \ 200 189 modify exact [ax]; … … 202 191 #pragma aux ASMAtomicIncU32 = \ 203 192 ".486" \ 204 "mov edx, 1" \ 205 "lock xadd es:[bx], edx" \ 206 "inc edx" \ 207 "mov ax, dx" \ 208 "shr edx, 16" \ 209 parm [es bx] \ 210 value [ax dx] \ 211 modify exact [ax dx]; 193 "mov eax, 1" \ 194 "lock xadd [ecx], eax" \ 195 "inc eax" \ 196 parm [ecx] \ 197 value [eax] \ 198 modify exact [eax]; 212 199 213 200 /* ASMAtomicIncU64: Should be done by C inline or in external file. */ … … 216 203 ".486" \ 217 204 "mov ax, 0ffffh" \ 218 "lock xadd es:[bx], ax" \205 "lock xadd [ecx], ax" \ 219 206 "dec ax" \ 220 parm [e s bx] \207 parm [ecx] \ 221 208 value [ax] \ 222 209 modify exact [ax]; … … 224 211 #pragma aux ASMAtomicDecU32 = \ 225 212 ".486" \ 226 "mov edx, 0ffffffffh" \ 227 "lock xadd es:[bx], edx" \ 228 "dec edx" \ 229 "mov ax, dx" \ 230 "shr edx, 16" \ 231 parm [es bx] \ 232 value [ax dx] \ 233 modify exact [ax dx]; 213 "mov eax, 0ffffffffh" \ 214 "lock xadd [ecx], eax" \ 215 "dec eax" \ 216 parm [ecx] \ 217 value [eax] \ 218 modify exact [eax]; 234 219 235 220 /* ASMAtomicDecU64: Should be done by C inline or in external file. */ 236 221 237 222 #pragma aux ASMAtomicOrU32 = \ 238 "shl edx, 16" \ 239 "mov dx, ax" \ 240 "lock or es:[bx], edx" \ 241 parm [es bx] [ax dx] \ 242 modify exact [dx]; 223 "lock or [ecx], eax" \ 224 parm [ecx] [eax] \ 225 modify exact []; 243 226 244 227 /* ASMAtomicOrU64: Should be done by C inline or in external file. */ 245 228 246 229 #pragma aux ASMAtomicAndU32 = \ 247 "shl edx, 16" \ 248 "mov dx, ax" \ 249 "lock and es:[bx], edx" \ 250 parm [es bx] [ax dx] \ 251 modify exact [dx]; 230 "lock and [ecx], eax" \ 231 parm [ecx] [eax] \ 232 modify exact []; 252 233 253 234 /* ASMAtomicAndU64: Should be done by C inline or in external file. */ 254 235 255 236 #pragma aux ASMAtomicUoOrU32 = \ 256 "shl edx, 16" \ 257 "mov dx, ax" \ 258 "or es:[bx], edx" \ 259 parm [es bx] [ax dx] \ 260 modify exact [dx]; 237 "or [ecx], eax" \ 238 parm [ecx] [eax] \ 239 modify exact []; 261 240 262 241 /* ASMAtomicUoOrU64: Should be done by C inline or in external file. */ 263 242 264 243 #pragma aux ASMAtomicUoAndU32 = \ 265 "shl edx, 16" \ 266 "mov dx, ax" \ 267 "and es:[bx], edx" \ 268 parm [es bx] [ax dx] \ 269 modify exact [dx]; 244 "and [ecx], eax" \ 245 parm [ecx] [eax] \ 246 modify exact []; 270 247 271 248 /* ASMAtomicUoAndU64: Should be done by C inline or in external file. */ … … 273 250 #pragma aux ASMAtomicUoIncU32 = \ 274 251 ".486" \ 275 "mov edx, 1" \ 276 "xadd es:[bx], edx" \ 277 "inc edx" \ 278 "mov ax, dx" \ 279 "shr edx, 16" \ 280 parm [es bx] \ 281 value [ax dx] \ 282 modify exact [ax dx]; 252 "xadd [ecx], eax" \ 253 "inc eax" \ 254 parm [ecx] \ 255 value [eax] \ 256 modify exact [eax]; 283 257 284 258 #pragma aux ASMAtomicUoDecU32 = \ 285 259 ".486" \ 286 "mov edx, 0ffffffffh" \ 287 "xadd es:[bx], edx" \ 288 "dec edx" \ 289 "mov ax, dx" \ 290 "shr edx, 16" \ 291 parm [es bx] \ 292 value [ax dx] \ 293 modify exact [ax dx]; 260 "mov eax, 0ffffffffh" \ 261 "xadd [ecx], eax" \ 262 "dec eax" \ 263 parm [ecx] \ 264 value [eax] \ 265 modify exact [eax]; 294 266 295 267 #pragma aux ASMMemZeroPage = \ … … 297 269 "xor eax, eax" \ 298 270 "rep stosd" \ 299 parm [e sdi] \300 modify exact [ ax cxdi];271 parm [edi] \ 272 modify exact [eax ecx edi]; 301 273 302 274 #pragma aux ASMMemZero32 = \ 303 "and ecx, 0ffffh" /* probably not necessary, lazy bird should check... */ \304 275 "shr ecx, 2" \ 305 276 "xor eax, eax" \ 306 277 "rep stosd" \ 307 parm [e s di] [cx] \308 modify exact [ ax cxdi];278 parm [edi] [ecx] \ 279 modify exact [eax ecx edi]; 309 280 310 281 #pragma aux ASMMemZero32 = \ 311 "and ecx, 0ffffh" /* probably not necessary, lazy bird should check... */ \312 282 "shr ecx, 2" \ 313 "shr eax, 16" \314 "mov ax, dx" \315 "rol eax, 16" \316 283 "rep stosd" \ 317 parm [e s di] [cx] [ax dx]\318 modify exact [ ax cxdi];284 parm [edi] [ecx] [eax]\ 285 modify exact [ecx edi]; 319 286 320 287 #pragma aux ASMProbeReadByte = \ 321 "mov al, es:[bx]" \322 parm [e s bx] \288 "mov al, [ecx]" \ 289 parm [ecx] \ 323 290 value [al] \ 324 291 modify exact [al]; 325 292 326 293 #pragma aux ASMBitSet = \ 327 "shl edx, 16" \ 328 "mov dx, ax" \ 329 "bts es:[bx], edx" \ 330 parm [es bx] [ax dx] \ 331 modify exact [dx]; 294 "bts [ecx], eax" \ 295 parm [ecx] [eax] \ 296 modify exact []; 332 297 333 298 #pragma aux ASMAtomicBitSet = \ 334 "shl edx, 16" \ 335 "mov dx, ax" \ 336 "lock bts es:[bx], edx" \ 337 parm [es bx] [ax dx] \ 338 modify exact [dx]; 299 "lock bts [ecx], eax" \ 300 parm [ecx] [eax] \ 301 modify exact []; 339 302 340 303 #pragma aux ASMBitClear = \ 341 "shl edx, 16" \ 342 "mov dx, ax" \ 343 "btr es:[bx], edx" \ 344 parm [es bx] [ax dx] \ 345 modify exact [dx]; 304 "btr [ecx], eax" \ 305 parm [ecx] [eax] \ 306 modify exact []; 346 307 347 308 #pragma aux ASMAtomicBitClear = \ 348 "shl edx, 16" \ 349 "mov dx, ax" \ 350 "lock btr es:[bx], edx" \ 351 parm [es bx] [ax dx] \ 352 modify exact [dx]; 309 "lock btr [ecx], eax" \ 310 parm [ecx] [eax] \ 311 modify exact []; 353 312 354 313 #pragma aux ASMBitToggle = \ 355 "shl edx, 16" \ 356 "mov dx, ax" \ 357 "btc es:[bx], edx" \ 358 parm [es bx] [ax dx] \ 359 modify exact [dx]; 314 "btc [ecx], eax" \ 315 parm [ecx] [eax] \ 316 modify exact []; 360 317 361 318 #pragma aux ASMAtomicBitToggle = \ 362 "shl edx, 16" \ 363 "mov dx, ax" \ 364 "lock btc es:[bx], edx" \ 365 parm [es bx] [ax dx] \ 366 modify exact [dx]; 367 /// 368 /// 319 "lock btc [ecx], eax" \ 320 parm [ecx] [eax] \ 321 modify exact []; 322 323 369 324 #pragma aux ASMBitTestAndSet = \ 370 "shl edx, 16" \ 371 "mov dx, ax" \ 372 "bts es:[bx], edx" \ 373 "setc al" \ 374 parm [es bx] [ax dx] \ 375 value [al] \ 376 modify exact [ax dx]; 325 "bts [ecx], eax" \ 326 "setc al" \ 327 parm [ecx] [eax] \ 328 value [al] \ 329 modify exact [eax]; 377 330 378 331 #pragma aux ASMAtomicBitTestAndSet = \ 379 "shl edx, 16" \ 380 "mov dx, ax" \ 381 "lock bts es:[bx], edx" \ 382 "setc al" \ 383 parm [es bx] [ax dx] \ 384 value [al] \ 385 modify exact [ax dx]; 332 "lock bts [ecx], eax" \ 333 "setc al" \ 334 parm [ecx] [eax] \ 335 value [al] \ 336 modify exact [eax]; 386 337 387 338 #pragma aux ASMBitTestAndClear = \ 388 "shl edx, 16" \ 389 "mov dx, ax" \ 390 "btr es:[bx], edx" \ 391 "setc al" \ 392 parm [es bx] [ax dx] \ 393 value [al] \ 394 modify exact [ax dx]; 339 "btr [ecx], eax" \ 340 "setc al" \ 341 parm [ecx] [eax] \ 342 value [al] \ 343 modify exact [eax]; 395 344 396 345 #pragma aux ASMAtomicBitTestAndClear = \ 397 "shl edx, 16" \ 398 "mov dx, ax" \ 399 "lock btr es:[bx], edx" \ 400 "setc al" \ 401 parm [es bx] [ax dx] \ 402 value [al] \ 403 modify exact [ax dx]; 346 "lock btr [ecx], eax" \ 347 "setc al" \ 348 parm [ecx] [eax] \ 349 value [al] \ 350 modify exact [eax]; 404 351 405 352 #pragma aux ASMBitTestAndToggle = \ 406 "shl edx, 16" \ 407 "mov dx, ax" \ 408 "btc es:[bx], edx" \ 409 "setc al" \ 410 parm [es bx] [ax dx] \ 411 value [al] \ 412 modify exact [ax dx]; 353 "btc [ecx], eax" \ 354 "setc al" \ 355 parm [ecx] [eax] \ 356 value [al] \ 357 modify exact [eax]; 413 358 414 359 #pragma aux ASMAtomicBitTestAndToggle = \ 415 "shl edx, 16" \ 416 "mov dx, ax" \ 417 "lock btc es:[bx], edx" \ 418 "setc al" \ 419 parm [es bx] [ax dx] \ 420 value [al] \ 421 modify exact [ax dx]; 360 "lock btc [ecx], eax" \ 361 "setc al" \ 362 parm [ecx] [eax] \ 363 value [al] \ 364 modify exact [eax]; 422 365 423 366 /** @todo this is way to much inline assembly, better off in an external function. */ 424 367 #pragma aux ASMBitFirstClear = \ 425 "mov bx, di" /* save start of bitmap for later */ \ 426 "shl ecx, 16" \ 427 "mov cx, ax" /* ecx = cBits */ \ 368 "mov edx, edi" /* save start of bitmap for later */ \ 428 369 "add ecx, 31" \ 429 370 "shr ecx, 5" /* cDWord = RT_ALIGN_32(cBits, 32) / 32; */ \ 430 371 "mov eax, 0ffffffffh" \ 431 "mov edx, eax" /* default return value */ \432 372 "repe scasd" \ 433 373 "je done" \ 434 "sub di, 4" /* rewind di */ \ 435 "xor eax, es:[di]" /* load inverted bits */ \ 436 "sub di, bx" /* calc byte offset */ \ 437 "movzx edi, di" \ 374 "lea edi, [edi - 4]" /* rewind edi */ \ 375 "xor eax, [edi]" /* load inverted bits */ \ 376 "sub edi, edx" /* calc byte offset */ \ 438 377 "shl edi, 3" /* convert byte to bit offset */ \ 439 "bsf edx, eax" \ 440 "add edx, edi" \ 378 "mov edx, eax" \ 379 "bsf eax, edx" \ 380 "add eax, edi" \ 441 381 "done:" \ 442 "mov eax, edx" \ 443 "shr edx, 16" \ 444 parm [es di] [ax cx] \ 445 value [ax dx] \ 446 modify exact [ax bx cx dx di]; 382 parm [edi] [ecx] \ 383 value [eax] \ 384 modify exact [eax ecx edx edi]; 447 385 448 386 /* ASMBitNextClear: Too much work, do when needed. */ … … 450 388 /** @todo this is way to much inline assembly, better off in an external function. */ 451 389 #pragma aux ASMBitFirstSet = \ 452 "mov bx, di" /* save start of bitmap for later */ \ 453 "shl ecx, 16" \ 454 "mov cx, ax" /* ecx = cBits */ \ 390 "mov edx, edi" /* save start of bitmap for later */ \ 455 391 "add ecx, 31" \ 456 392 "shr ecx, 5" /* cDWord = RT_ALIGN_32(cBits, 32) / 32; */ \ 457 "xor eax, eax" \ 458 "mov edx, 0ffffffffh" /* default return value */ \ 393 "mov eax, 0ffffffffh" \ 459 394 "repe scasd" \ 460 395 "je done" \ 461 "sub di, 4" /* rewind di */ \ 462 "mov eax, es:[di]" /* reload previous dword */ \ 463 "sub di, bx" /* calc byte offset */ \ 464 "movzx edi, di" \ 396 "lea edi, [edi - 4]" /* rewind edi */ \ 397 "mov eax, [edi]" /* reload previous dword */ \ 398 "sub edi, edx" /* calc byte offset */ \ 465 399 "shl edi, 3" /* convert byte to bit offset */ \ 466 "bsf edx, eax" /* find first set bit in dword */ \ 467 "add edx, edi" /* calc final bit number */ \ 400 "mov edx, eax" \ 401 "bsf eax, edx" \ 402 "add eax, edi" \ 468 403 "done:" \ 469 "mov eax, edx" \ 470 "shr edx, 16" \ 471 parm [es di] [ax cx] \ 472 value [ax dx] \ 473 modify exact [ax bx cx dx di]; 404 parm [edi] [ecx] \ 405 value [eax] \ 406 modify exact [eax ecx edx edi]; 474 407 475 408 /* ASMBitNextSet: Too much work, do when needed. */ 476 409 477 410 #pragma aux ASMBitFirstSetU32 = \ 478 "shl edx, 16" \ 479 "mov dx, ax" \ 480 "bsf eax, edx" \ 411 "bsf eax, eax" \ 481 412 "jz not_found" \ 482 "inc ax" \413 "inc eax" \ 483 414 "jmp done" \ 484 415 "not_found:" \ 485 "xor ax,ax" \416 "xor eax, eax" \ 486 417 "done:" \ 487 parm [ ax dx] nomemory \488 value [ ax] \489 modify exact [ ax dx] nomemory;418 parm [eax] nomemory \ 419 value [eax] \ 420 modify exact [eax] nomemory; 490 421 491 422 #pragma aux ASMBitLastSetU32 = \ 492 "shl edx, 16" \ 493 "mov dx, ax" \ 494 "bsr eax, edx" \ 423 "bsr eax, eax" \ 495 424 "jz not_found" \ 496 "inc ax" \425 "inc eax" \ 497 426 "jmp done" \ 498 427 "not_found:" \ 499 "xor ax,ax" \428 "xor eax, eax" \ 500 429 "done:" \ 501 parm [ ax dx] nomemory \502 value [ ax] \503 modify exact [ ax dx] nomemory;430 parm [eax] nomemory \ 431 value [eax] \ 432 modify exact [eax] nomemory; 504 433 505 434 #pragma aux ASMByteSwapU16 = \ … … 510 439 511 440 #pragma aux ASMByteSwapU32 = \ 512 " xchg ax, dx" \513 parm [ ax dx] nomemory \514 value [ ax dx] \515 modify exact [ ax dx] nomemory;441 "bswap eax" \ 442 parm [eax] nomemory \ 443 value [eax] \ 444 modify exact [eax] nomemory; 516 445 517 446 #pragma aux ASMRotateLeftU32 = \ 518 "shl edx, 16" \ 519 "mov dx, ax" \ 520 "rol edx, cl" \ 521 "mov eax, edx" \ 522 "shr edx, 16" \ 523 parm [ax dx] [cx] nomemory \ 524 value [ax dx] \ 525 modify exact [ax dx] nomemory; 447 "rol eax, cl" \ 448 parm [eax] [ecx] nomemory \ 449 value [eax] \ 450 modify exact [eax] nomemory; 526 451 527 452 #pragma aux ASMRotateRightU32 = \ 528 "shl edx, 16" \ 529 "mov dx, ax" \ 530 "ror edx, cl" \ 531 "mov eax, edx" \ 532 "shr edx, 16" \ 533 parm [ax dx] [cx] nomemory \ 534 value [ax dx] \ 535 modify exact [ax dx] nomemory; 453 "ror eax, cl" \ 454 parm [eax] [ecx] nomemory \ 455 value [eax] \ 456 modify exact [eax] nomemory; 536 457 537 458 #endif 459
Note:
See TracChangeset
for help on using the changeset viewer.