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

[Xen-devel] better fix for checking if bzImage



The access fault when trying to calculate bzimage_headroom() is back when I use 
a new version of tboot that has some additional code added to it.

Here is a patch that I think more properly fixes the issue (and fixes it for my 
new, larger tboot) and should prevent it from recurring:

diff -r 916ca93a8658 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Thu Jan 29 23:40:37 2009 +0000
+++ b/xen/arch/x86/setup.c      Fri Jan 30 00:09:27 2009 -0800
@@ -417,7 +417,7 @@ void __init __start_xen(unsigned long mb
     unsigned int initrdidx = 1;
     multiboot_info_t *mbi = __va(mbi_p);
     module_t *mod = (module_t *)__va(mbi->mods_addr);
-    unsigned long nr_pages, modules_length, modules_headroom = -1;
+    unsigned long nr_pages, modules_length, modules_headroom;
     unsigned long allocator_bitmap_end;
     int i, e820_warn = 0, bytes = 0;
     struct ns16550_defaults ns16550 = {
@@ -618,6 +618,12 @@ void __init __start_xen(unsigned long mb
      */
     modules_length = mod[mbi->mods_count-1].mod_end - mod[0].mod_start;

+    /* ensure mod[0] is mapped before parsing */
+    bootstrap_map(mod[0].mod_start, mod[0].mod_end);
+    modules_headroom = bzimage_headroom(
+                      (char *)(unsigned long)mod[0].mod_start,
+                      (unsigned long)(mod[0].mod_end - mod[0].mod_start));
+
     for ( i = boot_e820.nr_map-1; i >= 0; i-- )
     {
         uint64_t s, e, mask = (1UL << L2_PAGETABLE_SHIFT) - 1;
@@ -720,11 +726,6 @@ void __init __start_xen(unsigned long mb
                 "D" (__va(__pa(cpu0_stack))), "c" (STACK_SIZE) : "memory" );
         }
 #endif
-
-        if ( modules_headroom == -1 )
-            modules_headroom = bzimage_headroom(
-                      (char *)(unsigned long)mod[0].mod_start,
-                      (unsigned long)(mod[0].mod_end - mod[0].mod_start));

         /* Is the region suitable for relocating the multiboot modules? */
         if ( !initial_images_start && (s < e) &&

Signed-off-by:  Joseph Cihula <joseph.cihula@xxxxxxxxx>

Sorry for the churn in the code.

Joe

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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