upgrade multiboot2 header

This commit is contained in:
nub31
2025-12-30 23:07:39 +01:00
parent a9b25c5b9e
commit 9fd2d0ca6d
3 changed files with 136 additions and 41 deletions

View File

@@ -7,24 +7,6 @@
#include "panic.h"
#include "util.h"
static void *multiboot_find_tag(uptr multiboot_info, u32 type) {
uptr next = multiboot_info + 8;
while (true) {
multiboot_tag *tag = (multiboot_tag*)next;
if (tag->type == MULTIBOOT_TAG_TYPE_END) {
return NULL;
}
if (tag->type == type) {
return tag;
}
next = align_up(next + tag->size, MULTIBOOT_TAG_ALIGN);
}
}
#define MAX_REGIONS 64
typedef struct {
@@ -39,7 +21,7 @@ static memory_region memory_regions[MAX_REGIONS] = {0};
static size_t memory_region_count = 0;
static void find_memory_regions(uptr multiboot_info) {
multiboot_tag_mmap *tag = multiboot_find_tag(multiboot_info, MULTIBOOT_TAG_TYPE_MMAP);
multiboot_tag_mmap *tag = multiboot_get_mmap(multiboot_info);
if (tag == NULL) {
boot_panic("Multiboot did not provide mmap tag");
}