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
|
@ -50,7 +50,7 @@
|
|||
#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;
|
||||
|
@ -74,9 +74,9 @@ grub_multiboot_unload (void)
|
|||
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);
|
||||
|
@ -107,14 +107,14 @@ grub_get_multiboot_mmap_len (void)
|
|||
|
||||
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)
|
||||
|
@ -122,7 +122,7 @@ grub_fill_multiboot_mmap (struct grub_multiboot_mmap_entry *first_entry)
|
|||
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;
|
||||
|
@ -197,7 +197,7 @@ grub_multiboot (int argc, char *argv[])
|
|||
{
|
||||
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;
|
||||
|
@ -228,9 +228,9 @@ grub_multiboot (int argc, char *argv[])
|
|||
|
||||
/* 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))
|
||||
|
@ -275,12 +275,12 @@ grub_multiboot (int argc, char *argv[])
|
|||
#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)
|
||||
{
|
||||
|
@ -324,7 +324,7 @@ grub_multiboot (int argc, char *argv[])
|
|||
|
||||
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));
|
||||
|
@ -462,10 +462,10 @@ grub_module (int argc, char *argv[])
|
|||
|
||||
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;
|
||||
|
@ -478,7 +478,7 @@ grub_module (int argc, char *argv[])
|
|||
}
|
||||
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;
|
||||
|
|
|
@ -44,7 +44,7 @@ static unsigned int module_version_status = 1;
|
|||
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;
|
||||
|
@ -55,9 +55,9 @@ find_multi_boot1_header (grub_file_t file)
|
|||
|
||||
/* 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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue