Patchwork [4/6] mips_malta: cap BIOS endian swap length at 0x3e0000 bytes

login
register
mail settings
Submitter Leon Alrae
Date June 14, 2013, 7:30 a.m.
Message ID <1371195048-19618-5-git-send-email-leon.alrae@imgtec.com>
Download mbox | patch
Permalink /patch/251253/
State New
Headers show

Comments

Leon Alrae - June 14, 2013, 7:30 a.m.
From: Paul Burton <paul.burton@imgtec.com>

This preserves the final sector of the pflash which is used by YAMON to
hold environment variables. If the endianness of the environment data
is swapped then YAMON will fail to load environment variables from
pflash.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
---
 hw/mips/mips_malta.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 116a2f8..6d43e86 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -974,7 +974,7 @@  void mips_malta_init(QEMUMachineInitArgs *args)
             if (!addr) {
                 addr = memory_region_get_ram_ptr(bios);
             }
-            end = (void *)addr + bios_size;
+            end = (void *)addr + MIN(bios_size, 0x3e0000);
             while (addr < end) {
                 bswap32s(addr);
                 addr++;