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

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



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@xxxxxxxxxx>
---
 xen/arch/arm/kernel.c |   14 +++++++-------
 xen/arch/arm/kernel.h |   14 ++++++++------
 2 files changed, 15 insertions(+), 13 deletions(-)

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);
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.