l4-hurd
[Top][All Lists]
Advanced

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

Re: booting l4-Hurd, memory unaligned


From: Derek Davies
Subject: Re: booting l4-Hurd, memory unaligned
Date: 06 Apr 2005 23:00:06 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Here's something to try.  Andreas, if you'd like to, please give it a
try and send me the boot output.  Code review welcome!

Index: ia32-cmain.c
===================================================================
RCS file: /cvsroot/hurd/hurd-l4/laden/ia32-cmain.c,v
retrieving revision 1.14
diff -u -r1.14 ia32-cmain.c
--- ia32-cmain.c        17 Nov 2004 16:21:39 -0000      1.14
+++ ia32-cmain.c        7 Apr 2005 02:45:53 -0000
@@ -250,10 +250,20 @@
          if (end >> 32)
            panic ("L4 does not support more than 4 GB on ia32");
 
-         if (mmap->base_addr & ((1 << 10) - 1)
-             || mmap->length & ((1 << 10) - 1))
-           panic ("Memory region (0x%llx - 0x%llx) is unaligned",
-                  mmap->base_addr, end);
+         if (mmap->type == 2)
+           {
+             int end = (mmap->base_addr + mmap->length) - 1;
+             int aligned_base = mmap->base_addr & (~((1 << 10) - 1));
+             int aligned_end = (end + ((1 << 10) - 1)) & (~((1 << 10) - 1));
+             int aligned_len = (aligned_end - aligned_base) + 1;
+             mmap->base_addr = aligned_base;
+             mmap->length = aligned_length;
+           }
+         else
+           if (mmap->base_addr & ((1 << 10) - 1)
+               || mmap->length & ((1 << 10) - 1))
+               panic ("Memory region (0x%llx - 0x%llx) is unaligned",
+                      mmap->base_addr, end);
 
          add_memory_map ((uint32_t) mmap->base_addr, (uint32_t) end,
                          mmap->type == 1



reply via email to

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