1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245
|
/**
* @namespace biew_plugins_II
* @file plugins/disasm/ix86/ix86_fun.c
* @brief This file contains implementation common function and utility
* for Intel x86 disassembler.
* @version -
* @remark this source file is part of Binary vIEW project (BIEW).
* The Binary vIEW (BIEW) is copyright (C) 1995 Nick Kurshev.
* All rights reserved. This software is redistributable under the
* licence given in the file "Licence.en" ("Licence.ru" in russian
* translation) distributed in the BIEW archive.
* @note Requires POSIX compatible development system
*
* @author Nick Kurshev
* @since 1995
* @note Development, fixes and improvements
* @author Kostya Nosov <k-nosov@yandex.ru>
* @date 12.09.2000
* @note Adding navigation for indirect jumps
**/
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include "plugins/disasm.h"
#include "plugins/disasm/ix86/ix86.h"
#include "biewutil.h"
#include "bmfile.h"
#include "codeguid.h"
#include "reg_form.h"
char *ix86_appstr;
char *ix86_dtile;
char *ix86_appbuffer;
char *ix86_apistr;
char *ix86_modrm_ret;
char *ix86_Katmai_buff;
#define ix86_setModifier(str,modf) disSetModifier(str,modf)
#define getSREG(sreg) (ix86_SegRegs[(unsigned char)sreg])
#define getTile(DisP) __getTile(DisP,DisP->RealCmd[0] & 0x01,DisP->RealCmd[0] & 0x02)
static const char * __FASTCALL__ ix86_getREG(unsigned char reg,tBool w)
{
if(UseXMMXSet) return ix86_XMMXRegs[reg];
else
if(UseMMXSet) return ix86_MMXRegs[reg];
else
if(!w) return ix86_ByteRegs[reg];
else return Use32Data ? ix86_DWordRegs[reg] : ix86_WordRegs[reg];
}
static char * __NEAR__ __FASTCALL__ GetDigitsApp(unsigned char loc_off,
ix86Param *DisP,
char codelen,int type)
{
ix86_appbuffer[0] = 0;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
disAppendDigits(ix86_appbuffer,DisP->CodeAddress + loc_off,
APREF_USE_TYPE,codelen,&DisP->RealCmd[loc_off],type);
return ix86_appbuffer;
}
#define Get2DigitApp(loc_off,DisP) GetDigitsApp(loc_off,DisP,1,DISARG_BYTE)
#define Get2SignDigApp(loc_off,DisP) GetDigitsApp(loc_off,DisP,1,DISARG_CHAR)
#define Get4DigitApp(loc_off,DisP) GetDigitsApp(loc_off,DisP,2,DISARG_WORD)
#define Get4SignDigApp(loc_off,DisP) GetDigitsApp(loc_off,DisP,2,DISARG_SHORT)
#define Get8DigitApp(loc_off,DisP) GetDigitsApp(loc_off,DisP,4,DISARG_DWORD)
#define Get8SignDigApp(loc_off,DisP) GetDigitsApp(loc_off,DisP,4,DISARG_LONG)
static char * __NEAR__ __FASTCALL__ Get2SquareDig(unsigned char loc_off,ix86Param *DisP,tBool as_sign)
{
char *ptr = ix86_apistr;
char *rets;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
{
rets = GetDigitsApp(loc_off,DisP,1,as_sign ? DISARG_CHAR : DISARG_BYTE);
if(!(rets[0] == '+' || rets[0] == '-')) *ptr++ = '+';
strcpy(ptr,rets);
}
return ix86_apistr;
}
static char * __NEAR__ __FASTCALL__ Get4SquareDig(unsigned char loc_off,ix86Param *DisP,tBool as_sign, tBool is_disponly)
{
char *ptr = ix86_apistr;
char *rets;
unsigned type;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
{
type = as_sign ? DISARG_SHORT : DISARG_WORD;
type |= is_disponly ? DISARG_DISP : DISARG_IDXDISP;
rets = GetDigitsApp(loc_off,DisP,2,type);
if(!(rets[0] == '+' || rets[0] == '-')) *ptr++ = '+';
strcpy(ptr,rets);
}
return ix86_apistr;
}
static char * __NEAR__ __FASTCALL__ Get8SquareDig(unsigned char loc_off,ix86Param *DisP,tBool as_sign,tBool is_disponly)
{
char *ptr = ix86_apistr;
char *rets;
unsigned type;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
{
type = as_sign ? DISARG_LONG : DISARG_DWORD;
type |= is_disponly ? DISARG_DISP : DISARG_IDXDISP;
rets = GetDigitsApp(loc_off,DisP,4,type);
if(!(rets[0] == '+' || rets[0] == '-')) *ptr++ = '+';
strcpy(ptr,rets);
}
return ix86_apistr;
}
void __FASTCALL__ ix86_ArgES(char *str,ix86Param *param)
{
UNUSED(param);
strcat(str,"es");
}
void __FASTCALL__ ix86_ArgDS(char *str,ix86Param *param)
{
UNUSED(param);
strcat(str,"ds");
}
void __FASTCALL__ ix86_ArgSS(char *str,ix86Param *param)
{
UNUSED(param);
strcat(str,"ss");
}
void __FASTCALL__ ix86_ArgCS(char *str,ix86Param *param)
{
UNUSED(param);
strcat(str,"cs");
}
void __FASTCALL__ ix86_ArgFS(char *str,ix86Param *param)
{
UNUSED(param);
strcat(str,"fs");
}
void __FASTCALL__ ix86_ArgGS(char *str,ix86Param *param)
{
UNUSED(param);
strcat(str,"gs");
}
void __FASTCALL__ ix86_ArgByte(char *str,ix86Param *DisP)
{
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
disAppendDigits(str,DisP->CodeAddress + DisP->codelen,
APREF_USE_TYPE,1,&DisP->RealCmd[DisP->codelen],DISARG_BYTE);
DisP->codelen++;
}
void __FASTCALL__ ix86_ArgWord(char *str,ix86Param *DisP)
{
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
disAppendDigits(str,DisP->CodeAddress + DisP->codelen,
APREF_USE_TYPE,2,&DisP->RealCmd[DisP->codelen],DISARG_WORD | DISARG_IMM);
DisP->codelen+=2;
}
void __FASTCALL__ ix86_ArgWord_Byte(char *str,ix86Param *DisP)
{
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
disAppendDigits(str,DisP->CodeAddress + DisP->codelen,
APREF_USE_TYPE,2,&DisP->RealCmd[DisP->codelen],DISARG_WORD);
DisP->codelen+=2;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
{
strcat(str,",");
strcat(str,Get2DigitApp(DisP->codelen,DisP));
}
DisP->codelen++;
}
void __FASTCALL__ ix86_ArgDWord(char *str,ix86Param *DisP)
{
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
disAppendDigits(str,DisP->CodeAddress + DisP->codelen,
APREF_USE_TYPE,4,&DisP->RealCmd[DisP->codelen],DISARG_DWORD | DISARG_IMM);
DisP->codelen+=4;
}
static char * __FASTCALL__ ix86_GetDigitTile(ix86Param* DisP,char wrd,char sgn,unsigned char loc_off)
{
int cl,type;
cl = wrd ? ( Use32Data ? 4 : 2 ) : 1;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
{
type = sgn ? wrd ? ( Use32Data ? DISARG_LONG : DISARG_SHORT ) : DISARG_CHAR:
wrd ? ( Use32Data ? DISARG_DWORD : DISARG_WORD ) : DISARG_BYTE;
type |= DISARG_IMM;
ix86_dtile[0] = 0;
disAppendDigits(ix86_dtile,
DisP->CodeAddress + loc_off,
APREF_USE_TYPE,cl,&DisP->RealCmd[loc_off],type);
}
DisP->codelen += cl;
return ix86_dtile;
}
void __FASTCALL__ ix86_ArgFar(char * str,ix86Param *DisP)
{
unsigned long newpos = 0L;
long off = 0L;
unsigned short seg = 0;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
{
seg = Use32Data ? *((short *)(&DisP->RealCmd[5])) : *((short *)(&DisP->RealCmd[3]));
off = Use32Data ? *((long *)(&DisP->RealCmd[1])) : (long)(*((short *)(&DisP->RealCmd[1])));
newpos = ((long)(seg) << 4) + off;
if(FType == OLD_EXE) newpos += (((unsigned long)oldh.mz.mzHeaderSize) << 4);
}
DisP->codelen += Use32Data ? 6 : 4;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
disAppendFAddr(str,DisP->CodeAddress + 1,off,newpos,
Use32Data ? DISADR_FAR32 : DISADR_FAR16,seg,DisP->codelen-1);
}
void __FASTCALL__ ix86_ArgNear(char * str,ix86Param *DisP)
{
long lshift = 0L;
unsigned long newpos;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
lshift = Use32Data ? *((long *)(&DisP->RealCmd[1])) :
(long)(*((short *)(&DisP->RealCmd[1])));
DisP->codelen += Use32Data ? 4 : 2;
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
{
newpos = DisP->CodeAddress + lshift + DisP->codelen;
disAppendFAddr(str,DisP->CodeAddress + 1,lshift,newpos,
Use32Data ? DISADR_NEAR32 : DISADR_NEAR16,0,DisP->codelen-1);
}
}
void __FASTCALL__ ix86_ArgShort(char * str,ix86Param *DisP)
{
unsigned long r_sh;
signed char distin;
distin = DisP->RealCmd[DisP->codelen++];
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
{
r_sh = DisP->CodeAddress + distin + 2; /** 2 byte it self code jmp<c> addr */
disAppendFAddr(str,DisP->CodeAddress + 1,(long)distin,r_sh,
DISADR_SHORT,0,1);
}
}
static void __NEAR__ __FASTCALL__ getSIBRegs(char * base,char * scale,char * _index,char *mod,char code)
{
char scl = (code & 0xC0) >> 6;
char bas = code & 0x07;
char ind = (code & 0x38) >> 3;
tBool use32data = Use32Data;
tBool useMMX = UseMMXSet;
Use32Data = True;
UseMMXSet = False;
if(scl)
{
scale[0] = '*';
scale[1] = ( 1 << scl ) + 0x30;
scale[2] = 0;
}
else scale[0] = 0;
if(ind == 4) _index[0] = 0;
else strcpy(_index,ix86_getREG(ind,True));
if(bas == 5 && *mod == 0) { base[0] = 0; *mod = 2; }
else strcpy(base,ix86_getREG(bas,True));
Use32Data = use32data;
UseMMXSet = useMMX;
#if 0
return ind == 4 || ind == 5 || bas == 4 || bas == 5; /** return is_stack */
#endif
}
static char * __NEAR__ __FASTCALL__ ConstrSibMod(char * store,char * scale,char * _index,char * base,char code,char *mod)
{
getSIBRegs(base,scale,_index,mod,code);
store[0] = 0;
if(_index[0])
{
strcat(store,_index);
strcat(store,scale);
}
if(base[0])
{
if(_index[0]) strcat(store,"+");
strcat(store,base);
}
return store;
}
char * __FASTCALL__ ix86_getModRM(tBool w,unsigned char mod,unsigned char rm,ix86Param *DisP)
{
const char *cptr;
char square[50];
char ret1[50];
char base[8];
char _index[8];
char scale[4];
char new_mode = mod;
unsigned char clen,tmp;
tBool as_sign,is_disponly;
clen = 2;
if(rm == 4 && Use32Addr) cptr = ConstrSibMod(ret1,base,_index,scale,DisP->RealCmd[2],&new_mode);
else
{
cptr = Use32Addr ? ix86_DWordRegs[rm] : ix86_A16[rm];
#if 0
is_stack = Use32Addr ? rm == 4 || rm == 5 : rm == 2 || rm == 3 || rm == 6;
#endif
}
strcpy(square,cptr);
mod = new_mode;
ix86_modrm_ret[0] = 0;
if(mod != 3)
{
strcpy(ix86_modrm_ret,"[");
strcat(ix86_modrm_ret,ix86_segpref);
ix86_segpref[0] = 0;
}
is_disponly = False;
as_sign = True;
switch(mod)
{
case 0:
{
if((rm != 6 && !Use32Addr) || (rm != 5 && Use32Addr)) /* i.e. combine address */
{
clen = 0;
if(Use32Addr && rm == 4) clen = 1;
strcat(ix86_modrm_ret,square);
}
else /* i.e. displacement only. fake mod = 2 */
{
square[0] = 0;
is_disponly = True;
as_sign = False;
goto disp_long;
}
}
break;
case 1:
{
if(!Use32Addr)
{
strcat(ix86_modrm_ret,ix86_segpref);
ix86_segpref[0] = 0;
tmp = 2;
clen = 1;
}
else
{
if(rm != 4) { tmp = 2; clen = 1; }
else { tmp = 3; clen = 2; }
}
strcat(ix86_modrm_ret,square);
/* The "disp8" nomenclature denotes an 8-bit displacement
following the ModR/M or SIB byte, to be sign-extended
and added to the index. */
strcat(ix86_modrm_ret,Get2SquareDig(tmp,DisP,True));
}
break;
case 2:
{
disp_long:
if(!Use32Addr)
{
strcat(ix86_modrm_ret,ix86_segpref);
ix86_segpref[0] = 0;
strcat(ix86_modrm_ret,square);
strcat(ix86_modrm_ret,Get4SquareDig(2,DisP,as_sign,is_disponly));
clen = 2;
}
else
{
if(rm != 4) { tmp = 2; clen = 4; }
else { tmp = 3; clen = 5; }
strcat(ix86_modrm_ret,square);
strcat(ix86_modrm_ret,Get8SquareDig(tmp,DisP,as_sign,is_disponly));
}
}
break;
default:
{
clen = 0;
strcat(ix86_modrm_ret,ix86_getREG(rm,w));
}
break;
}
if(mod != 3)
{
DisP->codelen += clen;
strcat(ix86_modrm_ret,"]");
}
return ix86_modrm_ret;
}
char * __FASTCALL__ ix86_CStile(char *str,const char *arg2)
{
strcat(str,",");
strcat(str,arg2);
return str;
}
static char * __NEAR__ __FASTCALL__ __getTile(ix86Param *DisP,tBool w,tBool d)
{
char reg = (DisP->RealCmd[1] & 0x38) >> 3;
char mod = (DisP->RealCmd[1] & 0xC0) >> 6;
char rm = (DisP->RealCmd[1] & 0x07);
const char *regs,* modrm;
regs = ix86_getREG(reg,w);
if(mod == 3) modrm = ix86_getREG(rm,w);
else modrm = ix86_getModRM(w,mod,rm,DisP);
ix86_dtile[0] = 0;
strcat(ix86_dtile,d ? regs : modrm);
ix86_CStile(ix86_dtile,d ? modrm : regs);
return ix86_dtile;
}
static char * __FASTCALL__ ix86_getTileWD( ix86Param *DisP )
{
return __getTile(DisP,True,True);
}
static char * __FASTCALL__ ix86_getTileWnD( ix86Param *DisP )
{
return __getTile(DisP,True,False);
}
static char * __FASTCALL__ ix86_getTilenWD( ix86Param *DisP )
{
return __getTile(DisP,False,True);
}
static char * __FASTCALL__ ix86_getTilenWnD( ix86Param *DisP )
{
return __getTile(DisP,False,False);
}
void __FASTCALL__ ix86_ArgModRM(char * str,ix86Param *DisP)
{
DisP->codelen++;
strcat(str,getTile(DisP));
}
void __FASTCALL__ ix86_ArgModRMDW(char *str,ix86Param *DisP)
{
DisP->codelen++;
strcat(str,ix86_getTileWD(DisP));
}
void __FASTCALL__ ix86_ArgModRMnDW(char *str,ix86Param *DisP)
{
DisP->codelen++;
strcat(str,ix86_getTileWnD(DisP));
}
void __FASTCALL__ ix86_ArgModRMDnW(char *str,ix86Param *DisP)
{
DisP->codelen++;
strcat(str,ix86_getTilenWD(DisP));
}
void __FASTCALL__ ix86_ArgModRMnDnW(char *str,ix86Param *DisP)
{
DisP->codelen++;
strcat(str,ix86_getTilenWnD(DisP));
}
void __FASTCALL__ ix86_ArgMod(char *str,ix86Param *DisP)
{
char mod = (DisP->RealCmd[1] >> 6) & 0x03;
char rm = (DisP->RealCmd[1] & 0x07);
int sizptr;
sizptr = Use32Data ? DWORD_PTR : WORD_PTR;
ix86_setModifier(str,ix86_sizes[sizptr]);
DisP->codelen++;
strcat(str,ix86_getModRM(True,mod,rm,DisP));
}
void __FASTCALL__ ix86_ArgModB(char *str,ix86Param *DisP)
{
char mod = (DisP->RealCmd[1] >> 6) & 0x03;
char rm = (DisP->RealCmd[1] & 0x07);
ix86_setModifier(str,ix86_sizes[BYTE_PTR]);
DisP->codelen++;
strcat(str,ix86_getModRM(False,mod,rm,DisP));
}
void __FASTCALL__ ix86_SMov(char * str,ix86Param *DisP)
{
char direct = ( DisP->RealCmd[0] & 0x02 ) >> 1;
char sreg = (DisP->RealCmd[1] & 0x38) >> 3;
char reg = DisP->RealCmd[1] & 0x07;
char mod = (DisP->RealCmd[1] & 0xC0) >> 6;
const char *tileptr,*sregptr;
tBool use32data = Use32Data;
Use32Data = False;
sregptr = getSREG(sreg);
DisP->codelen = 2;
tileptr = ix86_getModRM(True,mod,reg,DisP);
if(sreg > 3) if((DisP->pro_clone & IX86_CPUMASK) < 3) DisP->pro_clone = IX86_CPU386;
Use32Data = use32data;
strcat(str,direct ? sregptr : tileptr);
ix86_CStile(str,direct ? tileptr : sregptr);
}
void __FASTCALL__ ix86_ArgSegRM(char * str,ix86Param *DisP)
{
char sreg = (DisP->RealCmd[1] & 0x38) >> 3;
char reg = DisP->RealCmd[1] & 0x07;
char mod = (DisP->RealCmd[1] & 0xC0) >> 6;
const char *tileptr,*sregptr;
tBool use32data = Use32Data;
Use32Data = False;
sregptr = getSREG(sreg);
strcat(str,sregptr);
DisP->codelen++;
tileptr = ix86_getModRM(True,mod,reg,DisP);
if(sreg > 3) if((DisP->pro_clone & IX86_CPUMASK) < 3) DisP->pro_clone = IX86_CPU386;
Use32Data = use32data;
ix86_CStile(str,tileptr);
}
void __FASTCALL__ ix86_ArgAXDigit(char * str,ix86Param *DisP)
{
char w = DisP->RealCmd[0] & 0x01;
strcat(str,ix86_getREG(0,w));
ix86_CStile(str,ix86_GetDigitTile(DisP,w,0,1));
}
void __FASTCALL__ ix86_ArgRMDigit(char * str,ix86Param *DisP)
{
char w = DisP->RealCmd[0] & 0x01;
char mod = (DisP->RealCmd[1] & 0xC0) >> 6;
char rm = (DisP->RealCmd[1] & 0x07);
char *a1,*a2;
DisP->codelen++;
a1 = ix86_getModRM(w,mod,rm,DisP);
strcat(str,a1);
a2 = ix86_GetDigitTile(DisP,w,0,DisP->codelen);
ix86_CStile(str,a2);
}
void __FASTCALL__ ix86_ArgIRegDigit(char * str,ix86Param *DisP)
{
char w = (DisP->RealCmd[0] >> 3 ) & 0x01;
char reg = (DisP->RealCmd[0]) & 0x07;
strcat(str,ix86_getREG(reg,w));
ix86_CStile(str,ix86_GetDigitTile(DisP,w,0,1));
}
void __FASTCALL__ ix86_ArgIReg(char *str,ix86Param *DisP)
{
strcat(str,ix86_getREG(DisP->RealCmd[0] & 0x07,True));
}
void __FASTCALL__ ix86_ArgAXIReg(char *str,ix86Param *DisP)
{
strcat(str,ix86_getREG(0,True));
ix86_CStile(str,ix86_getREG(DisP->RealCmd[0] & 0x07,True));
}
void __FASTCALL__ ix86_ArgSInt(char *str,ix86Param *DisP)
{
ix86_setModifier(str,Use32Data ? ix86_sizes[DWORD_PTR] : ix86_sizes[WORD_PTR]);
if(!((DisP->flags & __DISF_SIZEONLY) == __DISF_SIZEONLY))
disAppendDigits(str,DisP->CodeAddress + DisP->codelen,
APREF_USE_TYPE,1,&DisP->RealCmd[DisP->codelen],DISARG_CHAR);
DisP->codelen++;
}
void __FASTCALL__ ix86_ArgInt(char *str,ix86Param *DisP)
{
Use32Data ? ix86_ArgDWord(str,DisP) : ix86_ArgWord(str,DisP);
}
void __FASTCALL__ ix86_ArgRegRMDigit(char *str,ix86Param *DisP)
{
char * a1,*a2;
char nw = DisP->RealCmd[0] & 0x02;
DisP->codelen++;
a1 = ix86_getTileWD(DisP);
strcat(str,a1);
a2 = ix86_GetDigitTile(DisP,!nw,0,DisP->codelen);
ix86_CStile(str,a2);
}
static void __FASTCALL__ ix86_ArgRmDigit(char *str,ix86Param *DisP,char w,char s)
{
char mod = (DisP->RealCmd[1] >> 6) & 0x03;
char rm = (DisP->RealCmd[1] & 0x07);
DisP->codelen++;
strcat(str,ix86_getModRM(w == 2 ? True : w,mod,rm,DisP));
strcat(str,",");
strcat(str,ix86_GetDigitTile(DisP,w == 2 ? 0 : w,s,DisP->codelen));
}
void __FASTCALL__ ix86_ArgOp1(char *str,ix86Param *DisP)
{
unsigned char w;
unsigned char idx;
w = DisP->RealCmd[0] & 0x01;
idx = (DisP->RealCmd[1] & 0x38) >> 3;
strcpy(str,ix86_Op1Names[idx]);
TabSpace(str,TAB_POS);
ix86_ArgRmDigit(str,DisP,w,idx == 0 || idx == 2 || idx == 3 || idx == 5 ? 1 : 0);
}
void __FASTCALL__ ix86_ArgOp2(char *str,ix86Param *DisP)
{
unsigned char w;
unsigned char idx;
w = DisP->RealCmd[0] & 0x01;
idx = (DisP->RealCmd[1] & 0x38) >> 3;
strcpy(str,ix86_Op1Names[idx]);
TabSpace(str,TAB_POS);
if(w) ix86_setModifier(str,Use32Data ? ix86_sizes[DWORD_PTR] : ix86_sizes[WORD_PTR]);
ix86_ArgRmDigit(str,DisP,w ? 2 : w, w ? 1 : 0);
}
void __FASTCALL__ ix86_ShOp2(char *str,ix86Param *DisP)
{
char *a1,*a2;
unsigned char code2 = ( DisP->RealCmd[1] & 0x38 ) >> 3;
unsigned char mod = (DisP->RealCmd[1] >> 6) & 0x03;
unsigned char rm = (DisP->RealCmd[1] & 0x07);
unsigned char w = DisP->RealCmd[0] & 0x01;
DisP->codelen++;
strcpy(str,ix86_ShNames[code2]);
TabSpace(str,TAB_POS);
ix86_setModifier(str,w ? Use32Data ? ix86_sizes[DWORD_PTR] : ix86_sizes[WORD_PTR] : ix86_sizes[BYTE_PTR]);
a1 = ix86_getModRM(w,mod,rm,DisP);
strcat(str,a1);
a2 = ix86_GetDigitTile(DisP,0,0,DisP->codelen);
ix86_CStile(str,a2);
}
void __FASTCALL__ ix86_ShOp1(char *str,ix86Param *DisP)
{
char *a1;
unsigned char code2 = ( DisP->RealCmd[1] & 0x38 ) >> 3;
unsigned char mod = (DisP->RealCmd[1] >> 6) & 0x03;
unsigned char rm = (DisP->RealCmd[1] & 0x07);
unsigned char w = DisP->RealCmd[0] & 0x01;
DisP->codelen++;
a1 = ix86_getModRM(w,mod,rm,DisP);
strcpy(str,ix86_ShNames[code2]);
TabSpace(str,TAB_POS);
ix86_setModifier(str,w ? Use32Data ? ix86_sizes[DWORD_PTR] : ix86_sizes[WORD_PTR] : ix86_sizes[BYTE_PTR]);
strcat(str,a1);
ix86_CStile(str,"1");
}
void __FASTCALL__ ix86_ShOpCL(char *str,ix86Param *DisP)
{
char *a1;
unsigned char code2 = ( DisP->RealCmd[1] & 0x38 ) >> 3;
unsigned char mod = (DisP->RealCmd[1] >> 6) & 0x03;
unsigned char rm = (DisP->RealCmd[1] & 0x07);
unsigned char w = DisP->RealCmd[0] & 0x01;
DisP->codelen++;
a1 = ix86_getModRM(w,mod,rm,DisP);
strcpy(str,ix86_ShNames[code2]);
TabSpace(str,TAB_POS);
ix86_setModifier(str,w ? Use32Data ? ix86_sizes[DWORD_PTR] : ix86_sizes[WORD_PTR] : ix86_sizes[BYTE_PTR]);
strcat(str,a1);
ix86_CStile(str,"cl");
}
void __FASTCALL__ ix86_ArgGrp1(char *str,ix86Param *DisP)
{
unsigned char code2 = ( DisP->RealCmd[1] & 0x38 ) >> 3;
unsigned char mod = (DisP->RealCmd[1] >> 6) & 0x03;
unsigned char rm = (DisP->RealCmd[1] & 0x07);
unsigned char w = DisP->RealCmd[0] & 0x01;
strcpy(str,ix86_Gr1Names[code2]);
TabSpace(str,TAB_POS);
DisP->codelen++;
ix86_setModifier(str,w ? Use32Data ? ix86_sizes[DWORD_PTR] : ix86_sizes[WORD_PTR] : ix86_sizes[BYTE_PTR]);
if(!code2) /** test only */
{
strcat(str,ix86_getModRM(w,mod,rm,DisP));
ix86_CStile(str,ix86_GetDigitTile(DisP,w == 2 ? 0 : w,0,DisP->codelen));
}
else
strcat(str,ix86_getModRM(w,mod,rm,DisP));
}
void __FASTCALL__ ix86_ArgGrp2(char *str,ix86Param *DisP)
{
unsigned char code2 = ( DisP->RealCmd[1] & 0x38 ) >> 3;
unsigned char mod = (DisP->RealCmd[1] >> 6) & 0x03;
unsigned char rm = (DisP->RealCmd[1] & 0x07);
unsigned char w = DisP->RealCmd[0] & 0x01;
unsigned char wrd = code2 & 0x01;
unsigned char sizptr;
unsigned oldDisNeedRef;
DisP->codelen++;
strcpy(str,ix86_Gr2Names[code2]);
/*
Added by "Kostya Nosov" <k-nosov@yandex.ru>:
make NEEDREF_ALL for indirect "jmp" and "call"
*/
oldDisNeedRef = disNeedRef;
if(code2 >= 2 && code2 <= 5 && disNeedRef != NEEDREF_NONE)
disNeedRef = NEEDREF_ALL;
TabSpace(str,TAB_POS);
if(code2 == 0 || code2 == 1) { strcat(str,ix86_getModRM(w,mod,rm,DisP)); } /** inc dec */
else
{
wrd = code2 == 0x06 || code2 == 0x07 ? 0 : wrd; /** push / pop; */
if(!wrd) sizptr = Use32Data ? DWORD_PTR : WORD_PTR;
else sizptr = Use32Data ? PWORD_PTR : DWORD_PTR;
ix86_setModifier(str,ix86_sizes[sizptr]);
strcat(str,ix86_getModRM(True,mod,rm,DisP));
}
disNeedRef = oldDisNeedRef;
}
void __FASTCALL__ ix86_ArgAXMem(char *str,ix86Param *DisP)
{
unsigned char d = DisP->RealCmd[0] & 0x02;
const char *mem,*reg;
mem = Use32Addr ? Get8SquareDig(1,DisP,False,True) : Get4SquareDig(1,DisP,False,True);
strcpy(ix86_appstr,ix86_segpref);
ix86_segpref[0] = 0;
strcat(ix86_appstr,"[");
strcat(ix86_appstr,mem);
strcat(ix86_appstr,"]");
reg = ix86_getREG(0,DisP->RealCmd[0] & 0x01);
DisP->codelen = Use32Addr ? 5 : 3;
strcat(str,d ? ix86_appstr : reg);
ix86_CStile(str,d ? reg : ix86_appstr);
}
void __FASTCALL__ ix86_InOut(char * str,ix86Param *DisP)
{
const char *arg,*reg1,*reg2,*regptr,*dig;
char i;
regptr = ix86_getREG(0,DisP->RealCmd[0] & 0x01);
dig = Get2Digit(DisP->RealCmd[1]);
i = DisP->RealCmd[0] & 0x08;
if(!i) DisP->codelen++;
arg = i ? "dx" : dig;
if(DisP->RealCmd[0] & 0x02)
{
reg1 = arg;
reg2 = regptr;
}
else
{
reg1 = regptr;
reg2 = arg;
}
strcat(str,reg1);
ix86_CStile(str,reg2);
}
/** 0f xx opcodes */
void __FASTCALL__ ix86_ExOpCodes(char *str,ix86Param *DisP)
{
unsigned char code;
DisP->RealCmd = &DisP->RealCmd[1];
code = DisP->RealCmd[0];
DisP->codelen++;
strcpy(str,ix86_extable[code].name);
if(ix86_extable[code].method)
{
TabSpace(str,TAB_POS);
ix86_extable[code].method(str,DisP);
}
if(DisP->pro_clone < ix86_extable[code].pro_clone) DisP->pro_clone = ix86_extable[code].pro_clone;
}
void __FASTCALL__ ix86_ArgExGr0(char *str,ix86Param *DisP)
{
unsigned char rm = (DisP->RealCmd[1] & 0x38) >> 3;
unsigned char reg = (DisP->RealCmd[1] & 0x07);
unsigned char mod = (DisP->RealCmd[1] & 0xC0) >> 6;
strcpy(str,ix86_ExGrp0[rm]);
TabSpace(str,TAB_POS);
DisP->codelen++;
ix86_setModifier(str,ix86_sizes[WORD_PTR]);
strcat(str,ix86_getModRM(True,mod,reg,DisP));
}
void __FASTCALL__ ix86_ArgExGr1(char *str,ix86Param *DisP)
{
unsigned char rm = (DisP->RealCmd[1] & 0x38) >> 3;
unsigned char reg = (DisP->RealCmd[1] & 0x07);
unsigned char mod = (DisP->RealCmd[1] & 0xC0) >> 6;
unsigned char buf,ptr;
tBool word;
strcpy(str,ix86_ExGrp1[rm]);
TabSpace(str,TAB_POS);
DisP->codelen++;
buf = DisP->RealCmd[1];
ptr = PWORD_PTR;
word = True;
if(rm == 7)
{
word = False;
DisP->pro_clone = IX86_CPU486;
buf = 1;
ptr = DUMMY_PTR;
}
else if(rm == 4 || rm == 6) ptr = WORD_PTR;
ix86_setModifier(str,ix86_sizes[ptr]);
strcat(str,ix86_getModRM(word ? True : buf & 0x01,mod,reg,DisP));
}
static const char ** xry[] = { ix86_CrxRegs, ix86_DrxRegs, ix86_TrxRegs, ix86_XrxRegs };
void __FASTCALL__ ix86_ArgMovXRY(char *str,ix86Param *DisP)
{
unsigned char code = DisP->RealCmd[0];
unsigned char xreg = (DisP->RealCmd[1] & 0x38) >> 3;
unsigned char reg = DisP->RealCmd[1] & 0x07;
unsigned char ridx = (code & 0x01) + ((code >> 1) & 0x02);
unsigned char d = (code >> 1) & 0x01;
DisP->codelen++;
Use32Data = True;
strcat(str,d ? xry[ridx][xreg] : ix86_getREG(reg,True));
ix86_CStile(str,d ? ix86_getREG(reg,True) : xry[ridx][xreg]);
}
void __FASTCALL__ ix86_DblShift(char *str,ix86Param *DisP)
{
unsigned char code = DisP->RealCmd[0];
const char *a1,*a2;
a1 = ix86_getTileWnD(DisP);
strcat(str,a1);
a2 = code & 0x01 ? "cl" : ix86_GetDigitTile(DisP,0,0,DisP->codelen);
ix86_CStile(str,a2);
DisP->codelen++;
}
/* MMX and SSE(2) opcodes */
static void __NEAR__ __FASTCALL__ ix86_ArgxMM(char *str,ix86Param *DisP,tBool direct,tBool as_xmmx)
{
if(as_xmmx) UseXMMXSet = True;
else UseMMXSet = True;
if((DisP->RealCmd[1] & 0xC0) != 0xC0)
{
direct ? ix86_ArgModRMnDW(str,DisP) : ix86_ArgModRMDW(str,DisP);
if(as_xmmx) UseXMMXSet = False;
else UseMMXSet = False;
}
else
{
const char *mmx,*exx;
mmx = ix86_getREG((DisP->RealCmd[1] >> 3) & 0x07,True);
if(as_xmmx) UseXMMXSet = False;
else UseMMXSet = False;
exx = ix86_getREG(DisP->RealCmd[1] & 0x07,True);
strcat(str,direct ? exx : mmx);
strcat(str,",");
strcat(str,direct ? mmx : exx);
DisP->codelen++;
}
}
static void __NEAR__ __FASTCALL__ ix86_ArgxMMRev(char *str,ix86Param *DisP,tBool direct,tBool as_xmmx)
{
if(as_xmmx) UseXMMXSet = True;
else UseMMXSet = True;
if((DisP->RealCmd[1] & 0xC0) != 0xC0)
{
direct ? ix86_ArgModRMnDW(str,DisP) : ix86_ArgModRMDW(str,DisP);
if(as_xmmx) UseXMMXSet = True;
else UseMMXSet = False;
}
else
{
const char *mmx,*exx;
mmx = ix86_getREG(DisP->RealCmd[1] & 0x07,True);
if(as_xmmx) UseXMMXSet = False;
else UseMMXSet = False;
exx = ix86_getREG((DisP->RealCmd[1] >> 3) & 0x07,True);
strcat(str,direct ? exx : mmx);
strcat(str,",");
strcat(str,direct ? mmx : exx);
DisP->codelen++;
}
}
static void __NEAR__ __FASTCALL__ ix86_ArgxMMXGroup(char *str,const char *name,ix86Param *DisP,tBool as_xmmx)
{
DisP->codelen++;
strcpy(str,name);
TabSpace(str,TAB_POS);
if(as_xmmx) UseXMMXSet = True;
else UseMMXSet = True;
strcat(str,ix86_getREG(DisP->RealCmd[1] & 0x07,True));
if(as_xmmx) UseXMMXSet = False;
else UseMMXSet = False;
strcat(str,",");
strcat(str,Get2Digit(DisP->RealCmd[2]));
DisP->codelen++;
}
/* This function does not have analogs from MMX set. SSE(2) only */
static void __NEAR__ __FASTCALL__ ix86_ArgRXMM(char *str,ix86Param *DisP,tBool direct)
{
UseXMMXSet = True;
if((DisP->RealCmd[1] & 0xC0) != 0xC0)
{
direct ? ix86_ArgModRMnDW(str,DisP) : ix86_ArgModRMDW(str,DisP);
UseXMMXSet = False;
}
else
{
const char *mmx,*exx;
mmx = ix86_getREG((DisP->RealCmd[1] >> 3) & 0x07,True);
UseXMMXSet = False;
exx = ix86_getREG(DisP->RealCmd[1] & 0x07,True);
strcat(str,direct ? exx : mmx);
strcat(str,",");
strcat(str,direct ? mmx : exx);
DisP->codelen++;
}
}
static void __NEAR__ __FASTCALL__ ix86_ArgRxMMRev(char *str,ix86Param *DisP,tBool direct,tBool as_xmmx)
{
if((DisP->RealCmd[1] & 0xC0) != 0xC0)
{
direct ? ix86_ArgModRMnDW(str,DisP) : ix86_ArgModRMDW(str,DisP);
}
else
{
const char *mmx,*exx;
if(as_xmmx) UseXMMXSet = True;
else UseMMXSet = True;
mmx = ix86_getREG(DisP->RealCmd[1] & 0x07,True);
if(as_xmmx) UseXMMXSet = False;
else UseMMXSet = False;
exx = ix86_getREG((DisP->RealCmd[1] >> 3) & 0x07,True);
strcat(str,direct ? mmx : exx);
strcat(str,",");
strcat(str,direct ? exx : mmx);
DisP->codelen++;
}
}
static void __NEAR__ __FASTCALL__ ix86_ArgxMMxMM(char *str,ix86Param *DisP,tBool direct,tBool xmmx_first)
{
if(xmmx_first) UseXMMXSet = True;
else UseMMXSet = True;
if((DisP->RealCmd[1] & 0xC0) != 0xC0)
{
direct ? ix86_ArgModRMnDW(str,DisP) : ix86_ArgModRMDW(str,DisP);
if(xmmx_first) UseXMMXSet = False;
else UseMMXSet = False;
}
else
{
const char *mmx,*exx;
mmx = ix86_getREG((DisP->RealCmd[1] >> 3) & 0x07,True);
if(xmmx_first)
{
UseXMMXSet = False;
UseMMXSet = True;
}
else
{
UseXMMXSet = True;
UseMMXSet = False;
}
exx = ix86_getREG(DisP->RealCmd[1] & 0x07,True);
if(xmmx_first) UseMMXSet = False;
else UseXMMXSet = False;
strcat(str,direct ? exx : mmx);
strcat(str,",");
strcat(str,direct ? mmx : exx);
DisP->codelen++;
}
}
void __FASTCALL__ ix86_ArgMMXD(char *str,ix86Param *DisP)
{
UseMMXSet = True;
ix86_ArgModRMnDW(str,DisP);
UseMMXSet = False;
}
void __FASTCALL__ ix86_ArgMMXnD(char *str,ix86Param *DisP)
{
UseMMXSet = True;
ix86_ArgModRMDW(str,DisP);
UseMMXSet = False;
}
void __FASTCALL__ ix86_ArgMMXRnD(char *str,ix86Param *DisP)
{
ix86_ArgxMM(str,DisP,False,False);
}
void __FASTCALL__ ix86_ArgMMXRD(char *str,ix86Param *DisP)
{
ix86_ArgxMM(str,DisP,True,False);
}
void __FASTCALL__ ix86_ArgMMXGr1(char *str,ix86Param *DisP)
{
ix86_ArgxMMXGroup(str,ix86_MMXGr1[(DisP->RealCmd[1] >> 3) & 0x07],DisP,False);
}
void __FASTCALL__ ix86_ArgMMXGr2(char *str,ix86Param *DisP)
{
ix86_ArgxMMXGroup(str,ix86_MMXGr2[(DisP->RealCmd[1] >> 3) & 0x07],DisP,False);
}
void __FASTCALL__ ix86_ArgMMXGr3(char *str,ix86Param *DisP)
{
ix86_ArgxMMXGroup(str,ix86_MMXGr3[(DisP->RealCmd[1] >> 3) & 0x07],DisP,False);
}
void __FASTCALL__ ix86_ArgXMMXGr1(char *str,ix86Param *DisP)
{
ix86_ArgxMMXGroup(str,ix86_XMMXGr1[(DisP->RealCmd[1] >> 3) & 0x07],DisP,True);
}
void __FASTCALL__ ix86_ArgXMMXGr2(char *str,ix86Param *DisP)
{
ix86_ArgxMMXGroup(str,ix86_XMMXGr2[(DisP->RealCmd[1] >> 3) & 0x07],DisP,True);
}
void __FASTCALL__ ix86_ArgXMMXGr3(char *str,ix86Param *DisP)
{
ix86_ArgxMMXGroup(str,ix86_XMMXGr3[(DisP->RealCmd[1] >> 3) & 0x07],DisP,True);
}
void __FASTCALL__ ix86_ArgXMMXD(char *str,ix86Param *DisP)
{
UseXMMXSet = True;
ix86_ArgModRMnDW(str,DisP);
UseXMMXSet = False;
}
void __FASTCALL__ ix86_ArgXMMXnD(char *str,ix86Param *DisP)
{
UseXMMXSet = True;
ix86_ArgModRMDW(str,DisP);
UseXMMXSet = False;
}
void __FASTCALL__ ix86_ArgXMMXRnD(char *str,ix86Param *DisP)
{
ix86_ArgxMM(str,DisP,False,True);
}
void __FASTCALL__ ix86_ArgXMMXRD(char *str,ix86Param *DisP)
{
ix86_ArgxMM(str,DisP,True,True);
}
void __FASTCALL__ ix86_ArgRXMMXnD(char *str,ix86Param *DisP)
{
ix86_ArgRXMM(str,DisP,False);
}
void __FASTCALL__ ix86_ArgRXMMXD(char *str,ix86Param *DisP)
{
ix86_ArgRXMM(str,DisP,True);
}
void __FASTCALL__ ix86_ArgRXMMXRevnD(char *str,ix86Param *DisP)
{
ix86_ArgRxMMRev(str,DisP,False,True);
}
void __FASTCALL__ ix86_ArgRXMMXRevD(char *str,ix86Param *DisP)
{
ix86_ArgRxMMRev(str,DisP,True,True);
}
void __FASTCALL__ ix86_ArgRMMXRevnD(char *str,ix86Param *DisP)
{
ix86_ArgRxMMRev(str,DisP,False,False);
}
void __FASTCALL__ ix86_ArgRMMXRevD(char *str,ix86Param *DisP)
{
ix86_ArgRxMMRev(str,DisP,True,False);
}
void __FASTCALL__ ix86_ArgXMMXMMnD(char *str,ix86Param *DisP)
{
ix86_ArgxMMxMM(str,DisP,False,True);
}
void __FASTCALL__ ix86_ArgXMMXMMD(char *str,ix86Param *DisP)
{
ix86_ArgxMMxMM(str,DisP,True,True);
}
void __FASTCALL__ ix86_ArgMMXMMXnD(char *str,ix86Param *DisP)
{
ix86_ArgxMMxMM(str,DisP,False,False);
}
void __FASTCALL__ ix86_ArgMMXMMXD(char *str,ix86Param *DisP)
{
ix86_ArgxMMxMM(str,DisP,True,False);
}
void __FASTCALL__ ix86_ArgMovYX(char *str,ix86Param *DisP)
{
const char *dst,*src;
unsigned char mod;
tBool u32data;
mod = (DisP->RealCmd[1] >> 6) & 0x03;
ix86_setModifier(str,DisP->RealCmd[0] & 0x01 ? Use32Data ? ix86_sizes[DWORD_PTR] : ix86_sizes[WORD_PTR] : ix86_sizes[BYTE_PTR]);
dst = ix86_getREG((DisP->RealCmd[1] >> 3) & 0x07,True);
u32data = Use32Data;
Use32Data = False;
src = ix86_getModRM(DisP->RealCmd[0] & 0x01,mod,DisP->RealCmd[1] & 0x07,DisP);
Use32Data = u32data;
strcat(str,dst);
strcat(str,",");
strcat(str,src);
DisP->codelen++;
}
void __FASTCALL__ ix86_BitGrp(char *str,ix86Param *DisP)
{
unsigned char idx;
char mod = (DisP->RealCmd[1] >> 6) & 0x03;
char rm = (DisP->RealCmd[1] & 0x07);
idx = (DisP->RealCmd[1] & 0x38) >> 3;
strcpy(str,ix86_BitGrpNames[idx]);
TabSpace(str,TAB_POS);
strcat(str,ix86_getModRM(True,mod,rm,DisP));
strcat(str,",");
strcat(str,ix86_GetDigitTile(DisP,0,0,DisP->codelen++));
}
void __FASTCALL__ ix86_ArgKatmaiGrp1(char *str,ix86Param *DisP)
{
unsigned char code2 = ( DisP->RealCmd[1] & 0x38 ) >> 3;
strcpy(str,ix86_KatmaiGr1Names[code2]);
if(code2 < 5)
{
TabSpace(str,TAB_POS);
ix86_ArgMod(str,DisP);
}
else DisP->codelen++;
if(code2 == 5 || code2 == 6) DisP->pro_clone = IX86_P4MMX;
}
void __FASTCALL__ ix86_ArgKatmaiGrp2(char *str,ix86Param *DisP)
{
unsigned char code2 = ( DisP->RealCmd[1] & 0x38 ) >> 3;
strcpy(str,ix86_KatmaiGr2Names[code2]);
TabSpace(str,TAB_POS);
ix86_ArgMod(str,DisP);
}
void __FASTCALL__ ix86_ArgXMMRMDigit(char *str,ix86Param *DisP)
{
char * a1,*a2;
UseXMMXSet = True;
DisP->codelen++;
a1 = ix86_getTileWD(DisP);
strcat(str,a1);
a2 = ix86_GetDigitTile(DisP,0,0,DisP->codelen-1);
ix86_CStile(str,a2);
UseXMMXSet = False;
}
void __FASTCALL__ ix86_ArgMMRMDigit(char *str,ix86Param *DisP)
{
char * a1,*a2;
DisP->codelen++;
UseMMXSet = True;
a1 = ix86_getTileWD(DisP);
strcat(str,a1);
a2 = ix86_GetDigitTile(DisP,0,0,DisP->codelen-1);
ix86_CStile(str,a2);
UseMMXSet = False;
}
void __FASTCALL__ ix86_ArgRegXMMDigit(char *str,ix86Param *DisP)
{
char * a1;
ix86_ArgxMMRev(str,DisP,True,False);
a1 = ix86_GetDigitTile(DisP,0,0,DisP->codelen-1);
ix86_CStile(str,a1);
}
void __FASTCALL__ ix86_ArgRegXMMXDigit(char *str,ix86Param *DisP)
{
char * a1;
ix86_ArgxMMRev(str,DisP,True,True);
a1 = ix86_GetDigitTile(DisP,0,0,DisP->codelen-1);
ix86_CStile(str,a1);
}
void __FASTCALL__ ix86_ArgXMMRegDigit(char *str,ix86Param *DisP)
{
char * a1;
ix86_ArgMMXRnD(str,DisP);
a1 = ix86_GetDigitTile(DisP,0,0,DisP->codelen-1);
ix86_CStile(str,a1);
}
void __FASTCALL__ ix86_ArgXMMXRegDigit(char *str,ix86Param *DisP)
{
char * a1;
ix86_ArgRXMMXnD(str,DisP);
a1 = ix86_GetDigitTile(DisP,0,0,DisP->codelen-1);
ix86_CStile(str,a1);
}
void __FASTCALL__ ix86_3dNowOpCodes( char *str,ix86Param *DisP)
{
unsigned char code;
UseMMXSet = True;
ix86_Katmai_buff[0] = 0;
ix86_ArgModRMDW(ix86_Katmai_buff,DisP);
UseMMXSet = False;
code = DisP->RealCmd[DisP->codelen-1];
DisP->codelen++;
strcpy(str,ix86_3dNowtable[code].name);
TabSpace(str,TAB_POS);
strcat(str,ix86_Katmai_buff);
DisP->pro_clone = ix86_3dNowtable[code].pro_clone;
}
|