+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>
* include/multiboot2.h (multiboot_word): Rename from this ...
/* The asm part of the multiboot loader. */
void grub_multiboot_real_boot (grub_addr_t entry,
- struct grub_multiboot_info *mbi)
+ struct multiboot_info *mbi)
__attribute__ ((noreturn));
void grub_multiboot2_real_boot (grub_addr_t entry,
- struct grub_multiboot_info *mbi)
+ struct multiboot_info *mbi)
__attribute__ ((noreturn));
extern grub_addr_t grub_multiboot_payload_orig;
void grub_multiboot (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 */
/* multiboot.h - multiboot header file. */
/*
* 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
* it under the terms of the GNU General Public License as published by
/* Is there video information? */
#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 */
grub_size_t grub_lower_mem, grub_upper_mem;
/* 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
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
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
grub_machine_mmap_init ()
grub_fatal ("Unable to find Multiboot Information (is CONFIG_MULTIBOOT disabled in coreboot?)");
/* 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)
grub_fatal ("Missing Multiboot memory information");
grub_err_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)
{
#endif
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 char *playground = 0;
for (i = 0; i < mbi->mods_count; i++)
{
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 *)
- ((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 (playground);
grub_mmap_iterate (hook);
- return count * sizeof (struct grub_multiboot_mmap_entry);
+ return count * sizeof (struct multiboot_mmap_entry);
}
/* Fill previously allocated Multiboot mmap. */
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);
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
mmap_entry->addr = addr;
mmap_entry->len = size;
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++;
return 0;
{
grub_file_t file = 0;
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_uint32_t mmap_length;
int i;
/* Look for the multiboot header in the buffer. The header should
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);
- header = (struct grub_multiboot_header *) ((char *) header + 4))
+ header = (struct multiboot_header *) ((char *) header + 4))
{
if (header->magic == MULTIBOOT_MAGIC
&& !(header->magic + header->flags + header->checksum))
#define boot_loader_name_addr(x) \
((void *) ((x) + code_size + cmdline_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
/* boot_loader_name_length might need to grow for mbi,etc to be aligned (see below) */
+ boot_loader_name_length + 3
- + sizeof (struct grub_multiboot_info) + mmap_length;
+ + sizeof (struct multiboot_info) + mmap_length;
if (header->flags & MULTIBOOT_AOUT_KLUDGE)
{
mbi = mbi_addr (grub_multiboot_payload_orig);
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;
grub_fill_multiboot_mmap (mmap_addr (grub_multiboot_payload_orig));
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)
- * sizeof (struct grub_mod_list));
+ * sizeof (struct multiboot_mod_list));
if (! modlist)
goto fail;
mbi->mods_addr = (grub_uint32_t) modlist;
}
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)
goto fail;
modlist->mod_start = (grub_uint32_t) module;
static int
find_multi_boot1_header (grub_file_t file)
{
- struct grub_multiboot_header *header;
+ struct multiboot_header *header;
char buffer[MULTIBOOT_SEARCH];
int found_status = 0;
grub_ssize_t len;
/* Look for the multiboot header in the buffer. The header should
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);
- header = (struct grub_multiboot_header *) ((char *) header + 4))
+ header = (struct multiboot_header *) ((char *) header + 4))
{
if (header->magic == MULTIBOOT_MAGIC
&& !(header->magic + header->flags + header->checksum))