UEFI AllocatePages fails wrong parameters
Posted: Thu Aug 06, 2020 10:55 pm
Hi,
I have problems with AllocatePages when I try to allocate memory in UEFI.
It keeps failing on "EFI_INVALID_PARAMETER", I have tried different options for the parameters, but everything i have tried has failed with invalid parameters.
I have used the AllocatePool to request memory of type "EfiRuntimeServicesCode" with no problem.
Any obvious mistake?
Cheers
I have problems with AllocatePages when I try to allocate memory in UEFI.
It keeps failing on "EFI_INVALID_PARAMETER", I have tried different options for the parameters, but everything i have tried has failed with invalid parameters.
I have used the AllocatePool to request memory of type "EfiRuntimeServicesCode" with no problem.
Any obvious mistake?
Cheers
Code: Select all
void* buffer = 0x0;
UINTN num_pages = 10;
Status = BS->AllocatePages(AllocateAnyPages, EfiRuntimeServicesCode, num_pages, (EFI_PHYSICAL_ADDRESS*) buffer);
if (EFI_ERROR(Status))
{
ST->ConOut->OutputString(ST->ConOut, L"Could not allocate a page \r\n");
if (EFI_INVALID_PARAMETER == Status)
{
ST->ConOut->OutputString(ST->ConOut, L"Wrong parameters \r\n");
}
return;
}