diff options
Diffstat (limited to 'kernel/mboot/mmap.c')
-rw-r--r-- | kernel/mboot/mmap.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/kernel/mboot/mmap.c b/kernel/mboot/mmap.c index f319395..e93421d 100644 --- a/kernel/mboot/mmap.c +++ b/kernel/mboot/mmap.c @@ -3,6 +3,23 @@ #include "mboot.h" +#define MULTIBOOT_TAG_TYPE_MMAP 6 + +struct multiboot_mmap_entry { + uint64_t addr; + uint64_t len; + uint32_t type; + uint32_t zero; +}; + +struct multiboot_tag_mmap { + uint32_t type; + uint32_t size; + uint32_t entry_size; + uint32_t entry_version; + struct multiboot_mmap_entry entries[]; +}; + static const char *segment_type[] = { "Reserved", "Free", "Reserved", "ACPI Reserved", "Hibernation", "Defective", @@ -10,11 +27,11 @@ static const char *segment_type[] = { "Reserved", "Free", int mboot_get_mmap(struct memory_map *res) { - void *tag = locate_mboot_table(MBOOT_MEMORY_MAP); + void *tag = locate_mboot_table(MULTIBOOT_TAG_TYPE_MMAP); if (tag == NULL) return 1; - struct mboot_tag_mmap *mmap = (struct mboot_tag_mmap *)tag; + struct multiboot_tag_mmap *mmap = (struct multiboot_tag_mmap *)tag; int idx = 0; uintptr_t i = (uintptr_t)mmap->entries; @@ -22,7 +39,7 @@ int mboot_get_mmap(struct memory_map *res) char buf[20]; for (; i < (uintptr_t)mmap->entries + mmap->size; i += mmap->entry_size, idx++) { - struct mboot_mmap_entry *seg = (struct mboot_mmap_entry *)i; + struct multiboot_mmap_entry *seg = (struct multiboot_mmap_entry *)i; const char *type = NULL; if (seg->type > 6) type = segment_type[6]; |