diff mbox

[Xen-devel,1/3] xen: arm: refactor struct kernel_info

Message ID 1396616219-32219-1-git-send-email-ian.campbell@citrix.com
State Accepted
Commit 315b7a0c8fa5ba2e8cd0c78893f9cdb37070171f
Headers show

Commit Message

Ian Campbell April 4, 2014, 12:56 p.m. UTC
The kernel_order and kernel_image fields are ELF specific.

Also add a few comments about what things are.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/arch/arm/kernel.c |   14 +++++++-------
 xen/arch/arm/kernel.h |   14 ++++++++------
 2 files changed, 15 insertions(+), 13 deletions(-)

Comments

Julien Grall April 4, 2014, 2:33 p.m. UTC | #1
Hi Ian,

On 04/04/2014 01:56 PM, Ian Campbell wrote:
> The kernel_order and kernel_image fields are ELF specific.
> 
> Also add a few comments about what things are.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Julien Grall <julien.grall@linaro.org>

Regards,
diff mbox

Patch

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index ae86772..d1fd307 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -295,7 +295,7 @@  static void kernel_elf_load(struct kernel_info *info)
     elf_load_binary(&info->elf.elf);
 
     printk("Free temporary kernel buffer\n");
-    free_xenheap_pages(info->kernel_img, info->kernel_order);
+    free_xenheap_pages(info->elf.kernel_img, info->elf.kernel_order);
 }
 
 static int kernel_try_elf_prepare(struct kernel_info *info,
@@ -305,14 +305,14 @@  static int kernel_try_elf_prepare(struct kernel_info *info,
 
     memset(&info->elf.elf, 0, sizeof(info->elf.elf));
 
-    info->kernel_order = get_order_from_bytes(size);
-    info->kernel_img = alloc_xenheap_pages(info->kernel_order, 0);
-    if ( info->kernel_img == NULL )
+    info->elf.kernel_order = get_order_from_bytes(size);
+    info->elf.kernel_img = alloc_xenheap_pages(info->elf.kernel_order, 0);
+    if ( info->elf.kernel_img == NULL )
         panic("Cannot allocate temporary buffer for kernel");
 
-    copy_from_paddr(info->kernel_img, addr, size);
+    copy_from_paddr(info->elf.kernel_img, addr, size);
 
-    if ( (rc = elf_init(&info->elf.elf, info->kernel_img, size )) != 0 )
+    if ( (rc = elf_init(&info->elf.elf, info->elf.kernel_img, size )) != 0 )
         goto err;
 #ifdef VERBOSE
     elf_set_verbose(&info->elf.elf);
@@ -351,7 +351,7 @@  err:
         printk("Xen: ELF kernel broken: %s\n",
                elf_check_broken(&info->elf.elf));
 
-    free_xenheap_pages(info->kernel_img, info->kernel_order);
+    free_xenheap_pages(info->elf.kernel_img, info->elf.kernel_order);
     return rc;
 }
 
diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
index ad2956b..2c27c64 100644
--- a/xen/arch/arm/kernel.h
+++ b/xen/arch/arm/kernel.h
@@ -18,14 +18,16 @@  struct kernel_info {
     paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */
     struct dt_mem_info mem;
 
-    paddr_t dtb_paddr;
+    /* kernel entry point */
     paddr_t entry;
 
+    /* boot blob load addresses */
+    paddr_t dtb_paddr;
     paddr_t initrd_paddr;
 
-    void *kernel_img;
-    unsigned kernel_order;
-
+    /* loader to use for this kernel */
+    void (*load)(struct kernel_info *info);
+    /* loader specific state */
     union {
         struct {
             paddr_t kernel_addr;
@@ -36,10 +38,10 @@  struct kernel_info {
         struct {
             struct elf_binary elf;
             struct elf_dom_parms parms;
+            unsigned kernel_order;
+            void *kernel_img;
         } elf;
     };
-
-    void (*load)(struct kernel_info *info);
 };
 
 int kernel_prepare(struct kernel_info *info);