]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-08-30 Vladimir Serbinenko <phcoder@gmail.com>
authorphcoder <phcoder@localhost>
Sun, 30 Aug 2009 19:28:01 +0000 (19:28 +0000)
committerphcoder <phcoder@localhost>
Sun, 30 Aug 2009 19:28:01 +0000 (19:28 +0000)
* loader/i386/bsdXX.c (SUFFIX (grub_freebsd_load_elfmodule)): Fix
loading of headers in some cases.

ChangeLog
loader/i386/bsdXX.c

index 66c5711ee2a1c4ec3920a47a69213695ae5d868d..d4f1d894e4b415d0c8e69a8895ffa5677cc7421a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-30  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * loader/i386/bsdXX.c (SUFFIX (grub_freebsd_load_elfmodule)): Fix
+       loading of headers in some cases.
+
 2009-08-30  Robert Millan  <rmh.grub@aybabtu.com>
 
        * configure.ac: Bump version to 1.97~beta1.
index 3f15579dd22a923586bd34d6399e1c5931e08fc9..aedc204b23c92f13515fae498083d925790ae770 100644 (file)
@@ -197,15 +197,15 @@ SUFFIX (grub_freebsd_load_elfmodule) (grub_file_t file, int argc, char *argv[],
   if (curload < module + sizeof (e))
     curload = module + sizeof (e);
 
-  load (file, UINT_TO_PTR (module + e.e_shoff), e.e_shoff,
+  load (file, UINT_TO_PTR (curload), e.e_shoff,
        e.e_shnum * e.e_shentsize);
-  if (curload < module + e.e_shoff + e.e_shnum * e.e_shentsize)
-    curload = module + e.e_shoff + e.e_shnum * e.e_shentsize;
+  e.e_shoff = curload - module;
+  curload +=  e.e_shnum * e.e_shentsize;
 
-  load (file, UINT_TO_PTR (module + e.e_phoff), e.e_phoff,
+  load (file, UINT_TO_PTR (curload), e.e_phoff,
        e.e_phnum * e.e_phentsize);
-  if (curload < module + e.e_phoff + e.e_phnum * e.e_phentsize)
-    curload = module + e.e_phoff + e.e_phnum * e.e_phentsize;
+  e.e_phoff = curload - module;
+  curload +=  e.e_phnum * e.e_phentsize;
 
   *kern_end = curload;