diff --git a/limine.bin b/limine.bin index b5ecfded..1ac1bbcf 100644 Binary files a/limine.bin and b/limine.bin differ diff --git a/stage2/protos/stivale.c b/stage2/protos/stivale.c index 42fdcdac..11492fff 100644 --- a/stage2/protos/stivale.c +++ b/stage2/protos/stivale.c @@ -207,12 +207,14 @@ void stivale_load(char *cmdline, int boot_drive) { size_t memmap_entries; struct e820_entry_t *memmap = get_memmap(&memmap_entries); - stivale_struct.memory_map_entries = (uint64_t)memmap_entries; - stivale_struct.memory_map_addr = (uint64_t)(size_t)memmap; bool want_5lv = level5pg && (stivale_hdr.flags & (1 << 1)); pagemap_t pagemap = stivale_build_pagemap(want_5lv, memmap, memmap_entries); + memmap = get_memmap(&memmap_entries); + stivale_struct.memory_map_entries = (uint64_t)memmap_entries; + stivale_struct.memory_map_addr = (uint64_t)(size_t)memmap; + stivale_spinup(bits, want_5lv, pagemap, entry_point, &stivale_struct, stivale_hdr.stack); } diff --git a/stage2/protos/stivale2.c b/stage2/protos/stivale2.c index d2fc6729..3280e48c 100644 --- a/stage2/protos/stivale2.c +++ b/stage2/protos/stivale2.c @@ -292,7 +292,15 @@ void stivale2_load(char *cmdline, int boot_drive) { } size_t memmap_entries; - struct e820_entry_t *memmap; + struct e820_entry_t *memmap = get_memmap(&memmap_entries); + + // Check if 5-level paging tag is requesting support + bool level5pg_requested = get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_5LV_PAGING_ID) ? true : false; + + pagemap_t pagemap = {0}; + if (bits == 64) + pagemap = stivale_build_pagemap(level5pg && level5pg_requested, + memmap, memmap_entries); ////////////////////////////////////////////// // Create memmap struct tag @@ -308,17 +316,10 @@ void stivale2_load(char *cmdline, int boot_drive) { void *tag_memmap = conv_mem_alloc_aligned(sizeof(struct e820_entry_t) * memmap_entries, 1); memcpy(tag_memmap, memmap, sizeof(struct e820_entry_t) * memmap_entries); +print_memmap(memmap, memmap_entries); append_tag(&stivale2_struct, (struct stivale2_tag *)tag); } - // Check if 5-level paging tag is requesting support - bool level5pg_requested = get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_5LV_PAGING_ID) ? true : false; - - pagemap_t pagemap = {0}; - if (bits == 64) - pagemap = stivale_build_pagemap(level5pg && level5pg_requested, - memmap, memmap_entries); - ////////////////////////////////////////////// // Create SMP struct tag //////////////////////////////////////////////