UEFI Memory Allocation Page Flags

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
chicken
Posts: 12
Joined: Fri Aug 09, 2024 4:30 am

UEFI Memory Allocation Page Flags

Post by chicken »

When using UEFI to make a bootloader, the AllocatePages function can be used to allocate a certain set of pages of a specific memory type. Before memory can be used in long mode, it must be mapped. Is there a way to set/know which page table entry flags are used for when the memory for these allocations is mapped?
Octocontrabass
Member
Member
Posts: 5655
Joined: Mon Mar 25, 2013 7:01 pm

Re: UEFI Memory Allocation Page Flags

Post by Octocontrabass »

I don't think there's any way to know what will be used before you allocate it, but afterwards you should see the page attributes reflected in the memory map.

If you're worried about it, use EfiLoaderData for everything and switch to your own set of page tables between calling ExitBootServices and jumping to your kernel's entry point. (Or use a bootloader that handles it for you, like Limine.)
Post Reply