Commit 274da6b24b93e98119de92f22fff24f79ba173ba
1 parent
15aeac38
64 bit fix (Jocelyn Mayer)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@839 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
129 additions
and
126 deletions
exec.c
| ... | ... | @@ -1221,7 +1221,7 @@ void tlb_flush(CPUState *env, int flush_global) |
| 1221 | 1221 | #endif |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | -static inline void tlb_flush_entry(CPUTLBEntry *tlb_entry, uint32_t addr) | |
| 1224 | +static inline void tlb_flush_entry(CPUTLBEntry *tlb_entry, target_ulong addr) | |
| 1225 | 1225 | { |
| 1226 | 1226 | if (addr == (tlb_entry->address & |
| 1227 | 1227 | (TARGET_PAGE_MASK | TLB_INVALID_MASK))) |
| ... | ... | @@ -1789,7 +1789,7 @@ static void code_mem_writeb(target_phys_addr_t addr, uint32_t val) |
| 1789 | 1789 | { |
| 1790 | 1790 | unsigned long phys_addr; |
| 1791 | 1791 | |
| 1792 | - phys_addr = addr - (long)phys_ram_base; | |
| 1792 | + phys_addr = addr - (unsigned long)phys_ram_base; | |
| 1793 | 1793 | #if !defined(CONFIG_USER_ONLY) |
| 1794 | 1794 | tb_invalidate_phys_page_fast(phys_addr, 1); |
| 1795 | 1795 | #endif |
| ... | ... | @@ -1801,7 +1801,7 @@ static void code_mem_writew(target_phys_addr_t addr, uint32_t val) |
| 1801 | 1801 | { |
| 1802 | 1802 | unsigned long phys_addr; |
| 1803 | 1803 | |
| 1804 | - phys_addr = addr - (long)phys_ram_base; | |
| 1804 | + phys_addr = addr - (unsigned long)phys_ram_base; | |
| 1805 | 1805 | #if !defined(CONFIG_USER_ONLY) |
| 1806 | 1806 | tb_invalidate_phys_page_fast(phys_addr, 2); |
| 1807 | 1807 | #endif |
| ... | ... | @@ -1813,7 +1813,7 @@ static void code_mem_writel(target_phys_addr_t addr, uint32_t val) |
| 1813 | 1813 | { |
| 1814 | 1814 | unsigned long phys_addr; |
| 1815 | 1815 | |
| 1816 | - phys_addr = addr - (long)phys_ram_base; | |
| 1816 | + phys_addr = addr - (unsigned long)phys_ram_base; | |
| 1817 | 1817 | #if !defined(CONFIG_USER_ONLY) |
| 1818 | 1818 | tb_invalidate_phys_page_fast(phys_addr, 4); |
| 1819 | 1819 | #endif | ... | ... |
linux-user/elfload.c
| ... | ... | @@ -127,7 +127,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i |
| 127 | 127 | */ |
| 128 | 128 | #define ELF_PLAT_INIT(_r) \ |
| 129 | 129 | do { \ |
| 130 | - unsigned long *pos = (unsigned long *)bprm->p, tmp = 1; \ | |
| 130 | + target_ulong *pos = (target_ulong *)bprm->p, tmp = 1; \ | |
| 131 | 131 | _r->gpr[3] = bprm->argc; \ |
| 132 | 132 | _r->gpr[4] = (unsigned long)++pos; \ |
| 133 | 133 | for (; tmp != 0; pos++) \ | ... | ... |
ppc-dis.c
| ... | ... | @@ -48,18 +48,18 @@ struct powerpc_opcode |
| 48 | 48 | |
| 49 | 49 | /* The opcode itself. Those bits which will be filled in with |
| 50 | 50 | operands are zeroes. */ |
| 51 | - unsigned long opcode; | |
| 51 | + uint32_t opcode; | |
| 52 | 52 | |
| 53 | 53 | /* The opcode mask. This is used by the disassembler. This is a |
| 54 | 54 | mask containing ones indicating those bits which must match the |
| 55 | 55 | opcode field, and zeroes indicating those bits which need not |
| 56 | 56 | match (and are presumably filled in by operands). */ |
| 57 | - unsigned long mask; | |
| 57 | + uint32_t mask; | |
| 58 | 58 | |
| 59 | 59 | /* One bit flags for the opcode. These are used to indicate which |
| 60 | 60 | specific processors support the instructions. The defined values |
| 61 | 61 | are listed below. */ |
| 62 | - unsigned long flags; | |
| 62 | + uint32_t flags; | |
| 63 | 63 | |
| 64 | 64 | /* An array of operand codes. Each code is an index into the |
| 65 | 65 | operand table. They appear in the order which the operands must |
| ... | ... | @@ -124,7 +124,7 @@ struct powerpc_operand |
| 124 | 124 | string (the operand will be inserted in any case). If the |
| 125 | 125 | operand value is legal, *ERRMSG will be unchanged (most operands |
| 126 | 126 | can accept any value). */ |
| 127 | - unsigned long (*insert)(unsigned long instruction, long op, | |
| 127 | + unsigned long (*insert)(uint32_t instruction, int32_t op, | |
| 128 | 128 | const char **errmsg); |
| 129 | 129 | |
| 130 | 130 | /* Extraction function. This is used by the disassembler. To |
| ... | ... | @@ -144,10 +144,10 @@ struct powerpc_operand |
| 144 | 144 | non-zero if this operand type can not actually be extracted from |
| 145 | 145 | this operand (i.e., the instruction does not match). If the |
| 146 | 146 | operand is valid, *INVALID will not be changed. */ |
| 147 | - long (*extract) (unsigned long instruction, int *invalid); | |
| 147 | + long (*extract) (uint32_t instruction, int *invalid); | |
| 148 | 148 | |
| 149 | 149 | /* One bit syntax flags. */ |
| 150 | - unsigned long flags; | |
| 150 | + uint32_t flags; | |
| 151 | 151 | }; |
| 152 | 152 | |
| 153 | 153 | /* Elements in the table are retrieved by indexing with values from |
| ... | ... | @@ -244,7 +244,7 @@ struct powerpc_macro |
| 244 | 244 | /* One bit flags for the opcode. These are used to indicate which |
| 245 | 245 | specific processors support the instructions. The values are the |
| 246 | 246 | same as those for the struct powerpc_opcode flags field. */ |
| 247 | - unsigned long flags; | |
| 247 | + uint32_t flags; | |
| 248 | 248 | |
| 249 | 249 | /* A format string to turn the macro into a normal instruction. |
| 250 | 250 | Each %N in the string is replaced with operand number N (zero |
| ... | ... | @@ -288,43 +288,43 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 288 | 288 | |
| 289 | 289 | /* Local insertion and extraction functions. */ |
| 290 | 290 | |
| 291 | -static unsigned long insert_bat (unsigned long, long, const char **); | |
| 292 | -static long extract_bat(unsigned long, int *); | |
| 293 | -static unsigned long insert_bba(unsigned long, long, const char **); | |
| 294 | -static long extract_bba(unsigned long, int *); | |
| 295 | -static unsigned long insert_bd(unsigned long, long, const char **); | |
| 296 | -static long extract_bd(unsigned long, int *); | |
| 297 | -static unsigned long insert_bdm(unsigned long, long, const char **); | |
| 298 | -static long extract_bdm(unsigned long, int *); | |
| 299 | -static unsigned long insert_bdp(unsigned long, long, const char **); | |
| 300 | -static long extract_bdp(unsigned long, int *); | |
| 301 | -static unsigned long insert_bo(unsigned long, long, const char **); | |
| 302 | -static long extract_bo(unsigned long, int *); | |
| 303 | -static unsigned long insert_boe(unsigned long, long, const char **); | |
| 304 | -static long extract_boe(unsigned long, int *); | |
| 305 | -static unsigned long insert_ds(unsigned long, long, const char **); | |
| 306 | -static long extract_ds(unsigned long, int *); | |
| 307 | -static unsigned long insert_li(unsigned long, long, const char **); | |
| 308 | -static long extract_li(unsigned long, int *); | |
| 309 | -static unsigned long insert_mbe(unsigned long, long, const char **); | |
| 310 | -static long extract_mbe(unsigned long, int *); | |
| 311 | -static unsigned long insert_mb6(unsigned long, long, const char **); | |
| 312 | -static long extract_mb6(unsigned long, int *); | |
| 313 | -static unsigned long insert_nb(unsigned long, long, const char **); | |
| 314 | -static long extract_nb(unsigned long, int *); | |
| 315 | -static unsigned long insert_nsi(unsigned long, long, const char **); | |
| 316 | -static long extract_nsi(unsigned long, int *); | |
| 317 | -static unsigned long insert_ral(unsigned long, long, const char **); | |
| 318 | -static unsigned long insert_ram(unsigned long, long, const char **); | |
| 319 | -static unsigned long insert_ras(unsigned long, long, const char **); | |
| 320 | -static unsigned long insert_rbs(unsigned long, long, const char **); | |
| 321 | -static long extract_rbs(unsigned long, int *); | |
| 322 | -static unsigned long insert_sh6(unsigned long, long, const char **); | |
| 323 | -static long extract_sh6(unsigned long, int *); | |
| 324 | -static unsigned long insert_spr(unsigned long, long, const char **); | |
| 325 | -static long extract_spr(unsigned long, int *); | |
| 326 | -static unsigned long insert_tbr(unsigned long, long, const char **); | |
| 327 | -static long extract_tbr(unsigned long, int *); | |
| 291 | +static unsigned long insert_bat (uint32_t, int32_t, const char **); | |
| 292 | +static long extract_bat(uint32_t, int *); | |
| 293 | +static unsigned long insert_bba(uint32_t, int32_t, const char **); | |
| 294 | +static long extract_bba(uint32_t, int *); | |
| 295 | +static unsigned long insert_bd(uint32_t, int32_t, const char **); | |
| 296 | +static long extract_bd(uint32_t, int *); | |
| 297 | +static unsigned long insert_bdm(uint32_t, int32_t, const char **); | |
| 298 | +static long extract_bdm(uint32_t, int *); | |
| 299 | +static unsigned long insert_bdp(uint32_t, int32_t, const char **); | |
| 300 | +static long extract_bdp(uint32_t, int *); | |
| 301 | +static unsigned long insert_bo(uint32_t, int32_t, const char **); | |
| 302 | +static long extract_bo(uint32_t, int *); | |
| 303 | +static unsigned long insert_boe(uint32_t, int32_t, const char **); | |
| 304 | +static long extract_boe(uint32_t, int *); | |
| 305 | +static unsigned long insert_ds(uint32_t, int32_t, const char **); | |
| 306 | +static long extract_ds(uint32_t, int *); | |
| 307 | +static unsigned long insert_li(uint32_t, int32_t, const char **); | |
| 308 | +static long extract_li(uint32_t, int *); | |
| 309 | +static unsigned long insert_mbe(uint32_t, int32_t, const char **); | |
| 310 | +static long extract_mbe(uint32_t, int *); | |
| 311 | +static unsigned long insert_mb6(uint32_t, int32_t, const char **); | |
| 312 | +static long extract_mb6(uint32_t, int *); | |
| 313 | +static unsigned long insert_nb(uint32_t, int32_t, const char **); | |
| 314 | +static long extract_nb(uint32_t, int *); | |
| 315 | +static unsigned long insert_nsi(uint32_t, int32_t, const char **); | |
| 316 | +static long extract_nsi(uint32_t, int *); | |
| 317 | +static unsigned long insert_ral(uint32_t, int32_t, const char **); | |
| 318 | +static unsigned long insert_ram(uint32_t, int32_t, const char **); | |
| 319 | +static unsigned long insert_ras(uint32_t, int32_t, const char **); | |
| 320 | +static unsigned long insert_rbs(uint32_t, int32_t, const char **); | |
| 321 | +static long extract_rbs(uint32_t, int *); | |
| 322 | +static unsigned long insert_sh6(uint32_t, int32_t, const char **); | |
| 323 | +static long extract_sh6(uint32_t, int *); | |
| 324 | +static unsigned long insert_spr(uint32_t, int32_t, const char **); | |
| 325 | +static long extract_spr(uint32_t, int *); | |
| 326 | +static unsigned long insert_tbr(uint32_t, int32_t, const char **); | |
| 327 | +static long extract_tbr(uint32_t, int *); | |
| 328 | 328 | |
| 329 | 329 | /* The operands table. |
| 330 | 330 | |
| ... | ... | @@ -648,8 +648,8 @@ const struct powerpc_operand powerpc_operands[] = |
| 648 | 648 | /*ARGSUSED*/ |
| 649 | 649 | static unsigned long |
| 650 | 650 | insert_bat (insn, value, errmsg) |
| 651 | - unsigned long insn; | |
| 652 | - long value; | |
| 651 | + uint32_t insn; | |
| 652 | + int32_t value; | |
| 653 | 653 | const char **errmsg; |
| 654 | 654 | { |
| 655 | 655 | return insn | (((insn >> 21) & 0x1f) << 16); |
| ... | ... | @@ -657,7 +657,7 @@ insert_bat (insn, value, errmsg) |
| 657 | 657 | |
| 658 | 658 | static long |
| 659 | 659 | extract_bat (insn, invalid) |
| 660 | - unsigned long insn; | |
| 660 | + uint32_t insn; | |
| 661 | 661 | int *invalid; |
| 662 | 662 | { |
| 663 | 663 | if (invalid != (int *) NULL |
| ... | ... | @@ -675,8 +675,8 @@ extract_bat (insn, invalid) |
| 675 | 675 | /*ARGSUSED*/ |
| 676 | 676 | static unsigned long |
| 677 | 677 | insert_bba (insn, value, errmsg) |
| 678 | - unsigned long insn; | |
| 679 | - long value; | |
| 678 | + uint32_t insn; | |
| 679 | + int32_t value; | |
| 680 | 680 | const char **errmsg; |
| 681 | 681 | { |
| 682 | 682 | return insn | (((insn >> 16) & 0x1f) << 11); |
| ... | ... | @@ -684,7 +684,7 @@ insert_bba (insn, value, errmsg) |
| 684 | 684 | |
| 685 | 685 | static long |
| 686 | 686 | extract_bba (insn, invalid) |
| 687 | - unsigned long insn; | |
| 687 | + uint32_t insn; | |
| 688 | 688 | int *invalid; |
| 689 | 689 | { |
| 690 | 690 | if (invalid != (int *) NULL |
| ... | ... | @@ -699,8 +699,8 @@ extract_bba (insn, invalid) |
| 699 | 699 | /*ARGSUSED*/ |
| 700 | 700 | static unsigned long |
| 701 | 701 | insert_bd (insn, value, errmsg) |
| 702 | - unsigned long insn; | |
| 703 | - long value; | |
| 702 | + uint32_t insn; | |
| 703 | + int32_t value; | |
| 704 | 704 | const char **errmsg; |
| 705 | 705 | { |
| 706 | 706 | return insn | (value & 0xfffc); |
| ... | ... | @@ -709,7 +709,7 @@ insert_bd (insn, value, errmsg) |
| 709 | 709 | /*ARGSUSED*/ |
| 710 | 710 | static long |
| 711 | 711 | extract_bd (insn, invalid) |
| 712 | - unsigned long insn; | |
| 712 | + uint32_t insn; | |
| 713 | 713 | int *invalid; |
| 714 | 714 | { |
| 715 | 715 | if ((insn & 0x8000) != 0) |
| ... | ... | @@ -728,8 +728,8 @@ extract_bd (insn, invalid) |
| 728 | 728 | /*ARGSUSED*/ |
| 729 | 729 | static unsigned long |
| 730 | 730 | insert_bdm (insn, value, errmsg) |
| 731 | - unsigned long insn; | |
| 732 | - long value; | |
| 731 | + uint32_t insn; | |
| 732 | + int32_t value; | |
| 733 | 733 | const char **errmsg; |
| 734 | 734 | { |
| 735 | 735 | if ((value & 0x8000) != 0) |
| ... | ... | @@ -739,7 +739,7 @@ insert_bdm (insn, value, errmsg) |
| 739 | 739 | |
| 740 | 740 | static long |
| 741 | 741 | extract_bdm (insn, invalid) |
| 742 | - unsigned long insn; | |
| 742 | + uint32_t insn; | |
| 743 | 743 | int *invalid; |
| 744 | 744 | { |
| 745 | 745 | if (invalid != (int *) NULL |
| ... | ... | @@ -759,8 +759,8 @@ extract_bdm (insn, invalid) |
| 759 | 759 | /*ARGSUSED*/ |
| 760 | 760 | static unsigned long |
| 761 | 761 | insert_bdp (insn, value, errmsg) |
| 762 | - unsigned long insn; | |
| 763 | - long value; | |
| 762 | + uint32_t insn; | |
| 763 | + int32_t value; | |
| 764 | 764 | const char **errmsg; |
| 765 | 765 | { |
| 766 | 766 | if ((value & 0x8000) == 0) |
| ... | ... | @@ -770,7 +770,7 @@ insert_bdp (insn, value, errmsg) |
| 770 | 770 | |
| 771 | 771 | static long |
| 772 | 772 | extract_bdp (insn, invalid) |
| 773 | - unsigned long insn; | |
| 773 | + uint32_t insn; | |
| 774 | 774 | int *invalid; |
| 775 | 775 | { |
| 776 | 776 | if (invalid != (int *) NULL |
| ... | ... | @@ -786,7 +786,7 @@ extract_bdp (insn, invalid) |
| 786 | 786 | /* Check for legal values of a BO field. */ |
| 787 | 787 | |
| 788 | 788 | static int |
| 789 | -valid_bo (long value) | |
| 789 | +valid_bo (int32_t value) | |
| 790 | 790 | { |
| 791 | 791 | /* Certain encodings have bits that are required to be zero. These |
| 792 | 792 | are (z must be zero, y may be anything): |
| ... | ... | @@ -815,8 +815,8 @@ valid_bo (long value) |
| 815 | 815 | |
| 816 | 816 | static unsigned long |
| 817 | 817 | insert_bo (insn, value, errmsg) |
| 818 | - unsigned long insn; | |
| 819 | - long value; | |
| 818 | + uint32_t insn; | |
| 819 | + int32_t value; | |
| 820 | 820 | const char **errmsg; |
| 821 | 821 | { |
| 822 | 822 | if (errmsg != (const char **) NULL |
| ... | ... | @@ -827,10 +827,10 @@ insert_bo (insn, value, errmsg) |
| 827 | 827 | |
| 828 | 828 | static long |
| 829 | 829 | extract_bo (insn, invalid) |
| 830 | - unsigned long insn; | |
| 830 | + uint32_t insn; | |
| 831 | 831 | int *invalid; |
| 832 | 832 | { |
| 833 | - long value; | |
| 833 | + int32_t value; | |
| 834 | 834 | |
| 835 | 835 | value = (insn >> 21) & 0x1f; |
| 836 | 836 | if (invalid != (int *) NULL |
| ... | ... | @@ -845,8 +845,8 @@ extract_bo (insn, invalid) |
| 845 | 845 | |
| 846 | 846 | static unsigned long |
| 847 | 847 | insert_boe (insn, value, errmsg) |
| 848 | - unsigned long insn; | |
| 849 | - long value; | |
| 848 | + uint32_t insn; | |
| 849 | + int32_t value; | |
| 850 | 850 | const char **errmsg; |
| 851 | 851 | { |
| 852 | 852 | if (errmsg != (const char **) NULL) |
| ... | ... | @@ -861,10 +861,10 @@ insert_boe (insn, value, errmsg) |
| 861 | 861 | |
| 862 | 862 | static long |
| 863 | 863 | extract_boe (insn, invalid) |
| 864 | - unsigned long insn; | |
| 864 | + uint32_t insn; | |
| 865 | 865 | int *invalid; |
| 866 | 866 | { |
| 867 | - long value; | |
| 867 | + int32_t value; | |
| 868 | 868 | |
| 869 | 869 | value = (insn >> 21) & 0x1f; |
| 870 | 870 | if (invalid != (int *) NULL |
| ... | ... | @@ -879,8 +879,8 @@ extract_boe (insn, invalid) |
| 879 | 879 | /*ARGSUSED*/ |
| 880 | 880 | static unsigned long |
| 881 | 881 | insert_ds (insn, value, errmsg) |
| 882 | - unsigned long insn; | |
| 883 | - long value; | |
| 882 | + uint32_t insn; | |
| 883 | + int32_t value; | |
| 884 | 884 | const char **errmsg; |
| 885 | 885 | { |
| 886 | 886 | return insn | (value & 0xfffc); |
| ... | ... | @@ -889,7 +889,7 @@ insert_ds (insn, value, errmsg) |
| 889 | 889 | /*ARGSUSED*/ |
| 890 | 890 | static long |
| 891 | 891 | extract_ds (insn, invalid) |
| 892 | - unsigned long insn; | |
| 892 | + uint32_t insn; | |
| 893 | 893 | int *invalid; |
| 894 | 894 | { |
| 895 | 895 | if ((insn & 0x8000) != 0) |
| ... | ... | @@ -904,8 +904,8 @@ extract_ds (insn, invalid) |
| 904 | 904 | /*ARGSUSED*/ |
| 905 | 905 | static unsigned long |
| 906 | 906 | insert_li (insn, value, errmsg) |
| 907 | - unsigned long insn; | |
| 908 | - long value; | |
| 907 | + uint32_t insn; | |
| 908 | + int32_t value; | |
| 909 | 909 | const char **errmsg; |
| 910 | 910 | { |
| 911 | 911 | return insn | (value & 0x3fffffc); |
| ... | ... | @@ -914,7 +914,7 @@ insert_li (insn, value, errmsg) |
| 914 | 914 | /*ARGSUSED*/ |
| 915 | 915 | static long |
| 916 | 916 | extract_li (insn, invalid) |
| 917 | - unsigned long insn; | |
| 917 | + uint32_t insn; | |
| 918 | 918 | int *invalid; |
| 919 | 919 | { |
| 920 | 920 | if ((insn & 0x2000000) != 0) |
| ... | ... | @@ -930,11 +930,11 @@ extract_li (insn, invalid) |
| 930 | 930 | |
| 931 | 931 | static unsigned long |
| 932 | 932 | insert_mbe (insn, value, errmsg) |
| 933 | - unsigned long insn; | |
| 934 | - long value; | |
| 933 | + uint32_t insn; | |
| 934 | + int32_t value; | |
| 935 | 935 | const char **errmsg; |
| 936 | 936 | { |
| 937 | - unsigned long uval; | |
| 937 | + uint32_t uval; | |
| 938 | 938 | int mb, me; |
| 939 | 939 | |
| 940 | 940 | uval = value; |
| ... | ... | @@ -972,7 +972,7 @@ insert_mbe (insn, value, errmsg) |
| 972 | 972 | |
| 973 | 973 | static long |
| 974 | 974 | extract_mbe (insn, invalid) |
| 975 | - unsigned long insn; | |
| 975 | + uint32_t insn; | |
| 976 | 976 | int *invalid; |
| 977 | 977 | { |
| 978 | 978 | long ret; |
| ... | ... | @@ -996,8 +996,8 @@ extract_mbe (insn, invalid) |
| 996 | 996 | /*ARGSUSED*/ |
| 997 | 997 | static unsigned long |
| 998 | 998 | insert_mb6 (insn, value, errmsg) |
| 999 | - unsigned long insn; | |
| 1000 | - long value; | |
| 999 | + uint32_t insn; | |
| 1000 | + int32_t value; | |
| 1001 | 1001 | const char **errmsg; |
| 1002 | 1002 | { |
| 1003 | 1003 | return insn | ((value & 0x1f) << 6) | (value & 0x20); |
| ... | ... | @@ -1006,7 +1006,7 @@ insert_mb6 (insn, value, errmsg) |
| 1006 | 1006 | /*ARGSUSED*/ |
| 1007 | 1007 | static long |
| 1008 | 1008 | extract_mb6 (insn, invalid) |
| 1009 | - unsigned long insn; | |
| 1009 | + uint32_t insn; | |
| 1010 | 1010 | int *invalid; |
| 1011 | 1011 | { |
| 1012 | 1012 | return ((insn >> 6) & 0x1f) | (insn & 0x20); |
| ... | ... | @@ -1017,8 +1017,8 @@ extract_mb6 (insn, invalid) |
| 1017 | 1017 | |
| 1018 | 1018 | static unsigned long |
| 1019 | 1019 | insert_nb (insn, value, errmsg) |
| 1020 | - unsigned long insn; | |
| 1021 | - long value; | |
| 1020 | + uint32_t insn; | |
| 1021 | + int32_t value; | |
| 1022 | 1022 | const char **errmsg; |
| 1023 | 1023 | { |
| 1024 | 1024 | if (value < 0 || value > 32) |
| ... | ... | @@ -1031,7 +1031,7 @@ insert_nb (insn, value, errmsg) |
| 1031 | 1031 | /*ARGSUSED*/ |
| 1032 | 1032 | static long |
| 1033 | 1033 | extract_nb (insn, invalid) |
| 1034 | - unsigned long insn; | |
| 1034 | + uint32_t insn; | |
| 1035 | 1035 | int *invalid; |
| 1036 | 1036 | { |
| 1037 | 1037 | long ret; |
| ... | ... | @@ -1050,8 +1050,8 @@ extract_nb (insn, invalid) |
| 1050 | 1050 | /*ARGSUSED*/ |
| 1051 | 1051 | static unsigned long |
| 1052 | 1052 | insert_nsi (insn, value, errmsg) |
| 1053 | - unsigned long insn; | |
| 1054 | - long value; | |
| 1053 | + uint32_t insn; | |
| 1054 | + int32_t value; | |
| 1055 | 1055 | const char **errmsg; |
| 1056 | 1056 | { |
| 1057 | 1057 | return insn | ((- value) & 0xffff); |
| ... | ... | @@ -1059,7 +1059,7 @@ insert_nsi (insn, value, errmsg) |
| 1059 | 1059 | |
| 1060 | 1060 | static long |
| 1061 | 1061 | extract_nsi (insn, invalid) |
| 1062 | - unsigned long insn; | |
| 1062 | + uint32_t insn; | |
| 1063 | 1063 | int *invalid; |
| 1064 | 1064 | { |
| 1065 | 1065 | if (invalid != (int *) NULL) |
| ... | ... | @@ -1076,8 +1076,8 @@ extract_nsi (insn, invalid) |
| 1076 | 1076 | |
| 1077 | 1077 | static unsigned long |
| 1078 | 1078 | insert_ral (insn, value, errmsg) |
| 1079 | - unsigned long insn; | |
| 1080 | - long value; | |
| 1079 | + uint32_t insn; | |
| 1080 | + int32_t value; | |
| 1081 | 1081 | const char **errmsg; |
| 1082 | 1082 | { |
| 1083 | 1083 | if (value == 0 |
| ... | ... | @@ -1091,8 +1091,8 @@ insert_ral (insn, value, errmsg) |
| 1091 | 1091 | |
| 1092 | 1092 | static unsigned long |
| 1093 | 1093 | insert_ram (insn, value, errmsg) |
| 1094 | - unsigned long insn; | |
| 1095 | - long value; | |
| 1094 | + uint32_t insn; | |
| 1095 | + int32_t value; | |
| 1096 | 1096 | const char **errmsg; |
| 1097 | 1097 | { |
| 1098 | 1098 | if (value >= ((insn >> 21) & 0x1f)) |
| ... | ... | @@ -1106,8 +1106,8 @@ insert_ram (insn, value, errmsg) |
| 1106 | 1106 | |
| 1107 | 1107 | static unsigned long |
| 1108 | 1108 | insert_ras (insn, value, errmsg) |
| 1109 | - unsigned long insn; | |
| 1110 | - long value; | |
| 1109 | + uint32_t insn; | |
| 1110 | + int32_t value; | |
| 1111 | 1111 | const char **errmsg; |
| 1112 | 1112 | { |
| 1113 | 1113 | if (value == 0) |
| ... | ... | @@ -1124,8 +1124,8 @@ insert_ras (insn, value, errmsg) |
| 1124 | 1124 | /*ARGSUSED*/ |
| 1125 | 1125 | static unsigned long |
| 1126 | 1126 | insert_rbs (insn, value, errmsg) |
| 1127 | - unsigned long insn; | |
| 1128 | - long value; | |
| 1127 | + uint32_t insn; | |
| 1128 | + int32_t value; | |
| 1129 | 1129 | const char **errmsg; |
| 1130 | 1130 | { |
| 1131 | 1131 | return insn | (((insn >> 21) & 0x1f) << 11); |
| ... | ... | @@ -1133,7 +1133,7 @@ insert_rbs (insn, value, errmsg) |
| 1133 | 1133 | |
| 1134 | 1134 | static long |
| 1135 | 1135 | extract_rbs (insn, invalid) |
| 1136 | - unsigned long insn; | |
| 1136 | + uint32_t insn; | |
| 1137 | 1137 | int *invalid; |
| 1138 | 1138 | { |
| 1139 | 1139 | if (invalid != (int *) NULL |
| ... | ... | @@ -1147,8 +1147,8 @@ extract_rbs (insn, invalid) |
| 1147 | 1147 | /*ARGSUSED*/ |
| 1148 | 1148 | static unsigned long |
| 1149 | 1149 | insert_sh6 (insn, value, errmsg) |
| 1150 | - unsigned long insn; | |
| 1151 | - long value; | |
| 1150 | + uint32_t insn; | |
| 1151 | + int32_t value; | |
| 1152 | 1152 | const char **errmsg; |
| 1153 | 1153 | { |
| 1154 | 1154 | return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4); |
| ... | ... | @@ -1157,7 +1157,7 @@ insert_sh6 (insn, value, errmsg) |
| 1157 | 1157 | /*ARGSUSED*/ |
| 1158 | 1158 | static long |
| 1159 | 1159 | extract_sh6 (insn, invalid) |
| 1160 | - unsigned long insn; | |
| 1160 | + uint32_t insn; | |
| 1161 | 1161 | int *invalid; |
| 1162 | 1162 | { |
| 1163 | 1163 | return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20); |
| ... | ... | @@ -1168,8 +1168,8 @@ extract_sh6 (insn, invalid) |
| 1168 | 1168 | |
| 1169 | 1169 | static unsigned long |
| 1170 | 1170 | insert_spr (insn, value, errmsg) |
| 1171 | - unsigned long insn; | |
| 1172 | - long value; | |
| 1171 | + uint32_t insn; | |
| 1172 | + int32_t value; | |
| 1173 | 1173 | const char **errmsg; |
| 1174 | 1174 | { |
| 1175 | 1175 | return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6); |
| ... | ... | @@ -1177,7 +1177,7 @@ insert_spr (insn, value, errmsg) |
| 1177 | 1177 | |
| 1178 | 1178 | static long |
| 1179 | 1179 | extract_spr (insn, invalid) |
| 1180 | - unsigned long insn; | |
| 1180 | + uint32_t insn; | |
| 1181 | 1181 | int *invalid; |
| 1182 | 1182 | { |
| 1183 | 1183 | return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0); |
| ... | ... | @@ -1195,8 +1195,8 @@ extract_spr (insn, invalid) |
| 1195 | 1195 | |
| 1196 | 1196 | static unsigned long |
| 1197 | 1197 | insert_tbr (insn, value, errmsg) |
| 1198 | - unsigned long insn; | |
| 1199 | - long value; | |
| 1198 | + uint32_t insn; | |
| 1199 | + int32_t value; | |
| 1200 | 1200 | const char **errmsg; |
| 1201 | 1201 | { |
| 1202 | 1202 | if (value == 0) |
| ... | ... | @@ -1206,7 +1206,7 @@ insert_tbr (insn, value, errmsg) |
| 1206 | 1206 | |
| 1207 | 1207 | static long |
| 1208 | 1208 | extract_tbr (insn, invalid) |
| 1209 | - unsigned long insn; | |
| 1209 | + uint32_t insn; | |
| 1210 | 1210 | int *invalid; |
| 1211 | 1211 | { |
| 1212 | 1212 | long ret; |
| ... | ... | @@ -3067,27 +3067,30 @@ const struct powerpc_macro powerpc_macros[] = { |
| 3067 | 3067 | const int powerpc_num_macros = |
| 3068 | 3068 | sizeof (powerpc_macros) / sizeof (powerpc_macros[0]); |
| 3069 | 3069 | |
| 3070 | -static int print_insn_powerpc(FILE *, unsigned long insn, unsigned memaddr, int dialect); | |
| 3070 | +static int print_insn_powerpc(FILE *, uint32_t insn, unsigned memaddr, int dialect); | |
| 3071 | 3071 | |
| 3072 | 3072 | /* Print a big endian PowerPC instruction. For convenience, also |
| 3073 | 3073 | disassemble instructions supported by the Motorola PowerPC 601. */ |
| 3074 | +#include "cpu.h" | |
| 3074 | 3075 | |
| 3075 | 3076 | int print_insn_ppc (bfd_vma pc, disassemble_info *info) |
| 3076 | 3077 | { |
| 3077 | - return print_insn_powerpc (info->stream, | |
| 3078 | - (unsigned int)bfd_getb32((bfd_byte *)pc), pc, | |
| 3079 | - PPC_OPCODE_PPC | PPC_OPCODE_601); | |
| 3078 | + uint32_t opc; | |
| 3079 | + | |
| 3080 | + (*info->read_memory_func)(pc, (bfd_byte *)(&opc), 4, info); | |
| 3081 | + return print_insn_powerpc (info->stream, tswap32(opc), pc, | |
| 3082 | + PPC | B32 | M601); | |
| 3080 | 3083 | } |
| 3081 | 3084 | |
| 3082 | 3085 | /* Print a PowerPC or POWER instruction. */ |
| 3083 | 3086 | |
| 3084 | -static int | |
| 3085 | -print_insn_powerpc (FILE *out, unsigned long insn, unsigned memaddr, | |
| 3087 | +int | |
| 3088 | +print_insn_powerpc (FILE *out, uint32_t insn, unsigned memaddr, | |
| 3086 | 3089 | int dialect) |
| 3087 | 3090 | { |
| 3088 | 3091 | const struct powerpc_opcode *opcode; |
| 3089 | 3092 | const struct powerpc_opcode *opcode_end; |
| 3090 | - unsigned long op; | |
| 3093 | + uint32_t op; | |
| 3091 | 3094 | |
| 3092 | 3095 | /* Get the major opcode of the instruction. */ |
| 3093 | 3096 | op = PPC_OP (insn); |
| ... | ... | @@ -3097,7 +3100,7 @@ print_insn_powerpc (FILE *out, unsigned long insn, unsigned memaddr, |
| 3097 | 3100 | opcode_end = powerpc_opcodes + powerpc_num_opcodes; |
| 3098 | 3101 | for (opcode = powerpc_opcodes; opcode < opcode_end; opcode++) |
| 3099 | 3102 | { |
| 3100 | - unsigned long table_op; | |
| 3103 | + uint32_t table_op; | |
| 3101 | 3104 | const unsigned char *opindex; |
| 3102 | 3105 | const struct powerpc_operand *operand; |
| 3103 | 3106 | int invalid; |
| ... | ... | @@ -3137,7 +3140,7 @@ print_insn_powerpc (FILE *out, unsigned long insn, unsigned memaddr, |
| 3137 | 3140 | need_paren = 0; |
| 3138 | 3141 | for (opindex = opcode->operands; *opindex != 0; opindex++) |
| 3139 | 3142 | { |
| 3140 | - long value; | |
| 3143 | + int32_t value; | |
| 3141 | 3144 | |
| 3142 | 3145 | operand = powerpc_operands + *opindex; |
| 3143 | 3146 | |
| ... | ... | @@ -3173,20 +3176,20 @@ print_insn_powerpc (FILE *out, unsigned long insn, unsigned memaddr, |
| 3173 | 3176 | |
| 3174 | 3177 | /* Print the operand as directed by the flags. */ |
| 3175 | 3178 | if ((operand->flags & PPC_OPERAND_GPR) != 0) |
| 3176 | - fprintf(out, "r%ld", value); | |
| 3179 | + fprintf(out, "r%d", value); | |
| 3177 | 3180 | else if ((operand->flags & PPC_OPERAND_FPR) != 0) |
| 3178 | - fprintf(out, "f%ld", value); | |
| 3181 | + fprintf(out, "f%d", value); | |
| 3179 | 3182 | else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0) |
| 3180 | - fprintf(out, "%08lX", memaddr + value); | |
| 3183 | + fprintf(out, "%08X", memaddr + value); | |
| 3181 | 3184 | else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0) |
| 3182 | - fprintf(out, "%08lX", value & 0xffffffff); | |
| 3185 | + fprintf(out, "%08X", value & 0xffffffff); | |
| 3183 | 3186 | else if ((operand->flags & PPC_OPERAND_CR) == 0 |
| 3184 | 3187 | || (dialect & PPC_OPCODE_PPC) == 0) |
| 3185 | - fprintf(out, "%ld", value); | |
| 3188 | + fprintf(out, "%d", value); | |
| 3186 | 3189 | else |
| 3187 | 3190 | { |
| 3188 | 3191 | if (operand->bits == 3) |
| 3189 | - fprintf(out, "cr%ld", value); | |
| 3192 | + fprintf(out, "cr%d", value); | |
| 3190 | 3193 | else |
| 3191 | 3194 | { |
| 3192 | 3195 | static const char *cbnames[4] = { "lt", "gt", "eq", "so" }; |
| ... | ... | @@ -3226,7 +3229,7 @@ print_insn_powerpc (FILE *out, unsigned long insn, unsigned memaddr, |
| 3226 | 3229 | } |
| 3227 | 3230 | |
| 3228 | 3231 | /* We could not find a match. */ |
| 3229 | - fprintf(out, ".long 0x%lx", insn); | |
| 3232 | + fprintf(out, ".long 0x%x", insn); | |
| 3230 | 3233 | |
| 3231 | 3234 | return 4; |
| 3232 | 3235 | } | ... | ... |