[1858] 2008-09-07 Robert Millan <[email protected]>

Robert Millan <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 1858
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1858
Author:   robertmh
Date:     2008-09-07 17:13:00 +0000 (Sun, 07 Sep 2008)

Log Message:
-----------
2008-09-07  Robert Millan  <[email protected]>

        * loader/i386/pc/multiboot.c (mmap_addr, mmap_length): Remove
        variables.
        (grub_multiboot): Move `mbi' allocation upwards, so that mmap address
        and length can be stored directly in the `mbi->mmap_addr' and
        `mbi->mmap_length' struct fields.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/loader/i386/pc/multiboot.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2008-09-07 16:09:21 UTC (rev 1857)
+++ trunk/grub2/ChangeLog	2008-09-07 17:13:00 UTC (rev 1858)
@@ -1,5 +1,13 @@
 2008-09-07  Robert Millan  <[email protected]>
 
+	* loader/i386/pc/multiboot.c (mmap_addr, mmap_length): Remove
+	variables.
+	(grub_multiboot): Move `mbi' allocation upwards, so that mmap address
+	and length can be stored directly in the `mbi->mmap_addr' and
+	`mbi->mmap_length' struct fields.
+
+2008-09-07  Robert Millan  <[email protected]>
+
 	* conf/i386.rmk: New file.  Provides declaration for building
 	`cpuid.mod'.
 	* conf/i386-pc.rmk (pkglib_MODULES): Remove `cpuid.mod'.

Modified: trunk/grub2/loader/i386/pc/multiboot.c
===================================================================
--- trunk/grub2/loader/i386/pc/multiboot.c	2008-09-07 16:09:21 UTC (rev 1857)
+++ trunk/grub2/loader/i386/pc/multiboot.c	2008-09-07 17:13:00 UTC (rev 1858)
@@ -1,7 +1,7 @@
 /* multiboot.c - boot a multiboot OS image. */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003,2004,2005,2007,2008  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -82,11 +82,6 @@
   return GRUB_ERR_NONE;
 }
 
-/* FIXME: grub_uint32_t will break for addresses above 4 GiB, but is mandated
-   by the spec.  Is there something we can do about it?  */
-static grub_uint32_t mmap_addr = 0;
-static grub_uint32_t mmap_length;
-
 /* Return the length of the Multiboot mmap that will be needed to allocate
    our platform's map.  */
 static grub_uint32_t
@@ -422,9 +417,15 @@
       playground = NULL;
     }
 
-  mmap_length = grub_get_multiboot_mmap_len ();
-  grub_multiboot_payload_size = mmap_length;
+  mbi = grub_malloc (sizeof (struct grub_multiboot_info));
+  if (! mbi)
+    goto fail;
 
+  grub_memset (mbi, 0, sizeof (struct grub_multiboot_info));
+
+  mbi->mmap_length = grub_get_multiboot_mmap_len ();
+  grub_multiboot_payload_size = mbi->mmap_length;
+
   if (header->flags & MULTIBOOT_AOUT_KLUDGE)
     {
       int offset = ((char *) header - buffer -
@@ -464,9 +465,12 @@
       
   grub_fill_multiboot_mmap ((struct grub_multiboot_mmap_entry *) (grub_multiboot_payload_orig
 								  + grub_multiboot_payload_size
-								  - mmap_length));
+								  - mbi->mmap_length));
 
-  mmap_addr = grub_multiboot_payload_dest + grub_multiboot_payload_size - mmap_length;
+  /* FIXME: grub_uint32_t will break for addresses above 4 GiB, but is mandated
+     by the spec.  Is there something we can do about it?  */
+  mbi->mmap_addr = grub_multiboot_payload_dest + grub_multiboot_payload_size - mbi->mmap_length;
+  mbi->flags |= MULTIBOOT_INFO_MEM_MAP;
 
   if (grub_multiboot_payload_dest >= grub_multiboot_payload_orig)
     {
@@ -485,21 +489,11 @@
 		grub_multiboot_payload_size,
 		grub_multiboot_payload_entry_offset);
 
-  mbi = grub_malloc (sizeof (struct grub_multiboot_info));
-  if (! mbi)
-    goto fail;
-
-  grub_memset (mbi, 0, sizeof (struct grub_multiboot_info));
-
   /* Convert from bytes to kilobytes.  */
   mbi->mem_lower = grub_lower_mem / 1024;
   mbi->mem_upper = grub_upper_mem / 1024;
   mbi->flags |= MULTIBOOT_INFO_MEMORY;
 
-  mbi->mmap_addr = mmap_addr;
-  mbi->mmap_length = mmap_length;
-  mbi->flags |= MULTIBOOT_INFO_MEM_MAP;
-
   for (i = 0, len = 0; i < argc; i++)
     len += grub_strlen (argv[i]) + 1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.