efi_allocate_pages(9)
π efi_allocate_pages(9) β the kernel API manual, bestie edition π
okay so you're reading the efi_allocate_pages(9) page from the Kernel API Manual and honestly? it's giving "short but mighty" β¨ let me walk you through it π«Ά
πΈ NAME πΈ
efi_allocate_pages β literally just: allocate memory pages π
that's the whole vibe.
β¨ SYNOPSIS β¨
efi_status_t efi_allocate_pages (unsigned long size , unsigned long *addr , unsigned long max );
that's the whole signature, no cap. three args, one efi_status_t coming back at you π₯
π¦ ARGUMENTS π¦
sizeβ the minimum number of bytes you want allocated. minimum, bestie, not a promise of exactly that πaddrβ on return, this is where the address of the first allocated page lands. and listen: that first allocated page has alignmentEFI_ALLOC_ALIGN, which is an architecture dependent multiple of the page size π so yeah, it's aligned, just architecture-dependent about it.maxβ the address that the last allocated memory page shall not exceed. it's the ceiling, the boundary, the "do not pass go" line π§
π DESCRIPTION π
so what does it actually do? it allocates pages as EFI_LOADER_DATA π and the allocated pages are aligned according to EFI_ALLOC_ALIGN β¨ meanwhile the last allocated page will not exceed the address you passed in as max β that's the hard limit, periodt.
β RETURN β
status code. that's it, that's the return β a status code π you check it, you respect it.
π SEE ALSO π
- Kernel file
./drivers/firmware/efi/libstub/mem.c efi_get_memory_map(9)efi_free(9)efi_low_alloc_above(9)
go read those next, iykyk ππ«
ngl the whole thing lives in ./drivers/firmware/efi/libstub and this page is dated October 2026 πΈ so that's the source, the version, and the date all in one cute little sign-off π mwah, bye bestie! ππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms