1 /**************************************************************************** 2 * 3 * Realmode X86 Emulator Library 4 * 5 * Copyright (C) 1996-1999 SciTech Software, Inc. 6 * Copyright (C) David Mosberger-Tang 7 * Copyright (C) 1999 Egbert Eich 8 * 9 * ======================================================================== 10 * 11 * Permission to use, copy, modify, distribute, and sell this software and 12 * its documentation for any purpose is hereby granted without fee, 13 * provided that the above copyright notice appear in all copies and that 14 * both that copyright notice and this permission notice appear in 15 * supporting documentation, and that the name of the authors not be used 16 * in advertising or publicity pertaining to distribution of the software 17 * without specific, written prior permission. The authors makes no 18 * representations about the suitability of this software for any purpose. 19 * It is provided "as is" without express or implied warranty. 20 * 21 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 22 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 23 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 24 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 25 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 26 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 27 * PERFORMANCE OF THIS SOFTWARE. 28 * 29 * ======================================================================== 30 * 31 * Language: Watcom C++ 10.6 or later 32 * Environment: Any 33 * Developer: Kendall Bennett 34 * 35 * Description: Inline assembler versions of the primitive operand 36 * functions for faster performance. At the moment this is 37 * x86 inline assembler, but these functions could be replaced 38 * with native inline assembler for each supported processor 39 * platform. 40 * 41 ****************************************************************************/ 42 43 #ifndef __X86EMU_PRIM_ASM_H 44 #define __X86EMU_PRIM_ASM_H 45 46 #ifdef __WATCOMC__ 47 48 #ifndef VALIDATE 49 #define __HAVE_INLINE_ASSEMBLER__ 50 #endif 51 52 u32 get_flags_asm(void); 53 54 #pragma aux get_flags_asm = \ 55 "pushf" \ 56 "pop eax" \ 57 value [eax] \ 58 modify exact [eax]; 59 60 u16 aaa_word_asm(u32 * flags, u16 d); 61 62 #pragma aux aaa_word_asm = \ 63 "push [edi]" \ 64 "popf" \ 65 "aaa" \ 66 "pushf" \ 67 "pop [edi]" \ 68 parm [edi] [ax] \ 69 value [ax] \ 70 modify exact [ax]; 71 72 u16 aas_word_asm(u32 * flags, u16 d); 73 74 #pragma aux aas_word_asm = \ 75 "push [edi]" \ 76 "popf" \ 77 "aas" \ 78 "pushf" \ 79 "pop [edi]" \ 80 parm [edi] [ax] \ 81 value [ax] \ 82 modify exact [ax]; 83 84 u16 aad_word_asm(u32 * flags, u16 d); 85 86 #pragma aux aad_word_asm = \ 87 "push [edi]" \ 88 "popf" \ 89 "aad" \ 90 "pushf" \ 91 "pop [edi]" \ 92 parm [edi] [ax] \ 93 value [ax] \ 94 modify exact [ax]; 95 96 u16 aam_word_asm(u32 * flags, u8 d); 97 98 #pragma aux aam_word_asm = \ 99 "push [edi]" \ 100 "popf" \ 101 "aam" \ 102 "pushf" \ 103 "pop [edi]" \ 104 parm [edi] [al] \ 105 value [ax] \ 106 modify exact [ax]; 107 108 u8 adc_byte_asm(u32 * flags, u8 d, u8 s); 109 110 #pragma aux adc_byte_asm = \ 111 "push [edi]" \ 112 "popf" \ 113 "adc al,bl" \ 114 "pushf" \ 115 "pop [edi]" \ 116 parm [edi] [al] [bl] \ 117 value [al] \ 118 modify exact [al bl]; 119 120 u16 adc_word_asm(u32 * flags, u16 d, u16 s); 121 122 #pragma aux adc_word_asm = \ 123 "push [edi]" \ 124 "popf" \ 125 "adc ax,bx" \ 126 "pushf" \ 127 "pop [edi]" \ 128 parm [edi] [ax] [bx] \ 129 value [ax] \ 130 modify exact [ax bx]; 131 132 u32 adc_long_asm(u32 * flags, u32 d, u32 s); 133 134 #pragma aux adc_long_asm = \ 135 "push [edi]" \ 136 "popf" \ 137 "adc eax,ebx" \ 138 "pushf" \ 139 "pop [edi]" \ 140 parm [edi] [eax] [ebx] \ 141 value [eax] \ 142 modify exact [eax ebx]; 143 144 u8 add_byte_asm(u32 * flags, u8 d, u8 s); 145 146 #pragma aux add_byte_asm = \ 147 "push [edi]" \ 148 "popf" \ 149 "add al,bl" \ 150 "pushf" \ 151 "pop [edi]" \ 152 parm [edi] [al] [bl] \ 153 value [al] \ 154 modify exact [al bl]; 155 156 u16 add_word_asm(u32 * flags, u16 d, u16 s); 157 158 #pragma aux add_word_asm = \ 159 "push [edi]" \ 160 "popf" \ 161 "add ax,bx" \ 162 "pushf" \ 163 "pop [edi]" \ 164 parm [edi] [ax] [bx] \ 165 value [ax] \ 166 modify exact [ax bx]; 167 168 u32 add_long_asm(u32 * flags, u32 d, u32 s); 169 170 #pragma aux add_long_asm = \ 171 "push [edi]" \ 172 "popf" \ 173 "add eax,ebx" \ 174 "pushf" \ 175 "pop [edi]" \ 176 parm [edi] [eax] [ebx] \ 177 value [eax] \ 178 modify exact [eax ebx]; 179 180 u8 and_byte_asm(u32 * flags, u8 d, u8 s); 181 182 #pragma aux and_byte_asm = \ 183 "push [edi]" \ 184 "popf" \ 185 "and al,bl" \ 186 "pushf" \ 187 "pop [edi]" \ 188 parm [edi] [al] [bl] \ 189 value [al] \ 190 modify exact [al bl]; 191 192 u16 and_word_asm(u32 * flags, u16 d, u16 s); 193 194 #pragma aux and_word_asm = \ 195 "push [edi]" \ 196 "popf" \ 197 "and ax,bx" \ 198 "pushf" \ 199 "pop [edi]" \ 200 parm [edi] [ax] [bx] \ 201 value [ax] \ 202 modify exact [ax bx]; 203 204 u32 and_long_asm(u32 * flags, u32 d, u32 s); 205 206 #pragma aux and_long_asm = \ 207 "push [edi]" \ 208 "popf" \ 209 "and eax,ebx" \ 210 "pushf" \ 211 "pop [edi]" \ 212 parm [edi] [eax] [ebx] \ 213 value [eax] \ 214 modify exact [eax ebx]; 215 216 u8 cmp_byte_asm(u32 * flags, u8 d, u8 s); 217 218 #pragma aux cmp_byte_asm = \ 219 "push [edi]" \ 220 "popf" \ 221 "cmp al,bl" \ 222 "pushf" \ 223 "pop [edi]" \ 224 parm [edi] [al] [bl] \ 225 value [al] \ 226 modify exact [al bl]; 227 228 u16 cmp_word_asm(u32 * flags, u16 d, u16 s); 229 230 #pragma aux cmp_word_asm = \ 231 "push [edi]" \ 232 "popf" \ 233 "cmp ax,bx" \ 234 "pushf" \ 235 "pop [edi]" \ 236 parm [edi] [ax] [bx] \ 237 value [ax] \ 238 modify exact [ax bx]; 239 240 u32 cmp_long_asm(u32 * flags, u32 d, u32 s); 241 242 #pragma aux cmp_long_asm = \ 243 "push [edi]" \ 244 "popf" \ 245 "cmp eax,ebx" \ 246 "pushf" \ 247 "pop [edi]" \ 248 parm [edi] [eax] [ebx] \ 249 value [eax] \ 250 modify exact [eax ebx]; 251 252 u8 daa_byte_asm(u32 * flags, u8 d); 253 254 #pragma aux daa_byte_asm = \ 255 "push [edi]" \ 256 "popf" \ 257 "daa" \ 258 "pushf" \ 259 "pop [edi]" \ 260 parm [edi] [al] \ 261 value [al] \ 262 modify exact [al]; 263 264 u8 das_byte_asm(u32 * flags, u8 d); 265 266 #pragma aux das_byte_asm = \ 267 "push [edi]" \ 268 "popf" \ 269 "das" \ 270 "pushf" \ 271 "pop [edi]" \ 272 parm [edi] [al] \ 273 value [al] \ 274 modify exact [al]; 275 276 u8 dec_byte_asm(u32 * flags, u8 d); 277 278 #pragma aux dec_byte_asm = \ 279 "push [edi]" \ 280 "popf" \ 281 "dec al" \ 282 "pushf" \ 283 "pop [edi]" \ 284 parm [edi] [al] \ 285 value [al] \ 286 modify exact [al]; 287 288 u16 dec_word_asm(u32 * flags, u16 d); 289 290 #pragma aux dec_word_asm = \ 291 "push [edi]" \ 292 "popf" \ 293 "dec ax" \ 294 "pushf" \ 295 "pop [edi]" \ 296 parm [edi] [ax] \ 297 value [ax] \ 298 modify exact [ax]; 299 300 u32 dec_long_asm(u32 * flags, u32 d); 301 302 #pragma aux dec_long_asm = \ 303 "push [edi]" \ 304 "popf" \ 305 "dec eax" \ 306 "pushf" \ 307 "pop [edi]" \ 308 parm [edi] [eax] \ 309 value [eax] \ 310 modify exact [eax]; 311 312 u8 inc_byte_asm(u32 * flags, u8 d); 313 314 #pragma aux inc_byte_asm = \ 315 "push [edi]" \ 316 "popf" \ 317 "inc al" \ 318 "pushf" \ 319 "pop [edi]" \ 320 parm [edi] [al] \ 321 value [al] \ 322 modify exact [al]; 323 324 u16 inc_word_asm(u32 * flags, u16 d); 325 326 #pragma aux inc_word_asm = \ 327 "push [edi]" \ 328 "popf" \ 329 "inc ax" \ 330 "pushf" \ 331 "pop [edi]" \ 332 parm [edi] [ax] \ 333 value [ax] \ 334 modify exact [ax]; 335 336 u32 inc_long_asm(u32 * flags, u32 d); 337 338 #pragma aux inc_long_asm = \ 339 "push [edi]" \ 340 "popf" \ 341 "inc eax" \ 342 "pushf" \ 343 "pop [edi]" \ 344 parm [edi] [eax] \ 345 value [eax] \ 346 modify exact [eax]; 347 348 u8 or_byte_asm(u32 * flags, u8 d, u8 s); 349 350 #pragma aux or_byte_asm = \ 351 "push [edi]" \ 352 "popf" \ 353 "or al,bl" \ 354 "pushf" \ 355 "pop [edi]" \ 356 parm [edi] [al] [bl] \ 357 value [al] \ 358 modify exact [al bl]; 359 360 u16 or_word_asm(u32 * flags, u16 d, u16 s); 361 362 #pragma aux or_word_asm = \ 363 "push [edi]" \ 364 "popf" \ 365 "or ax,bx" \ 366 "pushf" \ 367 "pop [edi]" \ 368 parm [edi] [ax] [bx] \ 369 value [ax] \ 370 modify exact [ax bx]; 371 372 u32 or_long_asm(u32 * flags, u32 d, u32 s); 373 374 #pragma aux or_long_asm = \ 375 "push [edi]" \ 376 "popf" \ 377 "or eax,ebx" \ 378 "pushf" \ 379 "pop [edi]" \ 380 parm [edi] [eax] [ebx] \ 381 value [eax] \ 382 modify exact [eax ebx]; 383 384 u8 neg_byte_asm(u32 * flags, u8 d); 385 386 #pragma aux neg_byte_asm = \ 387 "push [edi]" \ 388 "popf" \ 389 "neg al" \ 390 "pushf" \ 391 "pop [edi]" \ 392 parm [edi] [al] \ 393 value [al] \ 394 modify exact [al]; 395 396 u16 neg_word_asm(u32 * flags, u16 d); 397 398 #pragma aux neg_word_asm = \ 399 "push [edi]" \ 400 "popf" \ 401 "neg ax" \ 402 "pushf" \ 403 "pop [edi]" \ 404 parm [edi] [ax] \ 405 value [ax] \ 406 modify exact [ax]; 407 408 u32 neg_long_asm(u32 * flags, u32 d); 409 410 #pragma aux neg_long_asm = \ 411 "push [edi]" \ 412 "popf" \ 413 "neg eax" \ 414 "pushf" \ 415 "pop [edi]" \ 416 parm [edi] [eax] \ 417 value [eax] \ 418 modify exact [eax]; 419 420 u8 not_byte_asm(u32 * flags, u8 d); 421 422 #pragma aux not_byte_asm = \ 423 "push [edi]" \ 424 "popf" \ 425 "not al" \ 426 "pushf" \ 427 "pop [edi]" \ 428 parm [edi] [al] \ 429 value [al] \ 430 modify exact [al]; 431 432 u16 not_word_asm(u32 * flags, u16 d); 433 434 #pragma aux not_word_asm = \ 435 "push [edi]" \ 436 "popf" \ 437 "not ax" \ 438 "pushf" \ 439 "pop [edi]" \ 440 parm [edi] [ax] \ 441 value [ax] \ 442 modify exact [ax]; 443 444 u32 not_long_asm(u32 * flags, u32 d); 445 446 #pragma aux not_long_asm = \ 447 "push [edi]" \ 448 "popf" \ 449 "not eax" \ 450 "pushf" \ 451 "pop [edi]" \ 452 parm [edi] [eax] \ 453 value [eax] \ 454 modify exact [eax]; 455 456 u8 rcl_byte_asm(u32 * flags, u8 d, u8 s); 457 458 #pragma aux rcl_byte_asm = \ 459 "push [edi]" \ 460 "popf" \ 461 "rcl al,cl" \ 462 "pushf" \ 463 "pop [edi]" \ 464 parm [edi] [al] [cl] \ 465 value [al] \ 466 modify exact [al cl]; 467 468 u16 rcl_word_asm(u32 * flags, u16 d, u8 s); 469 470 #pragma aux rcl_word_asm = \ 471 "push [edi]" \ 472 "popf" \ 473 "rcl ax,cl" \ 474 "pushf" \ 475 "pop [edi]" \ 476 parm [edi] [ax] [cl] \ 477 value [ax] \ 478 modify exact [ax cl]; 479 480 u32 rcl_long_asm(u32 * flags, u32 d, u8 s); 481 482 #pragma aux rcl_long_asm = \ 483 "push [edi]" \ 484 "popf" \ 485 "rcl eax,cl" \ 486 "pushf" \ 487 "pop [edi]" \ 488 parm [edi] [eax] [cl] \ 489 value [eax] \ 490 modify exact [eax cl]; 491 492 u8 rcr_byte_asm(u32 * flags, u8 d, u8 s); 493 494 #pragma aux rcr_byte_asm = \ 495 "push [edi]" \ 496 "popf" \ 497 "rcr al,cl" \ 498 "pushf" \ 499 "pop [edi]" \ 500 parm [edi] [al] [cl] \ 501 value [al] \ 502 modify exact [al cl]; 503 504 u16 rcr_word_asm(u32 * flags, u16 d, u8 s); 505 506 #pragma aux rcr_word_asm = \ 507 "push [edi]" \ 508 "popf" \ 509 "rcr ax,cl" \ 510 "pushf" \ 511 "pop [edi]" \ 512 parm [edi] [ax] [cl] \ 513 value [ax] \ 514 modify exact [ax cl]; 515 516 u32 rcr_long_asm(u32 * flags, u32 d, u8 s); 517 518 #pragma aux rcr_long_asm = \ 519 "push [edi]" \ 520 "popf" \ 521 "rcr eax,cl" \ 522 "pushf" \ 523 "pop [edi]" \ 524 parm [edi] [eax] [cl] \ 525 value [eax] \ 526 modify exact [eax cl]; 527 528 u8 rol_byte_asm(u32 * flags, u8 d, u8 s); 529 530 #pragma aux rol_byte_asm = \ 531 "push [edi]" \ 532 "popf" \ 533 "rol al,cl" \ 534 "pushf" \ 535 "pop [edi]" \ 536 parm [edi] [al] [cl] \ 537 value [al] \ 538 modify exact [al cl]; 539 540 u16 rol_word_asm(u32 * flags, u16 d, u8 s); 541 542 #pragma aux rol_word_asm = \ 543 "push [edi]" \ 544 "popf" \ 545 "rol ax,cl" \ 546 "pushf" \ 547 "pop [edi]" \ 548 parm [edi] [ax] [cl] \ 549 value [ax] \ 550 modify exact [ax cl]; 551 552 u32 rol_long_asm(u32 * flags, u32 d, u8 s); 553 554 #pragma aux rol_long_asm = \ 555 "push [edi]" \ 556 "popf" \ 557 "rol eax,cl" \ 558 "pushf" \ 559 "pop [edi]" \ 560 parm [edi] [eax] [cl] \ 561 value [eax] \ 562 modify exact [eax cl]; 563 564 u8 ror_byte_asm(u32 * flags, u8 d, u8 s); 565 566 #pragma aux ror_byte_asm = \ 567 "push [edi]" \ 568 "popf" \ 569 "ror al,cl" \ 570 "pushf" \ 571 "pop [edi]" \ 572 parm [edi] [al] [cl] \ 573 value [al] \ 574 modify exact [al cl]; 575 576 u16 ror_word_asm(u32 * flags, u16 d, u8 s); 577 578 #pragma aux ror_word_asm = \ 579 "push [edi]" \ 580 "popf" \ 581 "ror ax,cl" \ 582 "pushf" \ 583 "pop [edi]" \ 584 parm [edi] [ax] [cl] \ 585 value [ax] \ 586 modify exact [ax cl]; 587 588 u32 ror_long_asm(u32 * flags, u32 d, u8 s); 589 590 #pragma aux ror_long_asm = \ 591 "push [edi]" \ 592 "popf" \ 593 "ror eax,cl" \ 594 "pushf" \ 595 "pop [edi]" \ 596 parm [edi] [eax] [cl] \ 597 value [eax] \ 598 modify exact [eax cl]; 599 600 u8 shl_byte_asm(u32 * flags, u8 d, u8 s); 601 602 #pragma aux shl_byte_asm = \ 603 "push [edi]" \ 604 "popf" \ 605 "shl al,cl" \ 606 "pushf" \ 607 "pop [edi]" \ 608 parm [edi] [al] [cl] \ 609 value [al] \ 610 modify exact [al cl]; 611 612 u16 shl_word_asm(u32 * flags, u16 d, u8 s); 613 614 #pragma aux shl_word_asm = \ 615 "push [edi]" \ 616 "popf" \ 617 "shl ax,cl" \ 618 "pushf" \ 619 "pop [edi]" \ 620 parm [edi] [ax] [cl] \ 621 value [ax] \ 622 modify exact [ax cl]; 623 624 u32 shl_long_asm(u32 * flags, u32 d, u8 s); 625 626 #pragma aux shl_long_asm = \ 627 "push [edi]" \ 628 "popf" \ 629 "shl eax,cl" \ 630 "pushf" \ 631 "pop [edi]" \ 632 parm [edi] [eax] [cl] \ 633 value [eax] \ 634 modify exact [eax cl]; 635 636 u8 shr_byte_asm(u32 * flags, u8 d, u8 s); 637 638 #pragma aux shr_byte_asm = \ 639 "push [edi]" \ 640 "popf" \ 641 "shr al,cl" \ 642 "pushf" \ 643 "pop [edi]" \ 644 parm [edi] [al] [cl] \ 645 value [al] \ 646 modify exact [al cl]; 647 648 u16 shr_word_asm(u32 * flags, u16 d, u8 s); 649 650 #pragma aux shr_word_asm = \ 651 "push [edi]" \ 652 "popf" \ 653 "shr ax,cl" \ 654 "pushf" \ 655 "pop [edi]" \ 656 parm [edi] [ax] [cl] \ 657 value [ax] \ 658 modify exact [ax cl]; 659 660 u32 shr_long_asm(u32 * flags, u32 d, u8 s); 661 662 #pragma aux shr_long_asm = \ 663 "push [edi]" \ 664 "popf" \ 665 "shr eax,cl" \ 666 "pushf" \ 667 "pop [edi]" \ 668 parm [edi] [eax] [cl] \ 669 value [eax] \ 670 modify exact [eax cl]; 671 672 u8 sar_byte_asm(u32 * flags, u8 d, u8 s); 673 674 #pragma aux sar_byte_asm = \ 675 "push [edi]" \ 676 "popf" \ 677 "sar al,cl" \ 678 "pushf" \ 679 "pop [edi]" \ 680 parm [edi] [al] [cl] \ 681 value [al] \ 682 modify exact [al cl]; 683 684 u16 sar_word_asm(u32 * flags, u16 d, u8 s); 685 686 #pragma aux sar_word_asm = \ 687 "push [edi]" \ 688 "popf" \ 689 "sar ax,cl" \ 690 "pushf" \ 691 "pop [edi]" \ 692 parm [edi] [ax] [cl] \ 693 value [ax] \ 694 modify exact [ax cl]; 695 696 u32 sar_long_asm(u32 * flags, u32 d, u8 s); 697 698 #pragma aux sar_long_asm = \ 699 "push [edi]" \ 700 "popf" \ 701 "sar eax,cl" \ 702 "pushf" \ 703 "pop [edi]" \ 704 parm [edi] [eax] [cl] \ 705 value [eax] \ 706 modify exact [eax cl]; 707 708 u16 shld_word_asm(u32 * flags, u16 d, u16 fill, u8 s); 709 710 #pragma aux shld_word_asm = \ 711 "push [edi]" \ 712 "popf" \ 713 "shld ax,dx,cl" \ 714 "pushf" \ 715 "pop [edi]" \ 716 parm [edi] [ax] [dx] [cl] \ 717 value [ax] \ 718 modify exact [ax dx cl]; 719 720 u32 shld_long_asm(u32 * flags, u32 d, u32 fill, u8 s); 721 722 #pragma aux shld_long_asm = \ 723 "push [edi]" \ 724 "popf" \ 725 "shld eax,edx,cl" \ 726 "pushf" \ 727 "pop [edi]" \ 728 parm [edi] [eax] [edx] [cl] \ 729 value [eax] \ 730 modify exact [eax edx cl]; 731 732 u16 shrd_word_asm(u32 * flags, u16 d, u16 fill, u8 s); 733 734 #pragma aux shrd_word_asm = \ 735 "push [edi]" \ 736 "popf" \ 737 "shrd ax,dx,cl" \ 738 "pushf" \ 739 "pop [edi]" \ 740 parm [edi] [ax] [dx] [cl] \ 741 value [ax] \ 742 modify exact [ax dx cl]; 743 744 u32 shrd_long_asm(u32 * flags, u32 d, u32 fill, u8 s); 745 746 #pragma aux shrd_long_asm = \ 747 "push [edi]" \ 748 "popf" \ 749 "shrd eax,edx,cl" \ 750 "pushf" \ 751 "pop [edi]" \ 752 parm [edi] [eax] [edx] [cl] \ 753 value [eax] \ 754 modify exact [eax edx cl]; 755 756 u8 sbb_byte_asm(u32 * flags, u8 d, u8 s); 757 758 #pragma aux sbb_byte_asm = \ 759 "push [edi]" \ 760 "popf" \ 761 "sbb al,bl" \ 762 "pushf" \ 763 "pop [edi]" \ 764 parm [edi] [al] [bl] \ 765 value [al] \ 766 modify exact [al bl]; 767 768 u16 sbb_word_asm(u32 * flags, u16 d, u16 s); 769 770 #pragma aux sbb_word_asm = \ 771 "push [edi]" \ 772 "popf" \ 773 "sbb ax,bx" \ 774 "pushf" \ 775 "pop [edi]" \ 776 parm [edi] [ax] [bx] \ 777 value [ax] \ 778 modify exact [ax bx]; 779 780 u32 sbb_long_asm(u32 * flags, u32 d, u32 s); 781 782 #pragma aux sbb_long_asm = \ 783 "push [edi]" \ 784 "popf" \ 785 "sbb eax,ebx" \ 786 "pushf" \ 787 "pop [edi]" \ 788 parm [edi] [eax] [ebx] \ 789 value [eax] \ 790 modify exact [eax ebx]; 791 792 u8 sub_byte_asm(u32 * flags, u8 d, u8 s); 793 794 #pragma aux sub_byte_asm = \ 795 "push [edi]" \ 796 "popf" \ 797 "sub al,bl" \ 798 "pushf" \ 799 "pop [edi]" \ 800 parm [edi] [al] [bl] \ 801 value [al] \ 802 modify exact [al bl]; 803 804 u16 sub_word_asm(u32 * flags, u16 d, u16 s); 805 806 #pragma aux sub_word_asm = \ 807 "push [edi]" \ 808 "popf" \ 809 "sub ax,bx" \ 810 "pushf" \ 811 "pop [edi]" \ 812 parm [edi] [ax] [bx] \ 813 value [ax] \ 814 modify exact [ax bx]; 815 816 u32 sub_long_asm(u32 * flags, u32 d, u32 s); 817 818 #pragma aux sub_long_asm = \ 819 "push [edi]" \ 820 "popf" \ 821 "sub eax,ebx" \ 822 "pushf" \ 823 "pop [edi]" \ 824 parm [edi] [eax] [ebx] \ 825 value [eax] \ 826 modify exact [eax ebx]; 827 828 void test_byte_asm(u32 * flags, u8 d, u8 s); 829 830 #pragma aux test_byte_asm = \ 831 "push [edi]" \ 832 "popf" \ 833 "test al,bl" \ 834 "pushf" \ 835 "pop [edi]" \ 836 parm [edi] [al] [bl] \ 837 modify exact [al bl]; 838 839 void test_word_asm(u32 * flags, u16 d, u16 s); 840 841 #pragma aux test_word_asm = \ 842 "push [edi]" \ 843 "popf" \ 844 "test ax,bx" \ 845 "pushf" \ 846 "pop [edi]" \ 847 parm [edi] [ax] [bx] \ 848 modify exact [ax bx]; 849 850 void test_long_asm(u32 * flags, u32 d, u32 s); 851 852 #pragma aux test_long_asm = \ 853 "push [edi]" \ 854 "popf" \ 855 "test eax,ebx" \ 856 "pushf" \ 857 "pop [edi]" \ 858 parm [edi] [eax] [ebx] \ 859 modify exact [eax ebx]; 860 861 u8 xor_byte_asm(u32 * flags, u8 d, u8 s); 862 863 #pragma aux xor_byte_asm = \ 864 "push [edi]" \ 865 "popf" \ 866 "xor al,bl" \ 867 "pushf" \ 868 "pop [edi]" \ 869 parm [edi] [al] [bl] \ 870 value [al] \ 871 modify exact [al bl]; 872 873 u16 xor_word_asm(u32 * flags, u16 d, u16 s); 874 875 #pragma aux xor_word_asm = \ 876 "push [edi]" \ 877 "popf" \ 878 "xor ax,bx" \ 879 "pushf" \ 880 "pop [edi]" \ 881 parm [edi] [ax] [bx] \ 882 value [ax] \ 883 modify exact [ax bx]; 884 885 u32 xor_long_asm(u32 * flags, u32 d, u32 s); 886 887 #pragma aux xor_long_asm = \ 888 "push [edi]" \ 889 "popf" \ 890 "xor eax,ebx" \ 891 "pushf" \ 892 "pop [edi]" \ 893 parm [edi] [eax] [ebx] \ 894 value [eax] \ 895 modify exact [eax ebx]; 896 897 void imul_byte_asm(u32 * flags, u16 * ax, u8 d, u8 s); 898 899 #pragma aux imul_byte_asm = \ 900 "push [edi]" \ 901 "popf" \ 902 "imul bl" \ 903 "pushf" \ 904 "pop [edi]" \ 905 "mov [esi],ax" \ 906 parm [edi] [esi] [al] [bl] \ 907 modify exact [esi ax bl]; 908 909 void imul_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 d, u16 s); 910 911 #pragma aux imul_word_asm = \ 912 "push [edi]" \ 913 "popf" \ 914 "imul bx" \ 915 "pushf" \ 916 "pop [edi]" \ 917 "mov [esi],ax" \ 918 "mov [ecx],dx" \ 919 parm [edi] [esi] [ecx] [ax] [bx]\ 920 modify exact [esi edi ax bx dx]; 921 922 void imul_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 d, u32 s); 923 924 #pragma aux imul_long_asm = \ 925 "push [edi]" \ 926 "popf" \ 927 "imul ebx" \ 928 "pushf" \ 929 "pop [edi]" \ 930 "mov [esi],eax" \ 931 "mov [ecx],edx" \ 932 parm [edi] [esi] [ecx] [eax] [ebx] \ 933 modify exact [esi edi eax ebx edx]; 934 935 void mul_byte_asm(u32 * flags, u16 * ax, u8 d, u8 s); 936 937 #pragma aux mul_byte_asm = \ 938 "push [edi]" \ 939 "popf" \ 940 "mul bl" \ 941 "pushf" \ 942 "pop [edi]" \ 943 "mov [esi],ax" \ 944 parm [edi] [esi] [al] [bl] \ 945 modify exact [esi ax bl]; 946 947 void mul_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 d, u16 s); 948 949 #pragma aux mul_word_asm = \ 950 "push [edi]" \ 951 "popf" \ 952 "mul bx" \ 953 "pushf" \ 954 "pop [edi]" \ 955 "mov [esi],ax" \ 956 "mov [ecx],dx" \ 957 parm [edi] [esi] [ecx] [ax] [bx]\ 958 modify exact [esi edi ax bx dx]; 959 960 void mul_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 d, u32 s); 961 962 #pragma aux mul_long_asm = \ 963 "push [edi]" \ 964 "popf" \ 965 "mul ebx" \ 966 "pushf" \ 967 "pop [edi]" \ 968 "mov [esi],eax" \ 969 "mov [ecx],edx" \ 970 parm [edi] [esi] [ecx] [eax] [ebx] \ 971 modify exact [esi edi eax ebx edx]; 972 973 void idiv_byte_asm(u32 * flags, u8 * al, u8 * ah, u16 d, u8 s); 974 975 #pragma aux idiv_byte_asm = \ 976 "push [edi]" \ 977 "popf" \ 978 "idiv bl" \ 979 "pushf" \ 980 "pop [edi]" \ 981 "mov [esi],al" \ 982 "mov [ecx],ah" \ 983 parm [edi] [esi] [ecx] [ax] [bl]\ 984 modify exact [esi edi ax bl]; 985 986 void idiv_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 dlo, u16 dhi, u16 s); 987 988 #pragma aux idiv_word_asm = \ 989 "push [edi]" \ 990 "popf" \ 991 "idiv bx" \ 992 "pushf" \ 993 "pop [edi]" \ 994 "mov [esi],ax" \ 995 "mov [ecx],dx" \ 996 parm [edi] [esi] [ecx] [ax] [dx] [bx]\ 997 modify exact [esi edi ax dx bx]; 998 999 void idiv_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 dlo, u32 dhi, u32 s); 1000 1001 #pragma aux idiv_long_asm = \ 1002 "push [edi]" \ 1003 "popf" \ 1004 "idiv ebx" \ 1005 "pushf" \ 1006 "pop [edi]" \ 1007 "mov [esi],eax" \ 1008 "mov [ecx],edx" \ 1009 parm [edi] [esi] [ecx] [eax] [edx] [ebx]\ 1010 modify exact [esi edi eax edx ebx]; 1011 1012 void div_byte_asm(u32 * flags, u8 * al, u8 * ah, u16 d, u8 s); 1013 1014 #pragma aux div_byte_asm = \ 1015 "push [edi]" \ 1016 "popf" \ 1017 "div bl" \ 1018 "pushf" \ 1019 "pop [edi]" \ 1020 "mov [esi],al" \ 1021 "mov [ecx],ah" \ 1022 parm [edi] [esi] [ecx] [ax] [bl]\ 1023 modify exact [esi edi ax bl]; 1024 1025 void div_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 dlo, u16 dhi, u16 s); 1026 1027 #pragma aux div_word_asm = \ 1028 "push [edi]" \ 1029 "popf" \ 1030 "div bx" \ 1031 "pushf" \ 1032 "pop [edi]" \ 1033 "mov [esi],ax" \ 1034 "mov [ecx],dx" \ 1035 parm [edi] [esi] [ecx] [ax] [dx] [bx]\ 1036 modify exact [esi edi ax dx bx]; 1037 1038 void div_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 dlo, u32 dhi, u32 s); 1039 1040 #pragma aux div_long_asm = \ 1041 "push [edi]" \ 1042 "popf" \ 1043 "div ebx" \ 1044 "pushf" \ 1045 "pop [edi]" \ 1046 "mov [esi],eax" \ 1047 "mov [ecx],edx" \ 1048 parm [edi] [esi] [ecx] [eax] [edx] [ebx]\ 1049 modify exact [esi edi eax edx ebx]; 1050 1051 #endif 1052 1053 #endif /* __X86EMU_PRIM_ASM_H */ 1054