2009-11-13 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/multiboot.h (struct grub_multiboot_header): Move from here ... * include/multiboot.h (struct multiboot_header): ... to here. Update all users. * include/grub/multiboot.h (struct grub_multiboot_info): Move from here ... * include/multiboot.h (struct multiboot_info): ... to here. Update all users. * include/grub/multiboot.h (struct grub_multiboot_mmap_entry): Move from here ... * include/multiboot.h (struct multiboot_mmap_entry): ... to here. Update all users. * include/grub/multiboot.h (struct grub_mod_list): Move from here ... * include/multiboot.h (struct multiboot_mod_list): ... to here. Update all users.
This commit is contained in:
parent
a73f596946
commit
8d0edf4abd
7 changed files with 147 additions and 128 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
||||||
|
2009-11-13 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
|
* include/grub/multiboot.h (struct grub_multiboot_header): Move
|
||||||
|
from here ...
|
||||||
|
* include/multiboot.h (struct multiboot_header): ... to here. Update
|
||||||
|
all users.
|
||||||
|
* include/grub/multiboot.h (struct grub_multiboot_info): Move
|
||||||
|
from here ...
|
||||||
|
* include/multiboot.h (struct multiboot_info): ... to here. Update
|
||||||
|
all users.
|
||||||
|
* include/grub/multiboot.h (struct grub_multiboot_mmap_entry): Move
|
||||||
|
from here ...
|
||||||
|
* include/multiboot.h (struct multiboot_mmap_entry): ... to here.
|
||||||
|
Update all users.
|
||||||
|
* include/grub/multiboot.h (struct grub_mod_list): Move
|
||||||
|
from here ...
|
||||||
|
* include/multiboot.h (struct multiboot_mod_list): ... to here.
|
||||||
|
Update all users.
|
||||||
|
|
||||||
2009-11-13 Robert Millan <rmh.grub@aybabtu.com>
|
2009-11-13 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
* include/multiboot2.h (multiboot_word): Rename from this ...
|
* include/multiboot2.h (multiboot_word): Rename from this ...
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
|
|
||||||
/* The asm part of the multiboot loader. */
|
/* The asm part of the multiboot loader. */
|
||||||
void grub_multiboot_real_boot (grub_addr_t entry,
|
void grub_multiboot_real_boot (grub_addr_t entry,
|
||||||
struct grub_multiboot_info *mbi)
|
struct multiboot_info *mbi)
|
||||||
__attribute__ ((noreturn));
|
__attribute__ ((noreturn));
|
||||||
void grub_multiboot2_real_boot (grub_addr_t entry,
|
void grub_multiboot2_real_boot (grub_addr_t entry,
|
||||||
struct grub_multiboot_info *mbi)
|
struct multiboot_info *mbi)
|
||||||
__attribute__ ((noreturn));
|
__attribute__ ((noreturn));
|
||||||
|
|
||||||
extern grub_addr_t grub_multiboot_payload_orig;
|
extern grub_addr_t grub_multiboot_payload_orig;
|
||||||
|
|
|
@ -25,105 +25,4 @@
|
||||||
void grub_multiboot (int argc, char *argv[]);
|
void grub_multiboot (int argc, char *argv[]);
|
||||||
void grub_module (int argc, char *argv[]);
|
void grub_module (int argc, char *argv[]);
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
|
||||||
|
|
||||||
#include <grub/types.h>
|
|
||||||
|
|
||||||
struct grub_multiboot_header
|
|
||||||
{
|
|
||||||
/* Must be MULTIBOOT_MAGIC - see above. */
|
|
||||||
grub_uint32_t magic;
|
|
||||||
|
|
||||||
/* Feature flags. */
|
|
||||||
grub_uint32_t flags;
|
|
||||||
|
|
||||||
/* The above fields plus this one must equal 0 mod 2^32. */
|
|
||||||
grub_uint32_t checksum;
|
|
||||||
|
|
||||||
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
|
|
||||||
grub_uint32_t header_addr;
|
|
||||||
grub_uint32_t load_addr;
|
|
||||||
grub_uint32_t load_end_addr;
|
|
||||||
grub_uint32_t bss_end_addr;
|
|
||||||
grub_uint32_t entry_addr;
|
|
||||||
|
|
||||||
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
|
|
||||||
grub_uint32_t mode_type;
|
|
||||||
grub_uint32_t width;
|
|
||||||
grub_uint32_t height;
|
|
||||||
grub_uint32_t depth;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct grub_multiboot_info
|
|
||||||
{
|
|
||||||
/* Multiboot info version number */
|
|
||||||
grub_uint32_t flags;
|
|
||||||
|
|
||||||
/* Available memory from BIOS */
|
|
||||||
grub_uint32_t mem_lower;
|
|
||||||
grub_uint32_t mem_upper;
|
|
||||||
|
|
||||||
/* "root" partition */
|
|
||||||
grub_uint32_t boot_device;
|
|
||||||
|
|
||||||
/* Kernel command line */
|
|
||||||
grub_uint32_t cmdline;
|
|
||||||
|
|
||||||
/* Boot-Module list */
|
|
||||||
grub_uint32_t mods_count;
|
|
||||||
grub_uint32_t mods_addr;
|
|
||||||
|
|
||||||
grub_uint32_t syms[4];
|
|
||||||
|
|
||||||
/* Memory Mapping buffer */
|
|
||||||
grub_uint32_t mmap_length;
|
|
||||||
grub_uint32_t mmap_addr;
|
|
||||||
|
|
||||||
/* Drive Info buffer */
|
|
||||||
grub_uint32_t drives_length;
|
|
||||||
grub_uint32_t drives_addr;
|
|
||||||
|
|
||||||
/* ROM configuration table */
|
|
||||||
grub_uint32_t config_table;
|
|
||||||
|
|
||||||
/* Boot Loader Name */
|
|
||||||
grub_uint32_t boot_loader_name;
|
|
||||||
|
|
||||||
/* APM table */
|
|
||||||
grub_uint32_t apm_table;
|
|
||||||
|
|
||||||
/* Video */
|
|
||||||
grub_uint32_t vbe_control_info;
|
|
||||||
grub_uint32_t vbe_mode_info;
|
|
||||||
grub_uint16_t vbe_mode;
|
|
||||||
grub_uint16_t vbe_interface_seg;
|
|
||||||
grub_uint16_t vbe_interface_off;
|
|
||||||
grub_uint16_t vbe_interface_len;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct grub_multiboot_mmap_entry
|
|
||||||
{
|
|
||||||
grub_uint32_t size;
|
|
||||||
grub_uint64_t addr;
|
|
||||||
grub_uint64_t len;
|
|
||||||
#define GRUB_MULTIBOOT_MEMORY_AVAILABLE 1
|
|
||||||
#define GRUB_MULTIBOOT_MEMORY_RESERVED 2
|
|
||||||
grub_uint32_t type;
|
|
||||||
} __attribute__((packed));
|
|
||||||
|
|
||||||
struct grub_mod_list
|
|
||||||
{
|
|
||||||
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
|
|
||||||
grub_uint32_t mod_start;
|
|
||||||
grub_uint32_t mod_end;
|
|
||||||
|
|
||||||
/* Module command line */
|
|
||||||
grub_uint32_t cmdline;
|
|
||||||
|
|
||||||
/* padding to take it to 16 bytes (must be zero) */
|
|
||||||
grub_uint32_t pad;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ! ASM_FILE */
|
|
||||||
|
|
||||||
#endif /* ! GRUB_MULTIBOOT_HEADER */
|
#endif /* ! GRUB_MULTIBOOT_HEADER */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* multiboot.h - multiboot header file. */
|
/* multiboot.h - multiboot header file. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003,2007,2009 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -92,4 +92,105 @@
|
||||||
/* Is there video information? */
|
/* Is there video information? */
|
||||||
#define MULTIBOOT_INFO_VIDEO_INFO 0x00000800
|
#define MULTIBOOT_INFO_VIDEO_INFO 0x00000800
|
||||||
|
|
||||||
|
#ifndef ASM_FILE
|
||||||
|
|
||||||
|
#include <grub/types.h>
|
||||||
|
|
||||||
|
struct multiboot_header
|
||||||
|
{
|
||||||
|
/* Must be MULTIBOOT_MAGIC - see above. */
|
||||||
|
grub_uint32_t magic;
|
||||||
|
|
||||||
|
/* Feature flags. */
|
||||||
|
grub_uint32_t flags;
|
||||||
|
|
||||||
|
/* The above fields plus this one must equal 0 mod 2^32. */
|
||||||
|
grub_uint32_t checksum;
|
||||||
|
|
||||||
|
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
|
||||||
|
grub_uint32_t header_addr;
|
||||||
|
grub_uint32_t load_addr;
|
||||||
|
grub_uint32_t load_end_addr;
|
||||||
|
grub_uint32_t bss_end_addr;
|
||||||
|
grub_uint32_t entry_addr;
|
||||||
|
|
||||||
|
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
|
||||||
|
grub_uint32_t mode_type;
|
||||||
|
grub_uint32_t width;
|
||||||
|
grub_uint32_t height;
|
||||||
|
grub_uint32_t depth;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct multiboot_info
|
||||||
|
{
|
||||||
|
/* Multiboot info version number */
|
||||||
|
grub_uint32_t flags;
|
||||||
|
|
||||||
|
/* Available memory from BIOS */
|
||||||
|
grub_uint32_t mem_lower;
|
||||||
|
grub_uint32_t mem_upper;
|
||||||
|
|
||||||
|
/* "root" partition */
|
||||||
|
grub_uint32_t boot_device;
|
||||||
|
|
||||||
|
/* Kernel command line */
|
||||||
|
grub_uint32_t cmdline;
|
||||||
|
|
||||||
|
/* Boot-Module list */
|
||||||
|
grub_uint32_t mods_count;
|
||||||
|
grub_uint32_t mods_addr;
|
||||||
|
|
||||||
|
grub_uint32_t syms[4];
|
||||||
|
|
||||||
|
/* Memory Mapping buffer */
|
||||||
|
grub_uint32_t mmap_length;
|
||||||
|
grub_uint32_t mmap_addr;
|
||||||
|
|
||||||
|
/* Drive Info buffer */
|
||||||
|
grub_uint32_t drives_length;
|
||||||
|
grub_uint32_t drives_addr;
|
||||||
|
|
||||||
|
/* ROM configuration table */
|
||||||
|
grub_uint32_t config_table;
|
||||||
|
|
||||||
|
/* Boot Loader Name */
|
||||||
|
grub_uint32_t boot_loader_name;
|
||||||
|
|
||||||
|
/* APM table */
|
||||||
|
grub_uint32_t apm_table;
|
||||||
|
|
||||||
|
/* Video */
|
||||||
|
grub_uint32_t vbe_control_info;
|
||||||
|
grub_uint32_t vbe_mode_info;
|
||||||
|
grub_uint16_t vbe_mode;
|
||||||
|
grub_uint16_t vbe_interface_seg;
|
||||||
|
grub_uint16_t vbe_interface_off;
|
||||||
|
grub_uint16_t vbe_interface_len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct multiboot_mmap_entry
|
||||||
|
{
|
||||||
|
grub_uint32_t size;
|
||||||
|
grub_uint64_t addr;
|
||||||
|
grub_uint64_t len;
|
||||||
|
#define MULTIBOOT_MEMORY_AVAILABLE 1
|
||||||
|
#define MULTIBOOT_MEMORY_RESERVED 2
|
||||||
|
grub_uint32_t type;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
struct multiboot_mod_list
|
||||||
|
{
|
||||||
|
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
|
||||||
|
grub_uint32_t mod_start;
|
||||||
|
grub_uint32_t mod_end;
|
||||||
|
|
||||||
|
/* Module command line */
|
||||||
|
grub_uint32_t cmdline;
|
||||||
|
|
||||||
|
/* padding to take it to 16 bytes (must be zero) */
|
||||||
|
grub_uint32_t pad;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* ! ASM_FILE */
|
||||||
|
|
||||||
#endif /* ! MULTIBOOT_HEADER */
|
#endif /* ! MULTIBOOT_HEADER */
|
||||||
|
|
|
@ -26,15 +26,15 @@
|
||||||
grub_size_t grub_lower_mem, grub_upper_mem;
|
grub_size_t grub_lower_mem, grub_upper_mem;
|
||||||
|
|
||||||
/* A pointer to the MBI in its initial location. */
|
/* A pointer to the MBI in its initial location. */
|
||||||
struct grub_multiboot_info *startup_multiboot_info;
|
struct multiboot_info *startup_multiboot_info;
|
||||||
|
|
||||||
/* The MBI has to be copied to our BSS so that it won't be
|
/* The MBI has to be copied to our BSS so that it won't be
|
||||||
overwritten. This is its final location. */
|
overwritten. This is its final location. */
|
||||||
static struct grub_multiboot_info kern_multiboot_info;
|
static struct multiboot_info kern_multiboot_info;
|
||||||
|
|
||||||
/* Unfortunately we can't use heap at this point. But 32 looks like a sane
|
/* Unfortunately we can't use heap at this point. But 32 looks like a sane
|
||||||
limit (used by memtest86). */
|
limit (used by memtest86). */
|
||||||
static grub_uint8_t mmap_entries[sizeof (struct grub_multiboot_mmap_entry) * 32];
|
static grub_uint8_t mmap_entries[sizeof (struct multiboot_mmap_entry) * 32];
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_machine_mmap_init ()
|
grub_machine_mmap_init ()
|
||||||
|
@ -43,7 +43,7 @@ grub_machine_mmap_init ()
|
||||||
grub_fatal ("Unable to find Multiboot Information (is CONFIG_MULTIBOOT disabled in coreboot?)");
|
grub_fatal ("Unable to find Multiboot Information (is CONFIG_MULTIBOOT disabled in coreboot?)");
|
||||||
|
|
||||||
/* Move MBI to a safe place. */
|
/* Move MBI to a safe place. */
|
||||||
grub_memmove (&kern_multiboot_info, startup_multiboot_info, sizeof (struct grub_multiboot_info));
|
grub_memmove (&kern_multiboot_info, startup_multiboot_info, sizeof (struct multiboot_info));
|
||||||
|
|
||||||
if ((kern_multiboot_info.flags & MULTIBOOT_INFO_MEM_MAP) == 0)
|
if ((kern_multiboot_info.flags & MULTIBOOT_INFO_MEM_MAP) == 0)
|
||||||
grub_fatal ("Missing Multiboot memory information");
|
grub_fatal ("Missing Multiboot memory information");
|
||||||
|
@ -73,7 +73,7 @@ grub_machine_mmap_init ()
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
||||||
{
|
{
|
||||||
struct grub_multiboot_mmap_entry *entry = (void *) kern_multiboot_info.mmap_addr;
|
struct multiboot_mmap_entry *entry = (void *) kern_multiboot_info.mmap_addr;
|
||||||
|
|
||||||
while ((unsigned long) entry < kern_multiboot_info.mmap_addr + kern_multiboot_info.mmap_length)
|
while ((unsigned long) entry < kern_multiboot_info.mmap_addr + kern_multiboot_info.mmap_length)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern grub_dl_t my_mod;
|
extern grub_dl_t my_mod;
|
||||||
static struct grub_multiboot_info *mbi, *mbi_dest;
|
static struct multiboot_info *mbi, *mbi_dest;
|
||||||
static grub_addr_t entry;
|
static grub_addr_t entry;
|
||||||
|
|
||||||
static char *playground = 0;
|
static char *playground = 0;
|
||||||
|
@ -74,9 +74,9 @@ grub_multiboot_unload (void)
|
||||||
for (i = 0; i < mbi->mods_count; i++)
|
for (i = 0; i < mbi->mods_count; i++)
|
||||||
{
|
{
|
||||||
grub_free ((void *)
|
grub_free ((void *)
|
||||||
((struct grub_mod_list *) mbi->mods_addr)[i].mod_start);
|
((struct multiboot_mod_list *) mbi->mods_addr)[i].mod_start);
|
||||||
grub_free ((void *)
|
grub_free ((void *)
|
||||||
((struct grub_mod_list *) mbi->mods_addr)[i].cmdline);
|
((struct multiboot_mod_list *) mbi->mods_addr)[i].cmdline);
|
||||||
}
|
}
|
||||||
grub_free ((void *) mbi->mods_addr);
|
grub_free ((void *) mbi->mods_addr);
|
||||||
grub_free (playground);
|
grub_free (playground);
|
||||||
|
@ -107,14 +107,14 @@ grub_get_multiboot_mmap_len (void)
|
||||||
|
|
||||||
grub_mmap_iterate (hook);
|
grub_mmap_iterate (hook);
|
||||||
|
|
||||||
return count * sizeof (struct grub_multiboot_mmap_entry);
|
return count * sizeof (struct multiboot_mmap_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill previously allocated Multiboot mmap. */
|
/* Fill previously allocated Multiboot mmap. */
|
||||||
static void
|
static void
|
||||||
grub_fill_multiboot_mmap (struct grub_multiboot_mmap_entry *first_entry)
|
grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry)
|
||||||
{
|
{
|
||||||
struct grub_multiboot_mmap_entry *mmap_entry = (struct grub_multiboot_mmap_entry *) first_entry;
|
struct multiboot_mmap_entry *mmap_entry = (struct multiboot_mmap_entry *) first_entry;
|
||||||
|
|
||||||
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
|
||||||
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
|
||||||
|
@ -122,7 +122,7 @@ grub_fill_multiboot_mmap (struct grub_multiboot_mmap_entry *first_entry)
|
||||||
mmap_entry->addr = addr;
|
mmap_entry->addr = addr;
|
||||||
mmap_entry->len = size;
|
mmap_entry->len = size;
|
||||||
mmap_entry->type = type;
|
mmap_entry->type = type;
|
||||||
mmap_entry->size = sizeof (struct grub_multiboot_mmap_entry) - sizeof (mmap_entry->size);
|
mmap_entry->size = sizeof (struct multiboot_mmap_entry) - sizeof (mmap_entry->size);
|
||||||
mmap_entry++;
|
mmap_entry++;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -197,7 +197,7 @@ grub_multiboot (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
grub_file_t file = 0;
|
grub_file_t file = 0;
|
||||||
char buffer[MULTIBOOT_SEARCH], *cmdline = 0, *p;
|
char buffer[MULTIBOOT_SEARCH], *cmdline = 0, *p;
|
||||||
struct grub_multiboot_header *header;
|
struct multiboot_header *header;
|
||||||
grub_ssize_t len, cmdline_length, boot_loader_name_length;
|
grub_ssize_t len, cmdline_length, boot_loader_name_length;
|
||||||
grub_uint32_t mmap_length;
|
grub_uint32_t mmap_length;
|
||||||
int i;
|
int i;
|
||||||
|
@ -228,9 +228,9 @@ grub_multiboot (int argc, char *argv[])
|
||||||
|
|
||||||
/* Look for the multiboot header in the buffer. The header should
|
/* Look for the multiboot header in the buffer. The header should
|
||||||
be at least 12 bytes and aligned on a 4-byte boundary. */
|
be at least 12 bytes and aligned on a 4-byte boundary. */
|
||||||
for (header = (struct grub_multiboot_header *) buffer;
|
for (header = (struct multiboot_header *) buffer;
|
||||||
((char *) header <= buffer + len - 12) || (header = 0);
|
((char *) header <= buffer + len - 12) || (header = 0);
|
||||||
header = (struct grub_multiboot_header *) ((char *) header + 4))
|
header = (struct multiboot_header *) ((char *) header + 4))
|
||||||
{
|
{
|
||||||
if (header->magic == MULTIBOOT_MAGIC
|
if (header->magic == MULTIBOOT_MAGIC
|
||||||
&& !(header->magic + header->flags + header->checksum))
|
&& !(header->magic + header->flags + header->checksum))
|
||||||
|
@ -275,12 +275,12 @@ grub_multiboot (int argc, char *argv[])
|
||||||
#define boot_loader_name_addr(x) \
|
#define boot_loader_name_addr(x) \
|
||||||
((void *) ((x) + code_size + cmdline_length))
|
((void *) ((x) + code_size + cmdline_length))
|
||||||
#define mbi_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length))
|
#define mbi_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length))
|
||||||
#define mmap_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length + sizeof (struct grub_multiboot_info)))
|
#define mmap_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length + sizeof (struct multiboot_info)))
|
||||||
|
|
||||||
grub_multiboot_payload_size = cmdline_length
|
grub_multiboot_payload_size = cmdline_length
|
||||||
/* boot_loader_name_length might need to grow for mbi,etc to be aligned (see below) */
|
/* boot_loader_name_length might need to grow for mbi,etc to be aligned (see below) */
|
||||||
+ boot_loader_name_length + 3
|
+ boot_loader_name_length + 3
|
||||||
+ sizeof (struct grub_multiboot_info) + mmap_length;
|
+ sizeof (struct multiboot_info) + mmap_length;
|
||||||
|
|
||||||
if (header->flags & MULTIBOOT_AOUT_KLUDGE)
|
if (header->flags & MULTIBOOT_AOUT_KLUDGE)
|
||||||
{
|
{
|
||||||
|
@ -324,7 +324,7 @@ grub_multiboot (int argc, char *argv[])
|
||||||
|
|
||||||
mbi = mbi_addr (grub_multiboot_payload_orig);
|
mbi = mbi_addr (grub_multiboot_payload_orig);
|
||||||
mbi_dest = mbi_addr (grub_multiboot_payload_dest);
|
mbi_dest = mbi_addr (grub_multiboot_payload_dest);
|
||||||
grub_memset (mbi, 0, sizeof (struct grub_multiboot_info));
|
grub_memset (mbi, 0, sizeof (struct multiboot_info));
|
||||||
mbi->mmap_length = mmap_length;
|
mbi->mmap_length = mmap_length;
|
||||||
|
|
||||||
grub_fill_multiboot_mmap (mmap_addr (grub_multiboot_payload_orig));
|
grub_fill_multiboot_mmap (mmap_addr (grub_multiboot_payload_orig));
|
||||||
|
@ -462,10 +462,10 @@ grub_module (int argc, char *argv[])
|
||||||
|
|
||||||
if (mbi->flags & MULTIBOOT_INFO_MODS)
|
if (mbi->flags & MULTIBOOT_INFO_MODS)
|
||||||
{
|
{
|
||||||
struct grub_mod_list *modlist = (struct grub_mod_list *) mbi->mods_addr;
|
struct multiboot_mod_list *modlist = (struct multiboot_mod_list *) mbi->mods_addr;
|
||||||
|
|
||||||
modlist = grub_realloc (modlist, (mbi->mods_count + 1)
|
modlist = grub_realloc (modlist, (mbi->mods_count + 1)
|
||||||
* sizeof (struct grub_mod_list));
|
* sizeof (struct multiboot_mod_list));
|
||||||
if (! modlist)
|
if (! modlist)
|
||||||
goto fail;
|
goto fail;
|
||||||
mbi->mods_addr = (grub_uint32_t) modlist;
|
mbi->mods_addr = (grub_uint32_t) modlist;
|
||||||
|
@ -478,7 +478,7 @@ grub_module (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct grub_mod_list *modlist = grub_zalloc (sizeof (struct grub_mod_list));
|
struct multiboot_mod_list *modlist = grub_zalloc (sizeof (struct multiboot_mod_list));
|
||||||
if (! modlist)
|
if (! modlist)
|
||||||
goto fail;
|
goto fail;
|
||||||
modlist->mod_start = (grub_uint32_t) module;
|
modlist->mod_start = (grub_uint32_t) module;
|
||||||
|
|
|
@ -44,7 +44,7 @@ static unsigned int module_version_status = 1;
|
||||||
static int
|
static int
|
||||||
find_multi_boot1_header (grub_file_t file)
|
find_multi_boot1_header (grub_file_t file)
|
||||||
{
|
{
|
||||||
struct grub_multiboot_header *header;
|
struct multiboot_header *header;
|
||||||
char buffer[MULTIBOOT_SEARCH];
|
char buffer[MULTIBOOT_SEARCH];
|
||||||
int found_status = 0;
|
int found_status = 0;
|
||||||
grub_ssize_t len;
|
grub_ssize_t len;
|
||||||
|
@ -55,9 +55,9 @@ find_multi_boot1_header (grub_file_t file)
|
||||||
|
|
||||||
/* Look for the multiboot header in the buffer. The header should
|
/* Look for the multiboot header in the buffer. The header should
|
||||||
be at least 12 bytes and aligned on a 4-byte boundary. */
|
be at least 12 bytes and aligned on a 4-byte boundary. */
|
||||||
for (header = (struct grub_multiboot_header *) buffer;
|
for (header = (struct multiboot_header *) buffer;
|
||||||
((char *) header <= buffer + len - 12) || (header = 0);
|
((char *) header <= buffer + len - 12) || (header = 0);
|
||||||
header = (struct grub_multiboot_header *) ((char *) header + 4))
|
header = (struct multiboot_header *) ((char *) header + 4))
|
||||||
{
|
{
|
||||||
if (header->magic == MULTIBOOT_MAGIC
|
if (header->magic == MULTIBOOT_MAGIC
|
||||||
&& !(header->magic + header->flags + header->checksum))
|
&& !(header->magic + header->flags + header->checksum))
|
||||||
|
|
Loading…
Reference in a new issue