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.
This commit is contained in:
parent
6374daf387
commit
a455f472aa
3 changed files with 20 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
|||
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)
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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 @@ grub_multiboot (int argc, char *argv[])
|
|||
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,14 +418,9 @@ grub_multiboot (int argc, char *argv[])
|
|||
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));
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -462,6 +458,11 @@ grub_multiboot (int argc, char *argv[])
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue