Changeset 609 for branches/GNU/src/binutils/opcodes/hppa-dis.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/opcodes/hppa-dis.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c. 2 Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001 2 Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2003 3 3 Free Software Foundation, Inc. 4 4 … … 27 27 /* Integer register names, indexed by the numbers which appear in the 28 28 opcodes. */ 29 static const char *const reg_names[] = 29 static const char *const reg_names[] = 30 30 {"flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", "r8", "r9", 31 31 "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", … … 35 35 /* Floating point register names, indexed by the numbers which appear in the 36 36 opcodes. */ 37 static const char *const fp_reg_names[] = 38 {"fpsr", "fpe2", "fpe4", "fpe6", 39 "fr4", "fr5", "fr6", "fr7", "fr8", 40 "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", 37 static const char *const fp_reg_names[] = 38 {"fpsr", "fpe2", "fpe4", "fpe6", 39 "fr4", "fr5", "fr6", "fr7", "fr8", 40 "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", 41 41 "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23", 42 42 "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31"}; … … 124 124 }; 125 125 static const char *const float_format_names[] = {",sgl", ",dbl", "", ",quad"}; 126 static const char *const fcnv_fixed_names[] = {",w", ",dw", "", ",qw"}; 127 static const char *const fcnv_ufixed_names[] = {",uw", ",udw", "", ",uqw"}; 126 128 static const char *const float_comp_names[] = 127 129 { … … 137 139 static const char *const add_compl_names[] = { 0, "", ",l", ",tsv" }; 138 140 139 /* For a bunch of different instructions form an index into a 141 /* For a bunch of different instructions form an index into a 140 142 completer name table. */ 141 143 #define GET_COMPL(insn) (GET_FIELD (insn, 26, 26) | \ … … 195 197 (*info->fprintf_func) (info->stream, "fpe%d", reg * 2 + 1); 196 198 else 197 (*info->fprintf_func) (info->stream, "%sR", reg ? fp_reg_names[reg]198 199 (*info->fprintf_func) (info->stream, "%sR", 200 reg ? fp_reg_names[reg] : "fr0"); 199 201 } 200 202 … … 337 339 { 338 340 return sign_extend (GET_FIELD (word, 19, 28) | 339 340 341 GET_FIELD (word, 29, 29) << 10 | 342 (word & 0x1) << 11, 12) << 2; 341 343 } 342 344 … … 349 351 { 350 352 return sign_extend (GET_FIELD (word, 19, 28) | 351 352 353 353 GET_FIELD (word, 29, 29) << 10 | 354 GET_FIELD (word, 11, 15) << 11 | 355 (word & 0x1) << 16, 17) << 2; 354 356 } 355 357 … … 359 361 { 360 362 return sign_extend (GET_FIELD (word, 19, 28) | 361 362 363 364 363 GET_FIELD (word, 29, 29) << 10 | 364 GET_FIELD (word, 11, 15) << 11 | 365 GET_FIELD (word, 6, 10) << 16 | 366 (word & 0x1) << 21, 22) << 2; 365 367 } 366 368 … … 398 400 (*info->fprintf_func) (info->stream, "%s", opcode->name); 399 401 400 if (!strchr ("cfCY?-+nHNZFIuv ", opcode->args[0]))402 if (!strchr ("cfCY?-+nHNZFIuv{", opcode->args[0])) 401 403 (*info->fprintf_func) (info->stream, " "); 402 404 for (s = opcode->args; *s != '\0'; ++s) … … 418 420 break; 419 421 420 /* Handle floating point registers. */422 /* Handle floating point registers. */ 421 423 case 'f': 422 424 switch (*++s) … … 438 440 break; 439 441 440 /* 'fA' will not generate a space before the regsiter441 name. Normally that is fine. Except that it442 causes problems with xmpyu which has no FP format443 completer. */442 /* 'fA' will not generate a space before the regsiter 443 name. Normally that is fine. Except that it 444 causes problems with xmpyu which has no FP format 445 completer. */ 444 446 case 'X': 445 447 fputs_filtered (" ", info); 446 447 /* FALLTHRU */ 448 /* FALLTHRU */ 448 449 449 450 case 'A': … … 452 453 else 453 454 fput_fp_reg (GET_FIELD (insn, 6, 10), info); 454 455 455 break; 456 456 case 'b': … … 517 517 } 518 518 519 /* 'fe' will not generate a space before the register520 name. Normally that is fine. Except that it521 causes problems with fstw fe,y(b) which has no FP522 format completer. */519 /* 'fe' will not generate a space before the register 520 name. Normally that is fine. Except that it 521 causes problems with fstw fe,y(b) which has no FP 522 format completer. */ 523 523 case 'E': 524 524 fputs_filtered (" ", info); 525 526 /* FALLTHRU */ 525 /* FALLTHRU */ 527 526 528 527 case 'e': … … 542 541 break; 543 542 case 's': 544 (*info->fprintf_func) (info->stream, 545 "sr%d", GET_FIELD (insn, 16, 17)); 543 { 544 int space = GET_FIELD (insn, 16, 17); 545 /* Zero means implicit addressing, not use of sr0. */ 546 if (space != 0) 547 (*info->fprintf_func) (info->stream, "sr%d", space); 548 } 546 549 break; 547 550 548 551 case 'S': 549 (*info->fprintf_func) (info->stream, "sr%d", extract_3 (insn)); 550 break; 551 552 /* Handle completers. */ 552 (*info->fprintf_func) (info->stream, "sr%d", 553 extract_3 (insn)); 554 break; 555 556 /* Handle completers. */ 553 557 case 'c': 554 558 switch (*++s) 555 559 { 556 560 case 'x': 557 (*info->fprintf_func) (info->stream, "%s ", 558 index_compl_names[GET_COMPL (insn)]); 561 (*info->fprintf_func) 562 (info->stream, "%s", 563 index_compl_names[GET_COMPL (insn)]); 564 break; 565 case 'X': 566 (*info->fprintf_func) 567 (info->stream, "%s ", 568 index_compl_names[GET_COMPL (insn)]); 559 569 break; 560 570 case 'm': 561 (*info->fprintf_func) (info->stream, "%s ", 562 short_ldst_compl_names[GET_COMPL (insn)]); 571 (*info->fprintf_func) 572 (info->stream, "%s", 573 short_ldst_compl_names[GET_COMPL (insn)]); 574 break; 575 case 'M': 576 (*info->fprintf_func) 577 (info->stream, "%s ", 578 short_ldst_compl_names[GET_COMPL (insn)]); 579 break; 580 case 'A': 581 (*info->fprintf_func) 582 (info->stream, "%s ", 583 short_bytes_compl_names[GET_COMPL (insn)]); 563 584 break; 564 585 case 's': 565 (*info->fprintf_func) (info->stream, "%s ", 566 short_bytes_compl_names[GET_COMPL (insn)]); 586 (*info->fprintf_func) 587 (info->stream, "%s", 588 short_bytes_compl_names[GET_COMPL (insn)]); 567 589 break; 568 590 case 'c': … … 607 629 break; 608 630 case 'w': 609 (*info->fprintf_func) (info->stream, "%s ", 610 read_write_names[GET_FIELD (insn, 25, 25)]); 631 (*info->fprintf_func) 632 (info->stream, "%s ", 633 read_write_names[GET_FIELD (insn, 25, 25)]); 611 634 break; 612 635 case 'W': … … 633 656 case 'a': 634 657 (*info->fprintf_func) 635 (info->stream, "%s", add_compl_names[GET_FIELD636 658 (info->stream, "%s", 659 add_compl_names[GET_FIELD (insn, 20, 21)]); 637 660 break; 638 661 case 'Y': 639 662 (*info->fprintf_func) 640 (info->stream, ",dc%s", add_compl_names[GET_FIELD641 663 (info->stream, ",dc%s", 664 add_compl_names[GET_FIELD (insn, 20, 21)]); 642 665 break; 643 666 case 'y': 644 667 (*info->fprintf_func) 645 (info->stream, ",c%s", add_compl_names[GET_FIELD646 668 (info->stream, ",c%s", 669 add_compl_names[GET_FIELD (insn, 20, 21)]); 647 670 break; 648 671 case 'v': … … 673 696 if (*(s + 1) == '?') 674 697 (*info->fprintf_func) 675 (info->stream, "%s", signed_unsigned_names[GET_FIELD676 698 (info->stream, "%s", 699 signed_unsigned_names[GET_FIELD (insn, 21, 21)]); 677 700 else 678 701 (*info->fprintf_func) 679 (info->stream, "%s ", signed_unsigned_names[GET_FIELD680 702 (info->stream, "%s ", 703 signed_unsigned_names[GET_FIELD (insn, 21, 21)]); 681 704 break; 682 705 case 'h': 683 706 (*info->fprintf_func) 684 (info->stream, "%s", mix_half_names[GET_FIELD685 707 (info->stream, "%s", 708 mix_half_names[GET_FIELD (insn, 17, 17)]); 686 709 break; 687 710 case 'H': 688 711 (*info->fprintf_func) 689 (info->stream, "%s", saturation_names[GET_FIELD690 712 (info->stream, "%s ", 713 saturation_names[GET_FIELD (insn, 24, 25)]); 691 714 break; 692 715 case '*': 693 716 (*info->fprintf_func) 694 695 696 717 (info->stream, ",%d%d%d%d ", 718 GET_FIELD (insn, 17, 18), GET_FIELD (insn, 20, 21), 719 GET_FIELD (insn, 22, 23), GET_FIELD (insn, 24, 25)); 697 720 break; 698 721 … … 755 778 break; 756 779 757 /* Handle conditions. */780 /* Handle conditions. */ 758 781 case '?': 759 782 { … … 762 785 { 763 786 case 'f': 764 (*info->fprintf_func) (info->stream, "%s ",765 float_comp_names[GET_FIELD766 767 break; 768 769 787 (*info->fprintf_func) 788 (info->stream, "%s ", 789 float_comp_names[GET_FIELD (insn, 27, 31)]); 790 break; 791 792 /* these four conditions are for the set of instructions 770 793 which distinguish true/false conditions by opcode 771 794 rather than by the 'f' bit (sigh): comb, comib, 772 795 addb, addib */ 773 796 case 't': 774 fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)],775 797 fputs_filtered 798 (compare_cond_names[GET_FIELD (insn, 16, 18)], info); 776 799 break; 777 800 case 'n': 778 fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18) 779 + GET_FIELD (insn, 4, 4) * 8], info); 801 fputs_filtered 802 (compare_cond_names[GET_FIELD (insn, 16, 18) 803 + GET_FIELD (insn, 4, 4) * 8], 804 info); 780 805 break; 781 806 case 'N': 782 fputs_filtered (compare_cond_64_names[GET_FIELD (insn, 16, 18) 783 + GET_FIELD (insn, 2, 2) * 8], info); 807 fputs_filtered 808 (compare_cond_64_names[GET_FIELD (insn, 16, 18) 809 + GET_FIELD (insn, 2, 2) * 8], 810 info); 784 811 break; 785 812 case 'Q': 786 fputs_filtered (cmpib_cond_64_names[GET_FIELD (insn, 16, 18)], 787 info); 813 fputs_filtered 814 (cmpib_cond_64_names[GET_FIELD (insn, 16, 18)], 815 info); 788 816 break; 789 817 case '@': 790 fputs_filtered (add_cond_names[GET_FIELD (insn, 16, 18) 791 + GET_FIELD (insn, 4, 4) * 8], info); 818 fputs_filtered 819 (add_cond_names[GET_FIELD (insn, 16, 18) 820 + GET_FIELD (insn, 4, 4) * 8], 821 info); 792 822 break; 793 823 case 's': 794 (*info->fprintf_func) (info->stream, "%s ", 795 compare_cond_names[GET_COND (insn)]); 824 (*info->fprintf_func) 825 (info->stream, "%s ", 826 compare_cond_names[GET_COND (insn)]); 796 827 break; 797 828 case 'S': 798 (*info->fprintf_func) (info->stream, "%s ", 799 compare_cond_64_names[GET_COND (insn)]); 829 (*info->fprintf_func) 830 (info->stream, "%s ", 831 compare_cond_64_names[GET_COND (insn)]); 800 832 break; 801 833 case 'a': 802 (*info->fprintf_func) (info->stream, "%s ", 803 add_cond_names[GET_COND (insn)]); 834 (*info->fprintf_func) 835 (info->stream, "%s ", 836 add_cond_names[GET_COND (insn)]); 804 837 break; 805 838 case 'A': 806 (*info->fprintf_func) (info->stream, "%s ", 807 add_cond_64_names[GET_COND (insn)]); 839 (*info->fprintf_func) 840 (info->stream, "%s ", 841 add_cond_64_names[GET_COND (insn)]); 808 842 break; 809 843 case 'd': 810 (*info->fprintf_func) (info->stream, "%s", 811 add_cond_names[GET_FIELD (insn, 16, 18)]); 844 (*info->fprintf_func) 845 (info->stream, "%s", 846 add_cond_names[GET_FIELD (insn, 16, 18)]); 812 847 break; 813 848 814 849 case 'W': 815 (*info->fprintf_func) 850 (*info->fprintf_func) 816 851 (info->stream, "%s", 817 wide_add_cond_names[GET_FIELD (insn, 16, 18) + 818 GET_FIELD (insn, 4, 4) * 8]);852 wide_add_cond_names[GET_FIELD (insn, 16, 18) + 853 GET_FIELD (insn, 4, 4) * 8]); 819 854 break; 820 855 821 856 case 'l': 822 (*info->fprintf_func) (info->stream, "%s ", 823 logical_cond_names[GET_COND (insn)]); 857 (*info->fprintf_func) 858 (info->stream, "%s ", 859 logical_cond_names[GET_COND (insn)]); 824 860 break; 825 861 case 'L': 826 (*info->fprintf_func) (info->stream, "%s ", 827 logical_cond_64_names[GET_COND (insn)]); 862 (*info->fprintf_func) 863 (info->stream, "%s ", 864 logical_cond_64_names[GET_COND (insn)]); 828 865 break; 829 866 case 'u': 830 (*info->fprintf_func) (info->stream, "%s ", 831 unit_cond_names[GET_COND (insn)]); 867 (*info->fprintf_func) 868 (info->stream, "%s ", 869 unit_cond_names[GET_COND (insn)]); 832 870 break; 833 871 case 'U': 834 (*info->fprintf_func) (info->stream, "%s ", 835 unit_cond_64_names[GET_COND (insn)]); 872 (*info->fprintf_func) 873 (info->stream, "%s ", 874 unit_cond_64_names[GET_COND (insn)]); 836 875 break; 837 876 case 'y': … … 848 887 break; 849 888 case 'X': 850 (*info->fprintf_func) (info->stream, "%s ", 851 shift_cond_64_names[GET_FIELD (insn, 16, 18)]); 889 (*info->fprintf_func) 890 (info->stream, "%s ", 891 shift_cond_64_names[GET_FIELD (insn, 16, 18)]); 852 892 break; 853 893 case 'B': … … 910 950 break; 911 951 case 'w': 912 (*info->print_address_func) (memaddr + 8 + extract_12 (insn),913 952 (*info->print_address_func) 953 (memaddr + 8 + extract_12 (insn), info); 914 954 break; 915 955 case 'W': 916 956 /* 17 bit PC-relative branch. */ 917 (*info->print_address_func) ((memaddr + 8 918 + extract_17 (insn)), 919 info); 957 (*info->print_address_func) 958 ((memaddr + 8 + extract_17 (insn)), info); 920 959 break; 921 960 case 'z': … … 935 974 (*info->fprintf_func) (info->stream, "%%sr0,%%r31"); 936 975 break; 937 976 938 977 case '@': 939 978 (*info->fprintf_func) (info->stream, "0"); … … 942 981 case '.': 943 982 (*info->fprintf_func) (info->stream, "%d", 944 983 GET_FIELD (insn, 24, 25)); 945 984 break; 946 985 case '*': 947 986 (*info->fprintf_func) (info->stream, "%d", 948 987 GET_FIELD (insn, 22, 25)); 949 988 break; 950 989 case '!': … … 953 992 case 'p': 954 993 (*info->fprintf_func) (info->stream, "%d", 955 994 31 - GET_FIELD (insn, 22, 26)); 956 995 break; 957 996 case '~': … … 965 1004 case 'P': 966 1005 (*info->fprintf_func) (info->stream, "%d", 967 1006 GET_FIELD (insn, 22, 26)); 968 1007 break; 969 1008 case 'q': … … 977 1016 case 'T': 978 1017 (*info->fprintf_func) (info->stream, "%d", 979 1018 32 - GET_FIELD (insn, 27, 31)); 980 1019 break; 981 1020 case '%': … … 1005 1044 break; 1006 1045 case 'v': 1007 (*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25)); 1046 (*info->fprintf_func) (info->stream, ",%d", 1047 GET_FIELD (insn, 23, 25)); 1008 1048 break; 1009 1049 case 'O': … … 1027 1067 break; 1028 1068 case 'u': 1029 (*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25)); 1069 (*info->fprintf_func) (info->stream, ",%d", 1070 GET_FIELD (insn, 23, 25)); 1030 1071 break; 1031 1072 case 'F': … … 1033 1074 for fcmp, need a space here */ 1034 1075 if (s[1] == 'G' || s[1] == '?') 1035 fputs_filtered (float_format_names[GET_FIELD (insn, 19, 20)],1036 1076 fputs_filtered 1077 (float_format_names[GET_FIELD (insn, 19, 20)], info); 1037 1078 else 1038 (*info->fprintf_func) (info->stream, "%s ",1039 float_format_names[GET_FIELD1040 1079 (*info->fprintf_func) 1080 (info->stream, "%s ", 1081 float_format_names[GET_FIELD (insn, 19, 20)]); 1041 1082 break; 1042 1083 case 'G': 1043 (*info->fprintf_func) (info->stream, "%s ",1044 float_format_names[GET_FIELD (insn,1045 1084 (*info->fprintf_func) 1085 (info->stream, "%s ", 1086 float_format_names[GET_FIELD (insn, 17, 18)]); 1046 1087 break; 1047 1088 case 'H': 1048 1089 if (GET_FIELD (insn, 26, 26) == 1) 1049 1090 (*info->fprintf_func) (info->stream, "%s ", 1050 1091 float_format_names[0]); 1051 1092 else 1052 1093 (*info->fprintf_func) (info->stream, "%s ", 1053 1094 float_format_names[1]); 1054 1095 break; 1055 1096 case 'I': … … 1057 1098 for fcmp, need a space here */ 1058 1099 if (s[1] == '?') 1059 fputs_filtered (float_format_names[GET_FIELD (insn, 20, 20)],1060 1100 fputs_filtered 1101 (float_format_names[GET_FIELD (insn, 20, 20)], info); 1061 1102 else 1062 (*info->fprintf_func) (info->stream, "%s ",1063 float_format_names[GET_FIELD1064 1065 break; 1066 1067 1068 1069 1103 (*info->fprintf_func) 1104 (info->stream, "%s ", 1105 float_format_names[GET_FIELD (insn, 20, 20)]); 1106 break; 1107 1108 case 'J': 1109 fput_const (extract_14 (insn), info); 1110 break; 1070 1111 1071 1112 case '#': … … 1084 1125 break; 1085 1126 } 1086 1127 case 'K': 1087 1128 case 'd': 1088 1129 { … … 1120 1161 } 1121 1162 1122 /* ?!? FIXME */1123 1163 case '_': 1164 break; /* Dealt with by '{' */ 1165 1124 1166 case '{': 1125 fputs_filtered ("Disassembler botch.\n", info); 1126 break; 1167 { 1168 int sub = GET_FIELD (insn, 14, 16); 1169 int df = GET_FIELD (insn, 17, 18); 1170 int sf = GET_FIELD (insn, 19, 20); 1171 const char * const * source = float_format_names; 1172 const char * const * dest = float_format_names; 1173 char *t = ""; 1174 if (sub == 4) 1175 { 1176 fputs_filtered (",UND ", info); 1177 break; 1178 } 1179 if ((sub & 3) == 3) 1180 t = ",t"; 1181 if ((sub & 3) == 1) 1182 source = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names; 1183 if (sub & 2) 1184 dest = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names; 1185 1186 (*info->fprintf_func) (info->stream, "%s%s%s ", 1187 t, source[sf], dest[df]); 1188 break; 1189 } 1127 1190 1128 1191 case 'm': … … 1170 1233 1171 1234 case 'X': 1172 (*info->print_address_func) ((memaddr + 8 1173 + extract_22 (insn)), 1174 info); 1235 (*info->print_address_func) 1236 (memaddr + 8 + extract_22 (insn), info); 1175 1237 break; 1176 1238 case 'L': -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.