Commit 3187ef0390b049ee75bf806f13f6e5004e382c03
1 parent
070ce5ed
Fix firmware word endianness for Malta.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2950 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
12 additions
and
0 deletions
hw/mips_malta.c
| @@ -791,6 +791,18 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device, | @@ -791,6 +791,18 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device, | ||
| 791 | buf); | 791 | buf); |
| 792 | exit(1); | 792 | exit(1); |
| 793 | } | 793 | } |
| 794 | + /* In little endian mode the 32bit words in the bios are swapped, | ||
| 795 | + a neat trick which allows bi-endian firmware. */ | ||
| 796 | +#ifndef TARGET_WORDS_BIGENDIAN | ||
| 797 | + { | ||
| 798 | + uint32_t *addr; | ||
| 799 | + for (addr = (uint32_t *)(phys_ram_base + bios_offset); | ||
| 800 | + addr < (uint32_t *)(phys_ram_base + bios_offset + ret); | ||
| 801 | + addr++) { | ||
| 802 | + *addr = bswap32(*addr); | ||
| 803 | + } | ||
| 804 | + } | ||
| 805 | +#endif | ||
| 794 | } | 806 | } |
| 795 | 807 | ||
| 796 | /* If a kernel image has been specified, write a small bootloader | 808 | /* If a kernel image has been specified, write a small bootloader |