commit-grub
[Top][All Lists]
Advanced

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

[1999] 2009-02-22 Robert Millan <address@hidden>


From: Robert Millan
Subject: [1999] 2009-02-22 Robert Millan <address@hidden>
Date: Sun, 22 Feb 2009 00:44:22 +0000

Revision: 1999
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1999
Author:   robertmh
Date:     2009-02-22 00:44:22 +0000 (Sun, 22 Feb 2009)

Log Message:
-----------
2009-02-22  Robert Millan  <address@hidden>

        * include/multiboot.h (MULTIBOOT_INFO_ALIGN): New macro.
        * loader/i386/pc/multiboot.c (grub_multiboot): Include the MBI
        in our relocation, instead of using it directly from heap.  Also
        use `MULTIBOOT_INFO_ALIGN' to ensure it is aligned.

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

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2009-02-21 14:55:06 UTC (rev 1998)
+++ trunk/grub2/ChangeLog       2009-02-22 00:44:22 UTC (rev 1999)
@@ -1,3 +1,10 @@
+2009-02-22  Robert Millan  <address@hidden>
+
+       * include/multiboot.h (MULTIBOOT_INFO_ALIGN): New macro.
+       * loader/i386/pc/multiboot.c (grub_multiboot): Include the MBI
+       in our relocation, instead of using it directly from heap.  Also
+       use `MULTIBOOT_INFO_ALIGN' to ensure it is aligned.
+
 2009-02-21  Robert Millan  <address@hidden>
 
        Implement USB keyboard support (based on patch by Marco Gerards)

Modified: trunk/grub2/include/multiboot.h
===================================================================
--- trunk/grub2/include/multiboot.h     2009-02-21 14:55:06 UTC (rev 1998)
+++ trunk/grub2/include/multiboot.h     2009-02-22 00:44:22 UTC (rev 1999)
@@ -1,7 +1,7 @@
 /* multiboot.h - multiboot header file. */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2003,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2003,2007,2009  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
@@ -35,6 +35,9 @@
 /* Alignment of multiboot modules.  */
 #define MULTIBOOT_MOD_ALIGN              0x00001000
 
+/* Alignment of the multiboot info structure.  */
+#define MULTIBOOT_INFO_ALIGN            0x00000004
+
 /* 
  * Flags set in the 'flags' member of the multiboot header.
  */

Modified: trunk/grub2/loader/i386/pc/multiboot.c
===================================================================
--- trunk/grub2/loader/i386/pc/multiboot.c      2009-02-21 14:55:06 UTC (rev 
1998)
+++ trunk/grub2/loader/i386/pc/multiboot.c      2009-02-22 00:44:22 UTC (rev 
1999)
@@ -1,7 +1,7 @@
 /* multiboot.c - boot a multiboot OS image. */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008  Free Software 
Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009  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
@@ -363,6 +363,7 @@
   char buffer[MULTIBOOT_SEARCH], *cmdline = 0, *p;
   struct grub_multiboot_header *header;
   grub_ssize_t len;
+  grub_uint32_t mmap_length;
   int i;
 
   grub_loader_unset ();
@@ -417,15 +418,10 @@
       playground = NULL;
     }
 
-  mbi = grub_malloc (sizeof (struct grub_multiboot_info));
-  if (! mbi)
-    goto fail;
+  mmap_length = grub_get_multiboot_mmap_len ();
 
-  grub_memset (mbi, 0, sizeof (struct grub_multiboot_info));
+  grub_multiboot_payload_size = sizeof (struct grub_multiboot_info) + 
mmap_length + MULTIBOOT_INFO_ALIGN;
 
-  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 -
@@ -462,6 +458,11 @@
   else if (grub_multiboot_load_elf (file, buffer) != GRUB_ERR_NONE)
     goto fail;
 
+  grub_multiboot_payload_size = ALIGN_UP (grub_multiboot_payload_size, 
MULTIBOOT_INFO_ALIGN);
+
+  mbi = grub_multiboot_payload_orig + grub_multiboot_payload_size - 
mmap_length - sizeof (struct grub_multiboot_info);
+  grub_memset (mbi, 0, sizeof (struct grub_multiboot_info));
+  mbi->mmap_length = mmap_length;
       
   grub_fill_multiboot_mmap ((struct grub_multiboot_mmap_entry *) 
(grub_multiboot_payload_orig
                                                                  + 
grub_multiboot_payload_size






reply via email to

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