+2009-02-22 Robert Millan <rmh@aybabtu.com>
+
+ * 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 <rmh@aybabtu.com>
Implement USB keyboard support (based on patch by Marco Gerards)
/* 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
/* 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.
*/
/* 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
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 ();
playground = NULL;
}
- mbi = grub_malloc (sizeof (struct grub_multiboot_info));
- if (! mbi)
- goto fail;
-
- grub_memset (mbi, 0, sizeof (struct grub_multiboot_info));
+ mmap_length = grub_get_multiboot_mmap_len ();
- mbi->mmap_length = grub_get_multiboot_mmap_len ();
- grub_multiboot_payload_size = mbi->mmap_length;
+ grub_multiboot_payload_size = sizeof (struct grub_multiboot_info) + mmap_length + MULTIBOOT_INFO_ALIGN;
if (header->flags & MULTIBOOT_AOUT_KLUDGE)
{
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