qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [rfc 2/3] arm : factor out set_kernel_args[_old]


From: Daniel Lezcano
Subject: [Qemu-devel] [rfc 2/3] arm : factor out set_kernel_args[_old]
Date: Mon, 6 Sep 2010 16:12:52 +0200

'initrd_size' and 'base' are already present in the 'info' structure,
passing them as parameter is redundant with the first parameter.

Signed-off-by: Daniel Lezcano <address@hidden>
---
 hw/arm_boot.c |   26 ++++++++++----------------
 1 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 50ec717..16a33af 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -49,12 +49,12 @@ static uint32_t smpboot[] = {
     p += 4;                       \
 } while (0)
 
-static void set_kernel_args(struct arm_boot_info *info,
-                int initrd_size, target_phys_addr_t base)
+static void set_kernel_args(struct arm_boot_info *info)
 {
-    target_phys_addr_t p;
+    target_phys_addr_t base = info->loader_start;
+    target_phys_addr_t p = base + KERNEL_ARGS_ADDR;
+    int initrd_size = info->initrd_size;
 
-    p = base + KERNEL_ARGS_ADDR;
     /* ATAG_CORE */
     WRITE_WORD(p, 5);
     WRITE_WORD(p, 0x54410001);
@@ -102,15 +102,14 @@ static void set_kernel_args(struct arm_boot_info *info,
     WRITE_WORD(p, 0);
 }
 
-static void set_kernel_args_old(struct arm_boot_info *info,
-                int initrd_size, target_phys_addr_t base)
+static void set_kernel_args_old(struct arm_boot_info *info)
 {
-    target_phys_addr_t p;
+    target_phys_addr_t base = info->loader_start;
+    /* see linux/include/asm-arm/setup.h */
+    target_phys_addr_t p = base + KERNEL_ARGS_ADDR;
+    int initrd_size = info->initrd_size;
     const char *s;
 
-
-    /* see linux/include/asm-arm/setup.h */
-    p = base + KERNEL_ARGS_ADDR;
     /* page_size */
     WRITE_WORD(p, 4096);
     /* nr_pages */
@@ -188,12 +187,7 @@ static void main_cpu_reset(void *opaque)
             env->thumb = info->entry & 1;
         } else {
             env->regs[15] = info->loader_start;
-            if (old_param) {
-                set_kernel_args_old(info, info->initrd_size,
-                                    info->loader_start);
-            } else {
-                set_kernel_args(info, info->initrd_size, info->loader_start);
-            }
+            old_param ? set_kernel_args_old(info): set_kernel_args(info);
         }
     }
     /* TODO:  Reset secondary CPUs.  */
-- 
1.7.0.4






reply via email to

[Prev in Thread] Current Thread [Next in Thread]