xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.fraser@eu.citrix.com>
To: Florian Wagner <f_wagner@syscomp.de>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: Cannot access memory beyond end of bootstrap direct-map area
Date: Wed, 24 Mar 2010 08:35:15 +0000	[thread overview]
Message-ID: <C7CF7F44.E3AD%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <20100324081615.4eb1b83d@auedv3.syscomp.de>

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

On 24/03/2010 07:16, "Florian Wagner" <f_wagner@syscomp.de> wrote:

>> Okay, please try the attached patch. You only need to rebuild/install
>> the hypervisor itself (xen.gz). If it works okay for you I will apply
>> it to the next stable releases of 4.0 and 3.4.
> 
> The patch didn't apply cleanly to the xen 3.4.2 release so I modified
> it to do so (see attached reloc-3.4.2).
> 
> All it did is turn the original problem into another one. I now get a
> "elf_init: not an ELF binary" error instead.

Please try the attached patch, which applies on top of the previous patch.

  -- Keir


[-- Attachment #2: 00-reloc --]
[-- Type: application/octet-stream, Size: 2279 bytes --]

diff -r 0475c567c708 xen/arch/x86/boot/reloc.c
--- a/xen/arch/x86/boot/reloc.c	Tue Mar 23 09:37:59 2010 +0000
+++ b/xen/arch/x86/boot/reloc.c	Wed Mar 24 08:32:36 2010 +0000
@@ -68,29 +68,37 @@
     {
         module_t *mods = reloc_mbi_struct(
             (module_t *)mbi->mods_addr, mbi->mods_count * sizeof(module_t));
+        u32 max_addr = 0;
+
         mbi->mods_addr = (u32)mods;
+
         for ( i = 0; i < mbi->mods_count; i++ )
         {
-#if XEN_BITSPERLONG == 32
-            /*
-             * 32-bit Xen only maps bottom 1GB of memory at boot time.
-             * Relocate modules which extend beyond this (GRUB2 in particular
-             * likes to place modules as high as possible below 4GB).
-             */
+            if ( mods[i].string )
+                mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
+            if ( mods[i].mod_end > max_addr )
+                max_addr = mods[i].mod_end;
+        }
+
+        /*
+         * 32-bit Xen only maps bottom 1GB of memory at boot time. Relocate 
+         * modules which extend beyond this (GRUB2 in particular likes to 
+         * place modules as high as possible below 4GB).
+         */
 #define BOOTMAP_END (1ul<<30) /* 1GB */
-            static void *mod_alloc = (void *)BOOTMAP_END;
-            u32 mod_len = mods[i].mod_end - mods[i].mod_start;
-            if ( mods[i].mod_end > BOOTMAP_END )
+        if ( (XEN_BITSPERLONG == 32) && (max_addr > BOOTMAP_END) )
+        {
+            char *mod_alloc = (char *)BOOTMAP_END;
+            for ( i = 0; i < mbi->mods_count; i++ )
+                mod_alloc -= mods[i].mod_end - mods[i].mod_start;
+            for ( i = 0; i < mbi->mods_count; i++ )
             {
-                mod_alloc = (void *)
-                    (((unsigned long)mod_alloc - mod_len) & ~15ul);
+                u32 mod_len = mods[i].mod_end - mods[i].mod_start;
                 mods[i].mod_start = (u32)memcpy(
                     mod_alloc, (char *)mods[i].mod_start, mod_len);
                 mods[i].mod_end = mods[i].mod_start + mod_len;
+                mod_alloc += mod_len;
             }
-#endif
-            if ( mods[i].string )
-                mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
         }
     }
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2010-03-24  8:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18  9:18 Cannot access memory beyond end of bootstrap direct-map area Florian Wagner
2010-03-18  9:22 ` Keir Fraser
2010-03-18 22:03 ` Keir Fraser
2010-03-24  7:16   ` Florian Wagner
2010-03-24  8:35     ` Keir Fraser [this message]
2010-03-24  9:32       ` Florian Wagner
  -- strict thread matches above, loose matches on Subject: below --
2009-08-27 17:28 cannot " Pascal Bouchareine
2009-08-27 18:55 ` Keir Fraser
2009-08-27 21:41   ` Pascal Bouchareine
2009-08-28  6:38     ` Keir Fraser
2009-08-28  7:44       ` Pascal Bouchareine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C7CF7F44.E3AD%keir.fraser@eu.citrix.com \
    --to=keir.fraser@eu.citrix.com \
    --cc=f_wagner@syscomp.de \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).