hw/mips/malta: Use address translation helper to calculate bootloader_run_addr
authorJiaxun Yang <jiaxun.yang@flygoat.com>
Tue, 15 Dec 2020 06:41:54 +0000 (14:41 +0800)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Mon, 4 Jan 2021 22:36:03 +0000 (23:36 +0100)
So it will sign extend adresses properly.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201215064200.28751-3-jiaxun.yang@flygoat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/mips/malta.c

index 7db009a3e960be93fe6065476775cfa9ccae12fc..1fbb8a3220715be0eeca546b2309f58d2c19c0b6 100644 (file)
@@ -1302,9 +1302,9 @@ void mips_malta_init(MachineState *machine)
         /* For KVM we reserve 1MB of RAM for running bootloader */
         if (kvm_enabled()) {
             ram_low_size -= 0x100000;
-            bootloader_run_addr = 0x40000000 + ram_low_size;
+            bootloader_run_addr = cpu_mips_kvm_um_phys_to_kseg0(NULL, ram_low_size);
         } else {
-            bootloader_run_addr = 0xbfc00000;
+            bootloader_run_addr = cpu_mips_phys_to_kseg0(NULL, RESET_ADDRESS);
         }
 
         /* Write a small bootloader to the flash location. */