[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/6] mips_malta: fix BIOS endianness swapping
From: |
Leon Alrae |
Subject: |
[Qemu-devel] [PATCH 1/6] mips_malta: fix BIOS endianness swapping |
Date: |
Fri, 14 Jun 2013 08:30:43 +0100 |
From: Paul Burton <address@hidden>
If the target is little endian (mipsel) then the BIOS image endianness
is swapped so that the big endian BIOS binaries commonly produced can be
loaded correctly.
When using the -bios argument the BIOS is loaded using
load_image_targphys, however this doesn't perform the load to target
memory immediately. Instead it loads the BIOS file into a struct Rom
which will later be written to target memory upon reset. However the
endianness conversion was being performed before this, on init, and
operating on the target memory which at this point is blank & will later
be overwritten by the (big endian) BIOS image. Correct this by operating
on the data referenced by struct Rom rather than the target memory when
the -bios argument is used.
Signed-off-by: Paul Burton <address@hidden>
Signed-off-by: Leon Alrae <address@hidden>
---
hw/mips/mips_malta.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 5033d51..4def898 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -916,8 +916,11 @@ void mips_malta_init(QEMUMachineInitArgs *args)
a neat trick which allows bi-endian firmware. */
#ifndef TARGET_WORDS_BIGENDIAN
{
- uint32_t *addr = memory_region_get_ram_ptr(bios);
- uint32_t *end = addr + bios_size;
+ uint32_t *end, *addr = rom_ptr(FLASH_ADDRESS);
+ if (!addr) {
+ addr = memory_region_get_ram_ptr(bios);
+ }
+ end = (void *)addr + bios_size;
while (addr < end) {
bswap32s(addr);
addr++;
--
1.7.5.4
- [Qemu-devel] [PATCH 0/6] mips_malta: fixes to support YAMON firmware, Leon Alrae, 2013/06/14
- [Qemu-devel] [PATCH 1/6] mips_malta: fix BIOS endianness swapping,
Leon Alrae <=
- [Qemu-devel] [PATCH 6/6] pflash_cfi01: duplicate status byte from bits 23:16 for 32bit reads, Leon Alrae, 2013/06/14
- [Qemu-devel] [PATCH 3/6] mips_malta: generate SPD EEPROM data at runtime, Leon Alrae, 2013/06/14
- [Qemu-devel] [PATCH 5/6] mips_malta: generate SMBUS EEPROM data, Leon Alrae, 2013/06/14
- [Qemu-devel] [PATCH 2/6] mips_malta: correct reading MIPS revision at 0x1fc00010, Leon Alrae, 2013/06/14
- [Qemu-devel] [PATCH 4/6] mips_malta: cap BIOS endian swap length at 0x3e0000 bytes, Leon Alrae, 2013/06/14
- Re: [Qemu-devel] [PATCH 0/6] mips_malta: fixes to support YAMON firmware, Leon Alrae, 2013/06/28