2009-11-13 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot2.h (multiboot_word): Rename from this ... (multiboot2_word): ... to this. Update all users. (multiboot_header): Rename from this ... (multiboot2_header): ... to this. Update all users. (multiboot_tag_header): Rename from this ... (multiboot2_tag_header): ... to this. Update all users. (multiboot_tag_start): Rename from this ... (multiboot2_tag_start): ... to this. Update all users. (multiboot_tag_name): Rename from this ... (multiboot2_tag_name): ... to this. Update all users. (multiboot_tag_module): Rename from this ... (multiboot2_tag_module): ... to this. Update all users. (multiboot_tag_memory): Rename from this ... (multiboot2_tag_memory): ... to this. Update all users. (multiboot_tag_unused): Rename from this ... (multiboot2_tag_unused): ... to this. Update all users. (multiboot_tag_end): Rename from this ... (multiboot2_tag_end): ... to this. Update all users.
This commit is contained in:
parent
1c8927f083
commit
6944770e0c
5 changed files with 53 additions and 53 deletions
|
@ -30,7 +30,7 @@ typedef grub_uint64_t uint64_t;
|
|||
#define __WORDSIZE GRUB_TARGET_WORDSIZE
|
||||
#endif
|
||||
|
||||
struct multiboot_tag_header;
|
||||
struct multiboot2_tag_header;
|
||||
|
||||
grub_err_t
|
||||
grub_mb2_tag_alloc (grub_addr_t *addr, int key, grub_size_t len);
|
||||
|
@ -42,7 +42,7 @@ void
|
|||
grub_mb2_arch_boot (grub_addr_t entry, void *tags);
|
||||
|
||||
void
|
||||
grub_mb2_arch_unload (struct multiboot_tag_header *tags);
|
||||
grub_mb2_arch_unload (struct multiboot2_tag_header *tags);
|
||||
|
||||
grub_err_t
|
||||
grub_mb2_arch_elf32_hook (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load);
|
||||
|
@ -65,6 +65,6 @@ grub_module2 (int argc, char *argv[]);
|
|||
#define for_each_tag(tag, tags) \
|
||||
for (tag = tags; \
|
||||
tag && tag->key != MULTIBOOT2_TAG_END; \
|
||||
tag = (struct multiboot_tag_header *)((char *)tag + tag->len))
|
||||
tag = (struct multiboot2_tag_header *)((char *)tag + tag->len))
|
||||
|
||||
#endif /* ! GRUB_MULTIBOOT2_HEADER */
|
||||
|
|
|
@ -40,18 +40,18 @@
|
|||
|
||||
/* XXX not portable? */
|
||||
#if __WORDSIZE == 64
|
||||
typedef uint64_t multiboot_word;
|
||||
typedef uint64_t multiboot2_word;
|
||||
#else
|
||||
typedef uint32_t multiboot_word;
|
||||
typedef uint32_t multiboot2_word;
|
||||
#endif
|
||||
|
||||
struct multiboot_header
|
||||
struct multiboot2_header
|
||||
{
|
||||
uint32_t magic;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct multiboot_tag_header
|
||||
struct multiboot2_tag_header
|
||||
{
|
||||
uint32_t key;
|
||||
uint32_t len;
|
||||
|
@ -61,48 +61,48 @@ struct multiboot_tag_header
|
|||
#define MULTIBOOT2_TAG_RESERVED2 (~0)
|
||||
|
||||
#define MULTIBOOT2_TAG_START 1
|
||||
struct multiboot_tag_start
|
||||
struct multiboot2_tag_start
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
multiboot_word size; /* Total size of all multiboot tags. */
|
||||
struct multiboot2_tag_header header;
|
||||
multiboot2_word size; /* Total size of all multiboot tags. */
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_NAME 2
|
||||
struct multiboot_tag_name
|
||||
struct multiboot2_tag_name
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
struct multiboot2_tag_header header;
|
||||
char name[1];
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_MODULE 3
|
||||
struct multiboot_tag_module
|
||||
struct multiboot2_tag_module
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
multiboot_word addr;
|
||||
multiboot_word size;
|
||||
struct multiboot2_tag_header header;
|
||||
multiboot2_word addr;
|
||||
multiboot2_word size;
|
||||
char type[36];
|
||||
char cmdline[1];
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_MEMORY 4
|
||||
struct multiboot_tag_memory
|
||||
struct multiboot2_tag_memory
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
multiboot_word addr;
|
||||
multiboot_word size;
|
||||
multiboot_word type;
|
||||
struct multiboot2_tag_header header;
|
||||
multiboot2_word addr;
|
||||
multiboot2_word size;
|
||||
multiboot2_word type;
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_UNUSED 5
|
||||
struct multiboot_tag_unused
|
||||
struct multiboot2_tag_unused
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
struct multiboot2_tag_header header;
|
||||
};
|
||||
|
||||
#define MULTIBOOT2_TAG_END 0xffff
|
||||
struct multiboot_tag_end
|
||||
struct multiboot2_tag_end
|
||||
{
|
||||
struct multiboot_tag_header header;
|
||||
struct multiboot2_tag_header header;
|
||||
};
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
|
|
@ -95,17 +95,17 @@ grub_mb2_arch_boot (grub_addr_t entry, void *tags)
|
|||
}
|
||||
|
||||
void
|
||||
grub_mb2_arch_unload (struct multiboot_tag_header *tags)
|
||||
grub_mb2_arch_unload (struct multiboot2_tag_header *tags)
|
||||
{
|
||||
struct multiboot_tag_header *tag;
|
||||
struct multiboot2_tag_header *tag;
|
||||
|
||||
/* Free all module memory in the tag list. */
|
||||
for_each_tag (tag, tags)
|
||||
{
|
||||
if (tag->key == MULTIBOOT2_TAG_MODULE)
|
||||
{
|
||||
struct multiboot_tag_module *module =
|
||||
(struct multiboot_tag_module *) tag;
|
||||
struct multiboot2_tag_module *module =
|
||||
(struct multiboot2_tag_module *) tag;
|
||||
grub_free((void *) module->addr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,17 +115,17 @@ grub_mb2_tags_arch_create (void)
|
|||
|
||||
/* Release the memory we claimed from Open Firmware above. */
|
||||
void
|
||||
grub_mb2_arch_unload (struct multiboot_tag_header *tags)
|
||||
grub_mb2_arch_unload (struct multiboot2_tag_header *tags)
|
||||
{
|
||||
struct multiboot_tag_header *tag;
|
||||
struct multiboot2_tag_header *tag;
|
||||
|
||||
/* Free all module memory in the tag list. */
|
||||
for_each_tag (tag, tags)
|
||||
{
|
||||
if (tag->key == MULTIBOOT2_TAG_MODULE)
|
||||
{
|
||||
struct multiboot_tag_module *module =
|
||||
(struct multiboot_tag_module *) tag;
|
||||
struct multiboot2_tag_module *module =
|
||||
(struct multiboot2_tag_module *) tag;
|
||||
grub_ieee1275_release (module->addr, module->size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ grub_mb2_tags_free (void)
|
|||
grub_err_t
|
||||
grub_mb2_tag_alloc (grub_addr_t *addr, int key, grub_size_t len)
|
||||
{
|
||||
struct multiboot_tag_header *tag;
|
||||
struct multiboot2_tag_header *tag;
|
||||
grub_size_t used;
|
||||
grub_size_t needed;
|
||||
|
||||
|
@ -59,7 +59,7 @@ grub_mb2_tag_alloc (grub_addr_t *addr, int key, grub_size_t len)
|
|||
key, (unsigned long) len);
|
||||
|
||||
used = grub_mb2_tags_pos - grub_mb2_tags;
|
||||
len = ALIGN_UP (len, sizeof (multiboot_word));
|
||||
len = ALIGN_UP (len, sizeof (multiboot2_word));
|
||||
|
||||
needed = used + len;
|
||||
|
||||
|
@ -83,7 +83,7 @@ grub_mb2_tag_alloc (grub_addr_t *addr, int key, grub_size_t len)
|
|||
grub_mb2_tags_pos = newarea + used;
|
||||
}
|
||||
|
||||
tag = (struct multiboot_tag_header *) grub_mb2_tags_pos;
|
||||
tag = (struct multiboot2_tag_header *) grub_mb2_tags_pos;
|
||||
grub_mb2_tags_pos += len;
|
||||
|
||||
tag->key = key;
|
||||
|
@ -103,24 +103,24 @@ static grub_err_t
|
|||
grub_mb2_tag_start_create (void)
|
||||
{
|
||||
return grub_mb2_tag_alloc (0, MULTIBOOT2_TAG_START,
|
||||
sizeof (struct multiboot_tag_start));
|
||||
sizeof (struct multiboot2_tag_start));
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_mb2_tag_name_create (void)
|
||||
{
|
||||
struct multiboot_tag_name *name;
|
||||
struct multiboot2_tag_name *name;
|
||||
grub_addr_t name_addr;
|
||||
grub_err_t err;
|
||||
const char *grub_version = PACKAGE_STRING;
|
||||
|
||||
err = grub_mb2_tag_alloc (&name_addr, MULTIBOOT2_TAG_NAME,
|
||||
sizeof (struct multiboot_tag_name) +
|
||||
sizeof (struct multiboot2_tag_name) +
|
||||
sizeof (grub_version) + 1);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
name = (struct multiboot_tag_name *) name_addr;
|
||||
name = (struct multiboot2_tag_name *) name_addr;
|
||||
grub_strcpy (name->name, grub_version);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
@ -159,17 +159,17 @@ error:
|
|||
static grub_err_t
|
||||
grub_mb2_tags_finish (void)
|
||||
{
|
||||
struct multiboot_tag_start *start;
|
||||
struct multiboot2_tag_start *start;
|
||||
grub_err_t err;
|
||||
|
||||
/* Create the `end' tag. */
|
||||
err = grub_mb2_tag_alloc (0, MULTIBOOT2_TAG_END,
|
||||
sizeof (struct multiboot_tag_end));
|
||||
sizeof (struct multiboot2_tag_end));
|
||||
if (err)
|
||||
goto error;
|
||||
|
||||
/* We created the `start' tag first. Update it now. */
|
||||
start = (struct multiboot_tag_start *) grub_mb2_tags;
|
||||
start = (struct multiboot2_tag_start *) grub_mb2_tags;
|
||||
start->size = grub_mb2_tags_pos - grub_mb2_tags;
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
|
@ -195,17 +195,17 @@ grub_mb2_boot (void)
|
|||
static grub_err_t
|
||||
grub_mb2_unload (void)
|
||||
{
|
||||
struct multiboot_tag_header *tag;
|
||||
struct multiboot_tag_header *tags =
|
||||
(struct multiboot_tag_header *) grub_mb2_tags;
|
||||
struct multiboot2_tag_header *tag;
|
||||
struct multiboot2_tag_header *tags =
|
||||
(struct multiboot2_tag_header *) grub_mb2_tags;
|
||||
|
||||
/* Free all module memory in the tag list. */
|
||||
for_each_tag (tag, tags)
|
||||
{
|
||||
if (tag->key == MULTIBOOT2_TAG_MODULE)
|
||||
{
|
||||
struct multiboot_tag_module *module =
|
||||
(struct multiboot_tag_module *) tag;
|
||||
struct multiboot2_tag_module *module =
|
||||
(struct multiboot2_tag_module *) tag;
|
||||
grub_free ((void *) module->addr);
|
||||
}
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ static grub_err_t
|
|||
grub_mb2_tag_module_create (grub_addr_t modaddr, grub_size_t modsize,
|
||||
char *type, int key, int argc, char *argv[])
|
||||
{
|
||||
struct multiboot_tag_module *module;
|
||||
struct multiboot2_tag_module *module;
|
||||
grub_ssize_t argslen = 0;
|
||||
grub_err_t err;
|
||||
char *p;
|
||||
|
@ -246,11 +246,11 @@ grub_mb2_tag_module_create (grub_addr_t modaddr, grub_size_t modsize,
|
|||
|
||||
/* Note: includes implicit 1-byte cmdline. */
|
||||
err = grub_mb2_tag_alloc (&module_addr, key,
|
||||
sizeof (struct multiboot_tag_module) + argslen);
|
||||
sizeof (struct multiboot2_tag_module) + argslen);
|
||||
if (err)
|
||||
return grub_errno;
|
||||
|
||||
module = (struct multiboot_tag_module *) module_addr;
|
||||
module = (struct multiboot2_tag_module *) module_addr;
|
||||
module->addr = modaddr;
|
||||
module->size = modsize;
|
||||
grub_strcpy(module->type, type);
|
||||
|
@ -308,7 +308,7 @@ grub_multiboot2 (int argc, char *argv[])
|
|||
char *buffer;
|
||||
grub_file_t file = 0;
|
||||
grub_elf_t elf = 0;
|
||||
struct multiboot_header *header = 0;
|
||||
struct multiboot2_header *header = 0;
|
||||
char *p;
|
||||
grub_ssize_t len;
|
||||
grub_err_t err;
|
||||
|
@ -344,7 +344,7 @@ grub_multiboot2 (int argc, char *argv[])
|
|||
be at least 8 bytes and aligned on a 8-byte boundary. */
|
||||
for (p = buffer; p <= buffer + len - 8; p += 8)
|
||||
{
|
||||
header = (struct multiboot_header *) p;
|
||||
header = (struct multiboot2_header *) p;
|
||||
if (header->magic == MULTIBOOT2_HEADER_MAGIC)
|
||||
{
|
||||
header_found = 1;
|
||||
|
|
Loading…
Reference in a new issue