Patchwork [54/60] hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct

login
register
mail settings
Submitter Michael Tokarev
Date Feb. 4, 2013, 10:41 a.m.
Message ID <1359974470-17044-55-git-send-email-mjt@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/217935/
State New
Headers show

Comments

Michael Tokarev - Feb. 4, 2013, 10:41 a.m.
From: Peter Maydell <peter.maydell@linaro.org>

Clean up the mix of getting the RAM size from the global ram_size
and from the ram_size field in the arm_boot_info structure, so
that we always use the structure field.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
(cherry picked from commit 0b94438480c8f52cc9e22b1038e6ba5096245c4e)

This patch is needed for the subsequent patch:
 arm_boot: Change initrd load address to "halfway through RAM"
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/arm_boot.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 7447f5c..05701b2 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -351,7 +351,7 @@  void arm_load_kernel(CPUARMState *env, struct arm_boot_info *info)
     if (kernel_size < 0) {
         entry = info->loader_start + KERNEL_LOAD_ADDR;
         kernel_size = load_image_targphys(info->kernel_filename, entry,
-                                          ram_size - KERNEL_LOAD_ADDR);
+                                          info->ram_size - KERNEL_LOAD_ADDR);
         is_linux = 1;
     }
     if (kernel_size < 0) {
@@ -365,7 +365,8 @@  void arm_load_kernel(CPUARMState *env, struct arm_boot_info *info)
             initrd_size = load_image_targphys(info->initrd_filename,
                                               info->loader_start
                                               + INITRD_LOAD_ADDR,
-                                              ram_size - INITRD_LOAD_ADDR);
+                                              info->ram_size
+                                              - INITRD_LOAD_ADDR);
             if (initrd_size < 0) {
                 fprintf(stderr, "qemu: could not load initrd '%s'\n",
                         info->initrd_filename);