pmm: Allocate memory from UEFI with EfiLoaderCode type

On AArch64 EfiLoaderData is remapped as non-executable, which means we couldn't
use it for the kernel in the Linux boot protocol.
This commit is contained in:
Kacper Słomiński 2024-06-11 21:54:53 +02:00 committed by mintsuki
parent b76556afbe
commit b30da71874

View File

@ -405,13 +405,13 @@ void init_memmap(void) {
EFI_PHYSICAL_ADDRESS base = untouched_memmap[i].base;
status = gBS->AllocatePages(AllocateAddress, EfiLoaderData,
status = gBS->AllocatePages(AllocateAddress, EfiLoaderCode,
untouched_memmap[i].length / 4096, &base);
if (status) {
for (size_t j = 0; j < untouched_memmap[i].length; j += 4096) {
base = untouched_memmap[i].base + j;
status = gBS->AllocatePages(AllocateAddress, EfiLoaderData, 1, &base);
status = gBS->AllocatePages(AllocateAddress, EfiLoaderCode, 1, &base);
if (status) {
memmap_alloc_range(base, 4096, MEMMAP_EFI_RECLAIMABLE, MEMMAP_USABLE, true, false, false);
}